TCPDF Page Margin Error

I am creating PDF files with PHP using TCPDF. I have a little problem with the generated PDF files. I would like to create a right and left margin for each generated PDF file. Currently, if there is 10px margin on the left side, there is a 20px edge on the right side.

How to adjust the right and left margins of the page?

Thank you all for your time and concern.

I tried the following:

$pdf->SetMargins(10, 10, -50, true);and $pdf->SetRightMargin(-50);no luck.

+5
source share
1 answer

In the new documentation, it displays the function as

TCPDF::SetMargins($left,$top,$right = -1,$keepmargins = false)

And describes the parameters as:

Parameters:

$left   (float) Left margin.
$top    (float) Top margin.
$right  (float) Right margin. Default value is the left one.
$keepmargins    (boolean) if true overwrites the default page margins

, a -1 , , , . -50, .

:

$pdf->SetMargins(10, 10, 10, true);
+16

All Articles