Solved

Creating Dynamic pdf files with ASP

Posted on 2002-04-24
17
757 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
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!

 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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 would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

624 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