PHP generates PDF documents with images and links _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
PHP generates PDF documents with images and links. Using PHP to generate PDF documents online seems very simple. In fact, this is not the case, so I decided to write it down and provide you with an idea. Searching for PHP to generate P on the internet and using PHP to generate PDF documents online seems very simple. In fact, this is not the case. so I decided to write it down and provide you with an idea. There are many ways to search for "PHP to generate PDF" on the internet. the following three methods are the most mentioned on the Internet: ■ PDFLib: this is a PHP Extension Library, you need to install and enable the server space. this method does not work for the vast number of slashes in the rented space. ■ TCPDF: TCPDF is a PHP5 function package used to quickly generate PDF files. it is extended and improved based on FPDF. This function package is complicated to use. after trying for an hour, I gave up. ■ HTML2PDF: the HTML page can be directly converted to a PDF file with powerful functions. Unfortunately, the environment configuration is complicated and failed after several attempts. you can only find another method. During this period, I also found a paid online PDF conversion platform such as javascrowd. Obviously, the customers will not accept the charges. when I almost want to give up, I found the native function package FPDF. It is small in size and easy to use. it can produce PDF documents online to meet customer requirements. The following is a FPDF call code: Image ('http: // www.westationery.com/wp-content/themes/zwenju/images/developer.jpg',); $ this-> Ln (15);} // Pie de páginafunction Footer () {$ this-> SetY (-10); $ this-> SetFont ('arial', 'I', 8); $ this-> Cell (0, 10, 'page '. $ this-> PageNo (). '/{nb}', 'C') ;}// Creaci ón del objeto de la clase heredada $ pdf = new PDF (); $ pdf-> AliasNbPages (); $ pdf-> AddPage (); $ pdf-> SetFont ('Times ', '', 12 ); $ pdf-> Image ($ imgArray [0], + ($ I-1 ) *, 37, '', get_permalink ($ post-> ID); $ pdf-> SetX (53); $ pdf-> Cell (, 'Model No. :'. get_post_meta ($ post-> ID, "model_no", true), 110); // $ this-> SetX (); $ pdf-> Cell, str_replace ('SW', '"', get_the_title (),); $ pdf-> SetX (53); $ pdf-> output('weate ', 'I');?> Below is a PDF document I have produced online using FPDF, with images, links, and automatic paging.

Bytes. Search for PHP on the Internet to generate P...

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.