Use ASP to generate a PDF file

zhaozj2021-02-16  38

The Adobe PDF format has become a general media format that many organizations and companies conduct cross-platform tab. Although I am not the fanatic and obsessed with this product, I have to accept such a fact: I will have an agreement with this format that may be better than using Word.

Due to work in a employment company, I have written all our early software to run on the Internet so that we can share a public database with a small subsidiary. However, the biggest problem we encounter is tabulation. How do we get the current document (or apply) when you fill in their employment applications online in the information station. Since we have made a lot of work to get data, we also need to manually fill in a request.

I tried various ways, but it seems to have a big limit:

If I can generate it quickly, it can only be an HTML-form derivative, which will become unrecognizable when printing. If the design looks beautiful, it will become very slow. This is because I chose to use the RTF format as my preference, then use the file system object to complete the template-based RTF file, and finally add my information. The process of this disk read and write will take a long time. Remember: We are not discussing list data or an Excel spreadsheet. We want to let the program use our own logo to process.

Finally, I chose Adobe (very much like a advertisement word? - translator). I hate it browser so I hope that I will not be entangled with it, but its format looks very good and the file is not big. Most users are installed in the system, and our customers are no exception.

So I have been looking for a way to pass data from an HTML form to a PDF file. I have tried using the Adobe form, but it can't really run, and then also count how to merge database requests. This is not what I want, I want to pass the data directly from my HTML form to the database, then generate data information to the PDF file as browsing or printing.

In the end, I found the clue at Usenet. A link that is submitted by Jeremy Hunter contains a lot of things I am going to talk here -

Http://partners.adobe.com/aSn/developer/acroSDK/Forms.html.

First, you must install an Adobe full version on the workstation of the definition field (not the server). This is a link to Adobe Forms Acrobat Toolkit, which is easy to start everything.

First, download this set tool and unpack it to the specified directory.

When you do this, you will find that all source code is in VB or VC . We don't intend to pay attention to it here, but if you need code here.

Second, register your DLL.

There are two DLLs that need to be copied to your server. A fdfacx.dll in the Visual Basic folder, and the other is fdftk.dll in the Visual C folder. Register the fdfacx.dll file with Regsvr32. I put these two files under C: WinntSystem32 and enter "Regsvr32 FDFTK.dll under the current path." If you encounter an error message, please check that the two files are indeed in the current directory, there is no problem to enter the next step.

Third, establish a form.

We will use each person's form that is familiar with this demonstration. This is ""

http://www.irs.gov "can be free to provide us with enough field to show what we can do.

Fourth, define the Adobe form field.

After opening the document in Adobe Acrobat, select the Form Tool to describe your first form field (First Name).

After you define it, it will make you name, I am named "firstname" here. Note that there are several standard additional format options, in addition to the font size, I chose to conduct legality checks and format my ASP documentation. Since this is a quick demo, I choose to skip any check, but I will process the client's form and format the ASP page before passing the variable. Continue additional fields, each of them should be naming and may format the font size or attributes.

Save your changes on the server.

Fifth, write the ASP page.

Before you start this step, you have to pay attention to a major object that FDF set tools - "fdfapp.fdfapp". It has opened many ways, and other possible methods are outlined on the manual. We mainly care about two methods - FDFSetValue and FDFSetFile. Next, cut into the topic.

Sixth, there is no need to become a PDF expert, this is my current suggestion. User guidance of the set tool outlines all methods, which seems to have many possible methods outside this introduction. As you can see, you can easily add the database command to collect data or log data to the database.

Introduction to the original author:

Ty Button is a employment company called Cardinal Services in Oregon. Cardinal Services has been rated by Oregon Commercial Magazine from 1997 and 1998 Oregon No. 1 employment company, and is rated as the fastest growing company in Oregon by the South Coast Commercial Development Center and Bank of America. Button is MIS developers, which also spent most of the network database development and production process automation.

The following is in the original text

Creating a pdf with ask the aspby type

Print this Article

Email this Article to a colleague

IntroductionAdobe's PDF format has become the lingua franca of cross-platform reporting for many agencies and companies. While I was no great fan of the product, I have to admit it probably does a better job of producing a compact document with loads of formatting than Word ever will. Getting StartedWorking 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 do we get live documents (applications, etc.) to generate themselves when an applicant sits down at the kiosk and fills out their on-line employment application? While we're doing a great job of capturing the data, we still need an applicant to Sign The Application, W-4, ETC. I Tried a Number of Things, But The Limits Seem To BE:

If I could produce it fast, it was an HTML form derivative and looked terrible when printed. If I could produce it looking right, it was clunky and slow. This is because I settled on RTF as my best initial option and ended up using the File System Object to write RTF files based on a template and parse my info into them. The disk reads and writes took their toll. Remember, we Zhen e not talking about tabular data or an Excel spreadsheet. We want the application with our logo to be processed.Finally, I settled on Adobe. I hate the viewer and wish I did not have to mess with it. However, the formatting looks good and the files are thin. Most users have it on their system, and all 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 did not really like working with the validation, etc., and then would still have to figure out how to incorporate the database Calls. this wasn't at all what i wanted. I Wanted to Pass Data Directly from My HTML FORM to a Database While Generating The Field Data INTO The PDF File for Display Or Printing.

Finally, There Was a Clue on UseNet. A Link Posted by Jeremy Hunter Contained Much of What Will Address Here. Http://partners.adobe.com/ASn/developer/ACROSDK /FORMS.HTML

Required SoftwareAdobe (The Full Version) Is Required On The Workstation Defining The Fields. (NOT THE SERVER)

This is The link to the adobe forms acrobat Toolkit. From there it....

Step 1. Download The Toolkit and Unzip It to your Directory of Choice.

WHEN you do, you'll Find That All the source code is include in vb and c . We're not going to worry about here, but the code is there. You need it.

Step 2. Register your dlls.Two dlls need to be copied to your server. The first is in the 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 will take care of registering the other itself I put both in c:... / winnt / system32 / and from that directory typed regsvr32 fdftk.dll If you get an 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 eveningone is to familiar with for this demonstration - The W-4. This One is ready, on http://www.irs.gov and gives us enough Fields to show what we can do.

<% @Language = VBScript%>

Adobe FDF EXAMPLE
first name
Middle Initial
Lastname
Social - -
Street Address
city
State
Zip

Right Valign = TOP> Filing Status

Single
married
Married But Useholding at The Higher Single Rate.
ALLOWANCES CLAIMED
Additional Amount To withhold (if any)
I want to file exempt from withholding Step 4. Define The Adobe Form Fields.

Open the document in Adobe Acrobat. Click the form tool. Paint your first form field (First Name). As soon as you've defined it you are asked to name it. I named mine FirstName. Note that there are several additional formatting options . Other than font size, I choose to do my validation and formatting in my ASP document. As this is just a quick demo, I have opted to skip any validation. However, I would handle it on the client side in my form and any formatting server side in my ASP page before I pass the variables. Continue with the remaining fields, naming each and possibly formatting the font size or attributes. Save your work to wherever you want on your Web server. Step 5. Write the ASP page. Before you start, realize that there is one main object exposed by the FDF toolkit - ". FDFApp.FDFApp" there are many methods exposed, and the manual outlines some other possibilities We're mainly concerned with two methods, fdfSetValue and fdfSetFile.. Here We Go,

<% @Language = VBScript%> <% response.buffer = true%>

转载请注明原文地址:https://www.9cbs.com/read-21426.html

New Post(0)
CopyRight © 2020 All Rights Reserved
Processed: 0.048, SQL: 9