Create PDF Document in ASP.NET and View in a Browser

A sample ASP.NET script using PDFBuilderASP

This example demonstrates the use of the PDFBuilderASP component in an ASP.NET script to generate a single page PDF document and display it in the client browser. The document is a simple invoice which is customised to show the name and address of a customer which have been sent to the ASP.NET script using an HTTP POST operation. This represents a typical application for this component.

To run this example now, complete the name and address fields further down this page and then click on the "Create PDF" button to submit the form data to the sample script on our server. (Note that we are not recording the data you enter, it is just being used to build the example PDF). After the script runs, a fictitious invoice in PDF format will be displayed in your browser.

To set this example up on your own server, download the trial version of PDFBuilderASP and a copy of the ASP.NET script used for this demo from the links below.

Trial version of PDFBuilderASP. (504kB)

Download the example ASP.NET script. (5kB)

Run the Example Script to Create an Invoice

By clicking on the "Create PDF" button below, the information entered in the name and address fields is submitted to an ASP.NET script on our server. This script then creates a PDF document using PDFBuilderASP. The script demonstrates how images are added (a company logo), how graphics are drawn (various rectangles and lines to show boxes on the invoice) and the writing of several text fields. Most of the text on the document is fixed, but the three data fields for the customer's name and address will be completed using the submitted information.

Finally, the document is displayed by first being output to an array of bytes, then streamed to the browser using Response.BinaryWrite.

Please enter a name (an imaginary one if you prefer).

Also, enter the first line of an address.

..and the second line of an address.

Finally, click the button below to generate the invoice.