Menu

Issue with Multiple Page PDF - Please help

Help
2014-09-17
2014-09-30
  • elite-fusion

    elite-fusion - 2014-09-17

    I am new to PHP and am having a bit of a hard time with using FPDI when it comes to inserting multiple pages.

    I have a .pdf file which consists of 3 pages. I ended up saving page 1 as a separate page out of the 3 and that worked with my code, but that is because my code is meant only for 1 page. When I change it back to the 3 page file, it gives me an internal server error.

    This is the code which I am using:

    require_once('prog/fpdf.php');
    require_once('prog/fpdi.php');

    // initiate FPDI
    $pdf = new FPDI();

    // add a page
    $pdf->AddPage();

    // set the source file
    $pdf->setSourceFile("apps/Par.pdf");

    // import page 1
    $tplIdx = $pdf->importPage(1);

    // use the imported page and place it at point 10,10 with a width of 100 mm
    $pdf->useTemplate($tplIdx, null, null, 0, 0, true);

    // font and color selection
    $pdf->SetFont('Helvetica');
    $pdf->SetTextColor(200, 0, 0);

    // now write some text above the imported page
    $pdf->SetXY(40, 83);
    $pdf->Write(2, 'THIS IS JUST A TEST');

    $pdf->Output();

    I am not sure how to turn this code into having the ability to see all 3 pages.
    Please help me out who ever can.

     
  • elite-fusion

    elite-fusion - 2014-09-19

    Anyone?

     
  • Simon

    Simon - 2014-09-19

    If you get an internal server error can you check your web server error log for more details.

     
  • Jan Slabon

    Jan Slabon - 2014-09-22

    You should simply check for answers on your other opened threads: http://stackoverflow.com/questions/25898678/fpdi-with-multiple-pages/25914022#25914022

    Also you should use a correct email address if you ask for support: proselleursa@gmail.com is not correct ;-)

     

Log in to post a comment.