Php PDF file generation code (1/12) _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
Tags php pdf
Php generates the PDF file code (112 ). Php generates PDF file code to generate a PDF file. if it is really good to generate, it is very complicated. let's take a look at the complete php PDF file generation code, he can generate a text file in php to generate a PDF file code. if it is really good to generate a PDF file, it is very complicated. 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.

// 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') 1 2 3 4 5 6 7 8 9 10 11 12

...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.