Use ASP to generate a PDF file

zhaozj2021-02-16  56

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 called 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 at the "http://www.irs.gov" free and provides 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.

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

New Post(0)