?
Solved

FDF -> PDF via web

Posted on 2009-02-23
13
Medium Priority
?
1,106 Views
Last Modified: 2013-12-08
I am trying to create a web page that opens an adobe pdf with the pages fields populated from a database.

The concept seems simple.  I can create the fdf file and MANUALLY select that FDF file and it opens the desired PDF with everything populated as it should be.

The problem I am having is getting the same thing to occur via the web.  The fdf tool kit is installed on the server, the FDF file is created, the pdf file that the FDF points to is in place.  My attempt is to simply call the fdf file to open expecting it to call its associated pdf file and display that pdf, populated to the user.

Where am I going wrong here??  

I am using classic asp NOT asp.net

The result I get is a blank web page.

My code to call fdf file looks like this:

<A HREF="../../mydirectory/testingsrver.fdf" TARGET="_blank">Test it!</A>

 
0
Comment
Question by:RdougK
  • 7
  • 5
13 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 23719521
your browser needs to know how to handle .fdf
what Content-Type header does your server send for that file?
0
 

Author Comment

by:RdougK
ID: 23721116
I have:
ContentType = "application/vnd.fdf"

I have since modified my code from browsing around this site.  I have changed my approach to:

strFilePath = Server.MapPath("/directory/next/myfdffile.fdf")

ContentType = "application/vnd.fdf"
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

I am able to create the FDF.s with no problem.  If I manually browse to them and double click them they redirect to the PDF specified and open with the fields populated per the fdf.  What I am trying to do is cause the exact thing to happen, in a web browser (ie)

Hope that clarifies, but I fear I am so lost I may not be able to give good directions to help me!  

I am fairly new to web programming!

0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 23722052
> ContentType = "application/vnd.fdf"
does your browser support this type
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:RdougK
ID: 23722171
As far as I know.  I have little access to the server, my admin installed the adobe fdf tool kit.  It had instructions to make sure all the file associations were in check, he said they were but I have no way of checking this personally.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 23722801
I'm talking about the client (browser!) not the server
0
 

Author Comment

by:RdougK
ID: 23722996
Ah, I see.

OK, remember "new to web programming".

I am assuming I am looking under Tools>internet options>programs tab >manage add-ons ??

For Adobe I have
Adobe PDF (AcroIEFavClient.dll)
Adobe PDF Conversion Toolbar Helper (AcroIEFavClient.dll)
Adobe PDF Link Helper (AcroIEHelperShim.dll)
Adobe PDF Reader (AcroPDF.dll)

Am I looking in the right place??
If I am what should I see or more importantly what do I need to do to make this association?

Thanks.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 23726753
silly question: do think it will help you if you pimp just *your* browser, means you don't care about other people?

If not; you need to ltell your application to send a coomon Content-Type header, for example application/pdf
0
 

Author Comment

by:RdougK
ID: 23733441
I understand what you are saying, thats an issue I will be glad to deal with later.  Maybe a dozen users will need this functionality.  if it is simply a matter of installing something on their machine, configuring (pimping) their browser it won't be a problem.  

In an effort to see if it is a matter of my browser I did find an example of something similar to what I want to do on the web at: http://www.planetpdf.com/developer/article.asp?ContentID=6492 

The example works for me on their site and mine.  So the server (and browser) must be OK.

0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 23734130
so the link tells you waht I already did: either server needs to send application/pdf or if it sends application/vnd.fdf the browser nedds to support wthis
0
 

Author Comment

by:RdougK
ID: 23734565
Yeah. What I was looking for was why my approach was not working.  Everything is obviously set up to work properly but my code is not working.  An error of some sort on my end in my code.
0
 

Accepted Solution

by:
RossWinds earned 1000 total points
ID: 23738842
I am doing this as well. here are the basic steps I did:
-Create an FDF file using the ASP page in a specific folder on the web. Make sure a READ ONLY version of your PDF file is in the same folder.
-Created a link on the output page using the following code:

Response.Write("<a href='../relativelocationofPDFbasedonthispageslocationinweb/PDFfilename.pdf#FDF=http://locationofFDFfile/FDFfilename.fdf' target=_blank>Click to display document</a><br>");


The PDF will display with the merged data...

Here's a sample of my FDF file...
*******************
%FDF-1.2
%âãÏÓ
1 0 obj<</FDF<</ID[<0ec32aa9d8f8f8e7c1a7610cdc93e62e><445d77f08948a048bca95f19da4fe966>]
/Fields[
<</T(AuthorityRequested)/V(TYPE OF AUTHORITY)>>
<</T(ProviderID)/V(987654321)>>
<</T(ProviderName)/V(Provider Name)>>
<</T(SocialSecurityNumber)/V(***-**-1234)>>
<</T(StudentName)/V(The student name)>>
<</T(p)/V(X)>>
<</T(pe)/V(X)>>
<</T(sbb)/V(X)>>
]>>>>
endobj
trailer
<</Root 1 0 R>>
%%EOF

0
 

Author Comment

by:RdougK
ID: 23745061
JACKPOT!! We have a winner! This is EXACTLY what I wanted to do.  Although I ended up going another direction doing something more like the link above building the fdf in a buffer but the last reply IS the solution to the original problem I posed! THANKS!
0
 

Author Closing Comment

by:RdougK
ID: 31550222
THANKS!
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

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

Media Temple is proud to announce our partnership with the Society of Digital Agencies (SoDA) as their exclusive hosting partner.
Why WooCommerce is one of the majorly favored choices when it comes to having an eCommerce store. This article will acquaint you with some reasons that I believe make it one of the best eCommerce platforms available.
This Micro Tutorial will demonstrate how nuggets on the Web are formatted by using Chrome Developer Tools. These tools would not only view the site's CSS but it can also modify it and save the CSS to use on your own site.
Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…
Suggested Courses
Course of the Month8 days, 5 hours left to enroll

616 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