Ciansoft Banner

Write and Format Text in a PDF Document in PHP

A sample script using PDFBuilderASP

The component PDFBuilderASP includes several functions for formatting text that is written to a PDF file. This example script demonstrates the use of these functions.

To run this example script, download the trial version of PDFBuilderASP and a copy of the PHP script used for this demo from the links below.

Trial version of PDFBuilderASP. (504kB)

Download the example PHP script. (3kB)

Running the example script

To run the example, extract the file pbaphpdemotext1.php from the downloaded zip file and copy this file to a web server directory. A True Type font file must also be copied to the server root directory and the script edited to refer to this file on the line which includes the AddFont command. Open the PHP page in a browser and a PDF file will be created and displayed.

More detailed instructions for running this script are available in the readme.txt file in the download.

The following properties and methods are demonstrated by this script: AddFont, TextFont, TextSize, TextColor, TextLineSpacing, TextMaxWidth, TextAlign and WriteText. Try editing the various lines of code to see the effect on the PDF document produced.

© Ciansoft 2016.    |    Ciansoft is a trading name of IC Technologies Ltd.