4

I'm stuck at work. I'm coding in PHP and I have to generate a PDF. My problem is that I have to create cards (same size of credit card 85.6*54mm), I'm using a template at the right size, but the page is still generated with A4 format. I can see my template on that page at the top left corner but the A4 page is filling the rest of my screen. Here is my code.

$pdf = new FPDI();
$pdf->setSourceFile('inc/om.pdf');  
$tplIdx = $pdf->importPage(2); 
$pdf->AddPage('L', array(85.6,54));   
$pdf->useTemplate($tplIdx); 

Does someone have a idea ?

  • 1
    Have you tried `$pdf = new FPDI("L", "mm", array(85.6,54));`? I've never used FPDI before, so not sure if that would make a difference compared to FPDF. – miken32 Dec 21 '15 at 20:54
  • Well, haven't tried that, i'll do it at work on tomorrow, I'll let you know if it works or not. Thank's mate :) – Damien Mentholine Lecomte Dec 21 '15 at 21:33

1 Answers1

6

I slightly modified the code that miken32 sent me, now it's working pretty well ! Thank you mate, that was the right way to do it.

$pdf = new FPDI('L','mm', array(54,85.6));
$pdf->setSourceFile('inc/om.pdf');  
$tplIdx = $pdf->importPage(2); 
$pdf->AddPage();   
$pdf->useTemplate($tplIdx);