Reputation: 2991
What setting would I need to change and to what in order for the rendered PDF file to be exactly 11 in. by 8.5 in.? Right now, for some reason the PDF I generate is 11.69 in. by 8.27 in. .
The code above is the only thing that works at producing a PDF, I've tried "new FPDF" instead of "new FPDI" and all I get are errors. How can I alter this code to be 11x8.5?
<?php
ob_clean();
ini_set("session.auto_start", 0);
define('FPDF_FONTPATH','font/');
define('FPDI_FONTPATH','font/');
require('fpdf.php');
require('fpdi.php');
$pdf = new FPDI();
$pdf->setSourceFile("Flyer.pdf");
$tplIdx = $pdf->importPage(1);
$specs = $pdf->getTemplateSize($tplIdx);
$pdf->addPage($specs['h'] > $specs['w'] ? 'P' : 'L');
$pdf->useTemplate($tplIdx, 0, 0, 297, 210);
$pdf->SetFont('helvetica');
$pdf->SetTextColor(255, 0, 0);
$pdf->SetXY(30, 30);
$pdf->Write(0, 'This is just a simple text');
ob_end_clean();
$pdf->Output('marketing.pdf', 'F');
?>
Upvotes: 0
Views: 785