[thelist] how to convert an existing php output in pdf format?help needed..

Bojan Tesanovic btesanovic at gmail.com
Thu Sep 27 01:11:33 CDT 2007

Here is the PDF class that doesn't require external libraries

There is no documentation but you can see examples from test folder
or you can see constructor of main Class

here is simple example
$params = array();
$params['orientation']=> 'P'; //portrait  can be also L (landscape)
$params['format']=>'A4' //size of page

$pdf = File_PDF::factory(array('orientation' => 'P', 'format' => 'A4'));
$pdf->setFont('Courier', '', 8);
$pdf->text(100, 100, 'First page');
// Text at x=100 and y=200.
$pdf->text(100, 200, 'HELLO WORLD!');
// Add a new page.
// Set font to Arial bold italic 12 pt.
$pdf->setFont('Arial', 'BI', 12);
// Text at x=100 and y=200.
$pdf->text(100, 100, 'Second page');

$PDFout = $pdf->getOutput();

//here you can fluch PDFout to browser or save to a file

here are possible values for $params

  * @param array $params  A hash with parameters for the created PDF object.
      *                       Possible parameters are:
      *                       - orientation - Default page orientation. Possible
      *                         values are (case insensitive):
      *                         - P or Portrait (default)
      *                         - L or Landscape
      *                       - unit - User measure units. Possible values
      *                         values are:
      *                         - pt: point
      *                         - mm: millimeter (default)
      *                         - cm: centimeter
      *                         - in: inch
      *                         A point equals 1/72 of inch, that is to say
      *                         about 0.35 mm (an inch being 2.54 cm). This is a
      *                         very common unit in typography; font sizes are
      *                         expressed in that unit.
      *                       - format - The format used for pages. It can be
      *                         either one of the following values (case
      *                         insensitive):
      *                         - A3
      *                         - A4 (default)
      *                         - A5
      *                         - Letter
      *                         - Legal
      *                         or a custom format in the form of a two-element
      *                         array containing the width and the height
      *                         (expressed in the unit given by the unit
      *                         parameter).
      * @param string $class  The concrete class name to return an instance of.
      *                       Defaults to File_PDF.

jothi jothi wrote:
> hello there..
>   I am a student doing a project in php.I have output that were generated by the php codes..i woulg to to convert the output in to pdf format?what should i add in my existing php codes?
>   I have gone through some tutoarials...i still dont understand on how to convert this output in to pdf format?If any of you have gone through this problem,and if you had the solution,could pls guide me?
>   Thank you for your time..
>   regards,
>   Thivya
> ---------------------------------
> Boardwalk for $500? In 2007? Ha! 
> Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games.

Bojan Tesanovic

More information about the thelist mailing list