<?
// Php PDF file generation code
/*
It is very complicated to generate a PDF file. Let's take a look at the complete php PDF file generation code, he can generate a PDF file from a text file or use an image file to generate a PDF file.
This PDF file is used
Fpdf. php
Chinese. php
Picpdf. php
*/
// Fpdf. php code
Define ('fpdf _ version', '1. 6 ');
Class fpdf
{
Var $ page; // current page number
Var $ n; // current object number
Var $ offsets; // array of object offsets
Var $ buffer; // buffer holding in-memory pdf
Var $ pages; // array containing pages
Var $ state; // current document state
Var $ compress; // compression flag
Var $ k; // scale factor (number of points in user unit)
Var $ deforientation; // default orientation
Var $ curorientation; // current orientation
Var $ pageformats; // available page formats
Var $ defpageformat; // default page format
Var $ curpageformat; // current page format
Var $ pagesizes; // array storing non-default page sizes
Var $ wpt, $ hpt; // dimensions of current page in points
Var $ w, $ h; // dimensions of current page in user unit
Var $ lmargin; // left margin
Var $ tmargin; // top margin
Var $ rmargin; // right margin
Var $ bmargin; // page break margin
Var $ cmargin; // cell margin
Var $ x, $ y; // current position in user unit
Var $ lasomething; // height of last printed cell
Var $ linewidth; // line width in user unit
Var $ corefonts; // array of standard font names
Var $ fonts; // array of used fonts
Var $ fontfiles; // array of font files
Var $ diffs; // array of encoding differences
Var $ fontfamily; // current font family
Var $ fontstyle; // current font style
Var $ underline; // underlining flag
Var $ currentfont; // current font info
Var $ fontsizept; // current font size in points
Var $ fontsize; // current font size in user unit
Var $ drawcolor; // commands for drawing color
Var $ fillcolor; // commands for filling color
Var $ textcolor; // commands for text color
Var $ colorflag; // indicates whether fill and text colors are different
Var $ ws; // word spacing
Var $ images; // array of used images
Var $ pagelinks; // array of links in pages
Var $ links; // array of internal links
Var $ autopagebreak; // automatic page breaking
Var $ pagebreaktrigger; // threshold used to trigger page breaks
Var $ inheader; // flag set when processing header
Var $ infooter; // flag set when processing footer
Var $ zoommode; // zoom display mode
Var $ layoutmode; // layout display mode
Var $ title; // title
Var $ subject; // subject
Var $ author; // author
Var $ keywords; // keywords
Var $ creator; // creator
Var $ aliasnbpages; // alias for total number of pages
Var $ invalid version; // pdf version number
/*************************************** ****************************************
**
* Public methods *
**
**************************************** ***************************************/
Function fpdf ($ orientation = 'p', $ unit = 'mm', $ format = 'A4 ')
{
// Some checks
$ This-> _ dochecks ();
// Initialization of properties
$ This-> page = 0;
$ This-> n = 2;
$ This-> buffer = '';
$ This-> pages = array ();
$ This-> pagesizes = array ();
$ This-> state = 0;
$ This-> fonts = array ();
$ This-> fontfiles = array ();
$ This-> diffs = array ();
$ This-> images = array ();
$ This-> links = array ();
$ This-> inheader = false;
$ This-> infooter = false;
$ This-> lath = 0;
$ This-> fontfamily = '';
$ This-> fontstyle = '';
$ This-> fontsizept = 12;
$ This-> underline = false;
$ This-> drawcolor = '0G ';
$ This-> fillcolor = '0G ';
$ This-> textcolor = '0G ';
$ This-> colorflag = false;
$ This-> ws = 0;
// Standard fonts
$ This-> corefonts = array ('courier '=> 'courier', 'courierb' => 'Courier-bold ', 'courieri' => 'Courier-oblique ', 'courierbi' => 'Courier-boldoblique ',
'Helvetica '=> 'Helvetica', 'helveticab' => 'Helvetica-bold ', 'helveticai' => 'Helvetica-oblique ', 'helveticabi '=> 'Helvetica-boldoblique ',
'Times '=> 'Times-roman', 'timesb' => 'Times-bold ', 'timesi' => 'Times-italic ', 'timesbi' => 'Times-bolditalic ',
'Sympost' => 'sympost', 'zapfdingbats' => 'zapfdingbats ');
// Scale factor
If ($ unit = 'pt ')