Skip to Content
avatar image
Former Member

How To Generate PDF File IN PHP?

Hello.programmer.

I am a php beginner,I want to creat Pdf file in pHP ,but what can I do ?

I have found[ PHP PDF |http://www.phpkode.com/projects/category/php-pdf/]project already ,but what can I do ?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Jan 04, 2011 at 12:23 PM

    I use FPDF (http://www.fpdf.org/) to generate PDFs from PHP, it works great and the documentation is also good

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 16, 2011 at 04:46 PM

    Hi Guys,

    Iu2019ve always used ezpdf [http://www.ros.co.nz/pdf/|http://www.ros.co.nz/pdf/]

    Itu2019s a really nice and easy to use implementation with plenty of power. On their website if you try the live demo youu2019ll immediately see the sort of things you can do.

    Cheers

    Matt

    Edited by: Matthew Bartlett on Jan 16, 2011 5:46 PM

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      Use This code to generate PDF, and Happy code.

      <?php

      // create handle for new PDF document

      $pdf = pdf_new();

      // open a file

      pdf_open_file($pdf, "philosophy.pdf");

      // start a new page (A4)

      pdf_begin_page($pdf, 595, 842);

      // get and use a font object

      $arial = pdf_findfont($pdf, "Arial", "host", 1); pdf_setfont($pdf, $arial, 10);

      // print text

      pdf_show_xy($pdf, "There are more things in heaven and earth, Horatio,", 50, 750); pdf_show_xy($pdf, "than are dreamt of in your philosophy", 50, 730);

      // end page

      pdf_end_page($pdf);

      // close and save file

      pdf_close($pdf);

      ?>

      All the Best

      Madhu....