Generate PDF files with ASP

Source: Internet
Author: User
Tags file system html form adobe forms visual studio
Creating a PDF with ASP
by Ty Button

Print this article

Email this article to a colleague


Introduction
Adobe ' s PDF format has become the lingua franca of Cross-platform for reporting many and agencies. While I is no great fan of the product, I have to admit it probably does a better job of producing a compact document wit h loads of formatting than Word ever would.
Getting Started
Working for a staffing firm, I have written all of our front-end software to run over the Internet so we can share common Databases with our smaller branch offices. The biggest problem we faced, however, was reporting. How does we get live documents (applications, etc.) to generate themselves when a applicant sits down at the kiosk and fill s out their on-line employment application? While we ' re doing a great job's capturing the data, we still need an applicant to sign the application, etc.
I tried a number of things, but the limits seem to be:

If I could produce it fast, it was a HTML form derivative and looked terrible when printed.
If I could produce it looking right, it is clunky and slow. This is because I settled on rich text as my best initial option and ended up using the ' File System Object to write RTF files ba Sed on a template and parse me info into them. The disk reads and writes took their toll.
Remember, we 抮 e not talking about tabular data or a EXCEL spreadsheet. We want the application with our logos to be processed.

Finally, I settled on Adobe. I hate the viewer and wish I didn ' t have to mess with it. However, the formatting looks good and the files are thin. Most users have it on their system, and the My users do.

so I searched and searched for ways to pass data from HTML forms to PDF files. I tried using Adobe forms, but didn ' t really like working with the validation, etc., and then would still to have O UT how to incorporate the database calls. This wasn ' t in all what I wanted. I wanted to pass data directly "I HTML form to" a database while generating the "field data into the" PDF file for Displ ay or printing.

Finally, there is a clue on UseNet. A Link posted by Jeremy Hunter contained much of what I'll address. Http://partners.adobe.com/asn/developer/acrosdk/forms.html

REQUIRED SOFTWARE
The ADOBE (full version) are required on the workstation defining the fields. (Not the server)

This is the "link to" Adobe Forms Acrobat Toolkit. From there it is easy going.

Step 1. Download the toolkit and unzip it to your directory of choice.

When doing, you'll find this all of the source code is included in VB and C + +. We ' re not going to worry about this, but the code is there if you need it.

Step 2. Register your DLLs.

Two DLLs need to is copied to your server. The "the" in "Visual Basic sub folder and is named Fdfacx.dll. The second is in the Visual C subfolder and is named Fdftk.dll. Run Refsvr32 on the Fdfacx.dll file. It would take care of registering the other itself. I put both in c:\winnt\system32\ and from that directory typed regsvr32 fdftk.dll. If you have a error message, check to make sure both files are really there. If not, we ' re set to go.

Step 3. Create the form.

We'll use a form the everyone is too familiar with for this demonstration-the W-4. This was readily available on http://www.irs.gov and gives us enough fields to show what we.


<%@ Language=vbscript%>
<HTML>
<HEAD>
<meta name= "generator" content= "Microsoft Visual Studio 6.0" >
</HEAD>
<BODY>
<form name=w4help action=w4.asp method = post>
<TABLE>
<TR>
&LT;TD align=right Valign=top>first name</td>
<td><input Type=text name=txtfirstname>
</TD>
</TR>
<TR>
&LT;TD align=right Valign=top>middle Initial
</TD>
<td><input Type=text name=txtmi>
</TD>
</TR>
<TR>
&LT;TD Align=right valign=top>lastname</td>
<td><input Type=text name=txtlastname>
</TD>
</TR>
<TR>
&LT;TD Align=right valign=top>social</td>
<td><input Type=text Name=txtsocial1 size=3>-
<input Type=text Name=txtsocial2 size=2>-
<input Type=text Name=txtsocial3 size=2></td>
</TR>
<TR>
&LT;TD align=right Valign=top>street address</td>
<td><input Type=text NAME



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.