Solved

Creating Dynamic pdf files with ASP

Posted on 2002-04-24
17
743 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
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

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Autosum input type=text when checkbox is true 28 95
Select distinct 25 100
asp syntax 3 50
Issues with Insert statement 12 26
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
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/…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

773 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