{oapdf_gg}
PHP is one of the greatest advantages of new technologies to support its very easy language scalability enables developers to easily add new modules, and technical organizations around the world support and the many expansion modules support makes PHP has become the most complete one of the Web programming language. Expansion modules currently available have been able to allow developers to implement IMAP and POP3 operations, can be dynamically generated images and Shockwave Flash animation, for credit card authentication, encryption and decryption of sensitive data, but also be able to resolve XML format. But this is not all, now, there is a new module to bind with PHP, it is PDFLib expansion module, which allows developers to dynamically generate PDF (Adobe Portable Document Format) file format, on the first look at the following look at how to use the PHP module. extension = php_pdf.dll If it is the dynamic loading, it could be a reference to the following order: dl ( "php_pdf.dll "); In addition, you must have an Adobe Acrobat PDF Reader to browse PDF format, if you do not, you can http://www.adobe.com/ free download. //Create a new PDF document handle //open a file //start a new page (A4) //get and use the font object //output text //end of page //Close and save the file and then save into a PHP document, carried out in the browser browser, PHP would be the implementation of the above code, it generates a new PDF document and save it to the designated location. $ pdf = PDF_new (); this task is PDF_new () function to complete, it returns a PDF document handle, the handle will be the follow-up of all the action. PDF_open_file ($ pdf, "PDFTest.pdf "); Once we have created a document, you can use PDF_begin_page () function to insert a new page in which the: PDF_begin_page ($ pdf, 595, 842); then PDF_end_page () the end of the page. $ arial = PDF_findfont ($ pdf, "Arial", "host", 1); Once we set a font, you can use PDF_show_xy () function to specify the location of the page to write in the string. PDF_show_xy ($ pdf, "This is an exam of PDF Documents, It is a good Lib,", 50, 750); PDF_show_xy () function used to write the contents of the page, the last two parameters is to write the coordinates of the location of the string, pay attention to the origin coordinates (0,0) is in the lower left corner of the document. Once the text has been finished, the page will be closed PDF_end_page (), of course, you can write more pages. After all the pages finished with PDF_close () function to close the document, this time back to save the document to call PDF_open_file () function when the specified file name and path, then handle the destruction of documents. $ image = PDF_open_image_file ($ pdf, "jpeg", "PDFImageTest.jpg"); is not very simple? PDF_open_image_file () function to open a graphics file, you can accept image types: GIF, JPEG, TIFF and PNG, the function returns image handle, PDF_place_image () function handles the use of images in front of the image inserted into the PDF document. Attention to the coordinates of the location here is the image of the lower-left corner, the last parameter is the image displayed when the scale factor, 1 is the same size and the actual display, 0.5 is half the size of the original show. |