Step 1 - Generate a PDF File

ASP User's Guide > Simple Sample Programs

The first sample script, step1.asp, begins with a few lines of code which show how to generate PDF documents on-the-fly.

Dim lc, tx
set lc = Server.CreateObject("TIS.TX.LicManager.32")
set tx = Server.CreateObject("TIS.TX.TextControl.32")
tx.EnableAutomationServer
...
tx.Text = "The quick brown fox jumps over the lazy dog."
' Save in Adobe pdf format (format identifier 12)
tx.Save Server.MapPath("demo.pdf"), 0, 12

The sample code above creates a document with the given text and writes it to the server as a PDF file. The output of the script provides a link to the generated document. You need Adobe Reader to view this file in your browser.

Please note the call to the MapPath method of the Server object. This method converts a virtual file name to the fully qualified path of the file system. Without the MapPath call TX Text Control would try to write he file to the current directory, because it cannot handle virtual file names. Due to the access restrictions of the anonymous internet user, calling the Save method would fail, as this user does not have permission to write to the current directory.

The format identifiers used with the Save method are listed in the reference description for this method.