This project is read-only.

What is the correct syntax of using page size command

Feb 12, 2011 at 6:58 AM
Edited Feb 12, 2011 at 7:06 AM



I am trying to use pageSizeW command to set the size of my word document.I am getting the error.Any anyone plz tell whats is the correct way to declare it,

I have done something as below

$section = $PHPWord->createSection();

$sectionStyle = $section->getSettings();



Feb 13, 2011 at 4:06 PM

This works for me. I needed to print a small card. Units of measure are in twips.

$section = $PHPWord->createSection(
  array( 'marginLeft'=>210, 'marginRight'=>200, 'marginTop'=>620, 'marginBottom'=>0, 'pageSizeW'=>3038.4, 'pageSizeH'=>4847.04));

Aug 10, 2014 at 8:32 AM
Good jillelaine, it works fine. But that size in milimeter, pixel or others? and how about set to general size such as F4, A4 etc?
Aug 10, 2014 at 3:53 PM
"Twip" is a unit of measurement equal to 1/20th of a printers point. There are 1440 twips to and inch, 567 twips to a centimeter.

You should also check out the phpWord development on github:

They have added the ability to use measurement unit other than twips with setMeasurementUnit, thanks to ivanlanin, and many other features and bugfixes.