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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.