Update System Library
Insert/usr/local/lib into/etc/ld.so.conf (file)
Testing and validation
Now you need to restart Apache.
Copy pdfclock.php to the httpd directory (that is, the Web directory) ... Test.... Everything's fine.
To make phplib work with fonts you must pay attention to the UPR part of the Pdflib manual.
The simplest way to use Pdflib fonts is to copy the standard UPR description file (FONTS/PDFLIB.UPR) in the Pdflib tar package to your working directory.
Extract PDF document
Now we have the conditions to generate the PDF document as quickly as we could!
In this small example we want to generate the Flystore company's demand brochure, of course, to extract data from the catalog database.
Preparing the Database
I assume you have a bit of database experience, minimal, and I really just want you to know how to create a database and insert a table into it.
CREATE TABLE Catalogue:
Send MIME header information
In order for us to display correctly, we need to send the correct header information to the user's browser.
In PHP we can use the header function to implement. The following code sends the correct MIME type to the browser.
In order to generate the PDF document, we need to do the following steps:
Open a PDF stream and associate it with a handle:
$pdf = Pdf_open ();
(Optional) Set Document information like Author, Title, Subject, etc
(optional) Set up document information, such as author, title, subject, etc.
Start a new page (PDF file can produce different pages in different layouts, such as portrait, foreground ...):
Pdf_begin_page ($pdf, 595, 842);
(optional) Set up a hyperlink:
Pdf_add_outline ($pdf, "Item". $data );
Select font type, size (Pdf_set_font ($pdf, "Helvetica-bold", Winansi);) Performance mode
Insert text at X.Y location:
Pdf_show_xy ($pdf, "Item:". $data , 100, 700);
or insert picture in x.y position:
Pdf_place_image ($pdf, $im, 100, 300, 3);
Refreshes the text buffer and closes the PDF stream.
PDF coordinate Systems
What We need to be locate a string or picture in some part of the PDF page,
In many places on the PDF page we need to locate strings and pictures, convert English units to DTP point values.
In the Pdflib manual, page 45 reads:
".. . The origin of the default coordinate system is in the lower left corner of the page, with the DTP point as the unit:
1 pt = 1 INCH/72 = 25.4MM/72 = 0.3528 mm
Here is the code snippet that generated the PDF file:
In the end, I want to prompt you this article is not a PDF tutorial, if you need more information and usage of PDF documents, you can access
I hope it works for you.
This article is an English version of an article which is originally in the Chinese language on aliyun.com and is provided for information purposes only. This website makes no representation or warranty of any kind, either expressed or implied, as to the accuracy, completeness ownership or
reliability of the article or any translations thereof. If you have any concerns or complaints relating to the article, please send an email, providing a detailed description of the concern or
complaint, to email@example.com. A staff member will contact you within 5 working days. Once verified, infringing content will be removed immediately.
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:
and provide relevant evidence. A staff member will contact you within 5 working days.