Replies: 5   Views: 1173
How to add modifypagelayout ( string $papertype [ array $options ) for customizing document format
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by abhay.pai  · 14-04-2017 - 10:40

I had used below code, but in resulted doc i am not getting the margins 

     $docx->modifyPageLayout('custom', array('marginTop' => '30', 'marginRight' => '30', 'marginBottom' => '30', 'marginLeft' =>  '30',));

can anyone please let me know where am i going wrong ?

Posted by admin  · 14-04-2017 - 11:01


Which license and version of phpdocx are you using?


Posted by abhay.pai  · 14-04-2017 - 11:06

thanks a lot for replying, am using a trail version for testing purpose which i'll convert in licensing version as soon as all my testings are done with the trial one.

can you please help me with the above code ?

Posted by admin  · 14-04-2017 - 11:23


Sorry but we don't know what could be wrong in your code and the trial package doesn't include support; we recommend you to check and run the included examples. After you have purchased a license please contact us again.

We guarantee you that all methods work perfectly.


Posted by abhay.pai  · 14-04-2017 - 11:42

Thanks a lot for informing.

But anyways, i had managed to work on it.

        $docx->modifyPageLayout('custom', array('marginLeft' => 860.779527559, 'marginRight' => 860.779527559, 'marginTop' => 200, 'marginBottom' => 200,));


Posted by admin  · 14-04-2017 - 12:17


So the problem was that you were using string values instead of integers.The API documentation explains the var types that can be used with all options of each method.