0

Hello,
This is about a PHP PDF utility called "FPDF." Can anyone tell me if it is possible to change the margins on the second page of a PDF using the library. I set the margins on the first page, but because the first page has a letterhead, it starts about 2.5" down the page. When I come to the second page, I tried to reset the margins, but it does not appear to accept a reset. I am new at using FPDF, so I'm probably missing something. Here is my code:

$pdf = new PDF();
// First page
$pdf->SetMargins(25,65,25);
$pdf->AddPage();
$pdf->SetFont('Arial','',20);
$pdf->SetFontSize(12);
$pdf->Image('../../Old-Web/images/Foundation-Logo_new.gif',81,5,48,0,'GIF');
$html="Some Text";
$pdf->WriteHTML($html);
//Second Page
$pdf->AddPage();
$pdf->SetTopMargin(25);
$htmp="Some More Text";
$pdf->WriteHTML($html);
$pdf->Close();

The PDF is generated correctly with all text, images, etc., but the second page has a large white space at the top where the letterhead was. I've also tried reusing "SetMargins(25,25,25)" on the second page, also with no results.

Any help would be greatly appreciated.

2
Contributors
1
Reply
15
Views
4 Years
Discussion Span
Last Post by rayidi
0

try to add this $pdf->SetY(-25); after 12th line in your code. Lets try and let me know if it not working.

Edited by rayidi

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.