Solved

Creating Dynamic pdf files with ASP

Posted on 2002-04-24
17
746 Views
Last Modified: 2012-06-21
When I recently did my taxes with Turbotax Web, I noticed at the end of filling in a bunch of forms...up popped the acrobat reader and voila!  All my data was magically printed on the form.  I am embarking on project that will need similar forms generation. - Enter data into an HTML form and then with a click of the finished button show the data in a nicely formatted pdf file.  Can someone tell me what I would need to do this with ASP or ASP.net?  Include useful links for extra credit...Thanks
0
Comment
Question by:kenadelglass
  • 5
  • 3
  • 3
  • +5
17 Comments
 
LVL 11

Expert Comment

by:thunderchicken
ID: 6966146
activepdf.com

It's the ONLY way to do this successfully.
0
 
LVL 6

Expert Comment

by:snoegler
ID: 6966675
... or switch to PHP :)
0
 
LVL 6

Expert Comment

by:snoegler
ID: 6966687
If the data you want to put into the PDF is already in a database, you could use an external report generator which generates PDF. In my company, we used a crystal reports backend for that purpose.
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 6

Expert Comment

by:snoegler
ID: 6966690
Should read: "in the company i am working in" :)
0
 
LVL 18

Expert Comment

by:mgfranz
ID: 6967486
Acrobat 5 does dynamic PDF files...
0
 
LVL 9

Expert Comment

by:AlfaNoMore
ID: 6968019
This one's free:
http://www.websupergoo.com/abcpdf-1.htm

And this one's not, but looks better supported:
http://www.dreamscape.it/eng/index.htm

They're both usable from within ASP.
0
 

Expert Comment

by:davebeer
ID: 6968592
I've found the best bit of code to do this with, is SEDTechs' iSEDQuickPDF.

http://pdf.sedtech.co.za/index.html

It is very quick, perfect for on-the-fly creation of PDFs. And quite reasonably priced. I found it very easy to program with.

At only $50US, it's a LOT cheaper than activePDF.

As an example, this is how you'd create a simple PDF document.

--begin code--

' Create the object
Dim PDF As iSED.iSEDQuickPDF
Set PDF = CreateObject("iSED.iSEDQuickPDF")

' Set the RegistrationKey and the Destination
PDF.RegistrationKey = "3E20-2579-DACA-39F1"
PDF.Destination = "c:\helloworld.pdf"

' Put some text onto the page
PDF.DrawText(72, 576, "Hello World!")

' Generate the file
Call PDF.WriteFile

' Free the object
Set PDF = Nothing

--end code--


Not a lot to it really. :-)

Cheers,
Dave.
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 6970019
Unfortunately, http://www.websupergoo.com/abcpdf-1.htm is no longer free...

Fritz the Blank
0
 
LVL 1

Accepted Solution

by:
Internetbias earned 150 total points
ID: 6972822
Actually you can do it yourself for free, in a sense - If you already have the PDF form created.

Since the PDF form already has the form fields created and labeled, all you really need to do is create an FDF file.  The FDF file contains several important pieces of information:  The PDF file location you want to populate with data, and the data for the form fields.

All you need to do essentially is have your ASP script write a text file, named whatever.fdf.

The guts of teh file look like this:

___________________________________

%FDF-1.2%âãÏÓ
1 0 obj
<< 
/FDF << /Fields [
___________________________________
This is the HEADER




___________________________________

<< /V (VALUE_DATA)/T (NAME_OF_FORM_FIELD_IN_PDF)>>
<< /V (VALUE_DATA)/T (NAME_OF_FORM_FIELD_IN_PDF)>>
<< /V (VALUE_DATA)/T (NAME_OF_FORM_FIELD_IN_PDF)>>

___________________________________
This is the IMPORTANT PART.  Loop through all your fields to make this fit your needs or data.




___________________________________
]
/F (http://www.nhdinc.com/forms/designcriteria.pdf)>>
>> 
endobj
trailer
<<
/Root 1 0 R

>>
%%EOF
___________________________________
This is the FOOTER


Here's the important and cool thing about using the FDF method I am talking about here.  You can record all this data, even if you don't require it all, and use the FDF file for MULTIPLE PDFs!

It may not be as nifty as purchasing someone else's code, but you can do it yourself for free.

Douglas@internetbias.com
http://www.internetbias.com/
0
 
LVL 18

Expert Comment

by:mgfranz
ID: 6972825
Hmm... interesting.  But then what, rename the .fdf to .pdf?
0
 

Expert Comment

by:davebeer
ID: 6973104
No. The PDF loads the fields with the data from the FDF. You need to create a PDF with the form fields for it to work. But it does work well.
0
 
LVL 1

Expert Comment

by:Internetbias
ID: 6981907
Correct, the FDF file calls to the PDF file.  The PDF pulls the data you stored in the FDF and populates itself.

davebeer is correct, you need to have a PDF with formfields already created for this to work.  After doing it once successfully, you'll never forget.
0
 
LVL 18

Expert Comment

by:mgfranz
ID: 6982056
So if I create a .fdf file with the data field called "temp", and a .pdf with a form field "temp", what do I call?  The .fdf or the .pdf?  

I assume I can call the .fdf in this manner;

strFilePath = Server.MapPath("data\test.fdf")
ContentType = "application/pdf"
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = 1
objStream.LoadFromFile strFilePath
Response.AddHeader "Content-Disposition", "attachment; filename="&strFilePath
     Response.ContentType = ContentType
     Response.BinaryWrite objStream.Read
     Response.Flush
...
0
 
LVL 18

Expert Comment

by:mgfranz
ID: 6982059
Or;

ContentType = "application/vnd.fdf"
0
 
LVL 18

Expert Comment

by:mgfranz
ID: 6982060
Or;

ContentType = "application/vnd.adobe.xfdf"
0
 
LVL 1

Expert Comment

by:Internetbias
ID: 6982157
You can name the fdf anything you want.  Same with the PDF.  Just make sure that the footer...
_________________________________

]
/F (local or remote location of PDF)>>
>> 
endobj
trailer
<<
/Root 1 0 R

>>
%%EOF
_________________________________

...calls to the same name.  Otherwise you are correct abou tthe field names and storing them in the FDF.

I've even done a response.redirect to the FDF file and had it run correctly.  The only limitation is that the person accessing the file MUST have Acrobat Reader installed.  Otherwise it will load the FDF text information into the browser window.  Not pretty.

Internetbias
http://www.internetbias.com/
0
 
LVL 1

Author Comment

by:kenadelglass
ID: 6982466
I think the answer to this question has been exhausted.  Thanks to all but Internetbias had most unique solution and it is free...
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how to hide hide popup page refresh second time? 10 141
format nvarchar field as mm/dd/yyyy 4 78
Recordset containing single quotes 8 43
Time comparison asp 1 9
I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question