Ciansoft Banner

Create PDF text document in VB

A sample application using PDFBuilderX

This example shows how to create a PDF document containing text and to format that text in a number of ways, using VB.

To use this demo, you will need to download two files:

Trial version of the ActiveX control PDFBuilderX. (913kB)

Zip file of VB demo project. (5kB)

Install PDFBuilderX, then extract the VB demo files from pbx_text1.zip. Open Visual Basic, and open the project PBX_Text1.vbp.

The project consists of a single form, fMain. All the code is included in this form, there are no other modules. Run the project and you will be guided through three steps to create a PDF file.

PDFBuilderX Demo Screenshot

The first step is to select and load a font. The second step is to add a block of text after setting various configuration parameters. Finally, the PDF file is saved to disk.

The font to be used for the demo must be a TrueType font (.ttf file). The file name must be entered into the text box before clicking the 'Load Font' button. The file will be loaded from the Fonts subdirectory of the Windows directory. If a file from a different location is to be used, the code in Sub cmdLoadFont_Click must be modified accordingly.

The units of measure can be selected when adding the text. These units will be used for the value of the width used for wrapping text and for the location on the page where the text will be written. The location is measured from the bottom left corner of the page.

After saving the file, view the file in a suitable PDF viewer such as Adobe Acrobat Reader, to see the effect of the configuration parameters that were chosen.

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