Solved

Creating Dynamic pdf files with ASP

Posted on 2002-04-24
17
750 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

751 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