How to Export to PDF From

by Jim Campbell

A PDF file and the VB.NET Crystal Reports feature provides programmers with the ability to export data from the VB application to the PDF file format. You use this feature when you want to export data in a report or listed in a graph on the Windows form. PDF files are then stored on the user's hard drive, so the user can later review the data and distribute the file to other users.


Open the Visual Studio software from the Windows program menu and open your VB.NET project. Double-click the file you want to use to export the data.


Instantiate the Crystal Reports class. This class sets up the PDF target file and contains the functions to export data. The following code instantiates the class: Dim crystal As New ReportDocument


Set up the export PDF file you want to use to store the data. The following code exports data to "data.pdf," but you name the file any name for your own app: Dim options As New PdfRtfWordFormatOptions() options.DiskFileName = _ "c:\data.pdf" exportOpts= crystal.ExportOptions


Export the data. The following function exports the data to the PDF file: crystal.Export()

Video of the Day

Brought to you by Techwalla
Brought to you by Techwalla

About the Author

Jim Campbell has been a computer engineer for over five years. He excels in hardware repair, computer programming and troubleshooting, and software design. He is currently attending Florida Atlantic University, pursuing a master's degree in computer and electrical engineering and fine-tuning his technical writing abilities.

More Articles