Tcpdf Description Document

Source: Internet
Author: User

TCPDF Description Document

First, call the tcpdf file

Require_once (' tcpdf.php ');

Second, instantiate the Tcpdf class page orientation (P = portrait,L = Landscape), measurement (mm), page format

$pdf = new TCPDF (' P ', ' mm ', ' A4 ', true, ' UTF-8 ', false);

third, set up the document information

Set up Document Information ----file creator

$pdf->setcreator (' Helloweba '); $pdf->setauthor (' Yueguangguang '); $pdf->settitle (' Welcome to helloweba.com! ' ); $pdf->setsubject (' TCPDF Tutorial '); $pdf->setkeywords (' TCPDF, PDF, PHP '

Iv. Setting default header Data

  $pdf->setheaderdata (Pdf_header_logo,pdf_header_logo_width, Pdf_header_title. 038 ', pdf_header_string);

V. setting header and footer information

$pdf Array Array (0,64,128)); $pdf->setfooterdata (arrayarray(0,64,128));
    1. Set Header and footer fonts
$pdf->setheaderfont (Array(' stsongstdlight ', ' ', ') '); $pdf->setfooterfont (Array(' Helvetica ', ' ', ' 8 '));

    1. Set the default equal-width font
$pdf->setdefaultmonospacedfont (' Courier ');

Eight, set the default width font

$pdf->setdefaultmonospacedfont (' Courier ');

Nine, set the spacing

$pdf->setmargins (AT-); $pdf->setheadermargin (5); $pdf

X. setting Paging

$pdf->setautopagebreak (TRUE, 25);

Xi. Set up automatic page change

$pdf->setautopagebreak (TRUE, Pdf_margin_bottom);

12. set the image scale factor

$pdf->setimagescale (1.25);

13. Set Default font construction subset mode

$pdf->setfontsubsetting (true);

14. Set the font

$pdf->setfont (' stsongstdlight ', ', 12);

XV, add a page

$pdf->addpage ();

16. This method prints text from the current location

(line height, text variable, URL or identifier returned by Addlink (), background draw, allow center or align the lines, if the line at the bottom of the cursor is set correctly, otherwise set the cursor line, font extension mode, if you really only print the first line and return the remaining string, If the real string is the start of a row, the maximum height, padding)

$pdf->write (0, $str 1, ', 0, ' L ', True, 0, False, False, 0);

17. Security Password Settings

$user _pass user password,$owner _pass owner password,$mode encryption strength 0 = RC4 40 bit, 1 = RC4 128 bit, 2 = AES 128 bit, 3 = AES 256 bit. , $pubkeys array contains the recipient and permission ("P") of the Public key certificate ("C") $pdffile [' Password ']

$pdf->setprotection ($permissions = Array (' print ', ' modify ', ' Copy ', ' annot-forms ', ' fill-forms ', ' extract ', ' Assemble ', ' Print-high '), $user _pass = ' 123456 ', $owner _pass = null, $mode = 0, $pubkeys = null);

18. Output PDF

The default is I: Open in the browser,D: Download,F: Generate PDF on server, S: Only return the PDF string, personal feeling meaningless

$pdf->output (' t.pdf ', ' I ');

Extension --Enter text:

Single-line text
Cell ($w, $h =0, $txt = ", $border =0, $ln =0, $align =", $fill =0, $link = ", $stretch =0)
Cell (width , height , content , border , whether line wrapping, text alignment , text background , connection , widening )

Multiple lines of text
Multicell ($w, $h, $txt, $border =0, $align = ' J ', $fill =0, $ln =1, $x = ', $y = ', $reseth =true, $stretch =0, $ishtml =false, $aut Opadding=true, $maxh =0)
Multicell (width , height , content , border , text alignment , text background , whether to wrap, x-coordinate, y -coordinate, get taller , widen , HTML supported , self- Dynamic fill , maximum height )

HTML text

Sethtmllinksstyle ($color =array (0,0,255), $fontstyle = ' U ');
Sethtmllinksstyle (color default Blue , U has underline );
Addhtmllink ($url, $name, $fill =0, $firstline =false, $color = ", $style =-1);
Addhtmllink (hyperlink address , display text , whether there is a background , $firstline =false, $color = ", $style =-1);

Line break

Ln ($h = ", $cell =false);
Ln (number of rows, whether cell);
For example:
$pdf->setprotection (Array (' print ', ' modify ', ' Copy ', ' annot-forms '), ' 854230 ');

Picture background

Image ($file, $x, $y, $w, $h, $type, $link, $align, $resize, $dpi, $palign, $ismask, $imgmask, $border);

Note: Put the picture in front of the statement, and use absolute coordinates to locate, you can do the background.

Tcpdf Description Document

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.