Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adobe and ASP.Net
Message
 
To
13/05/2003 10:45:20
Jacci Adams
Lindsay-Adams Consulting
Louisville, Ohio, United States
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00787725
Message ID:
00787898
Views:
11
Hi Jacci,

I have a client that I created a ASP.NET site where we use Acrobat Reader to perform form fill-in. It is working great but it took me forever to figure out how to integrate the FDF object. As you found out, there is very little support out there for how to integrate with ASP.NET. One issue I found out is that you need to write to a file instead of the buffer. It doesn't work in ASP.NET. Then you stream the file and send it to the client. I think you are using VB.NET so here is some sample code:
Dim FdfAcX As FDFACXLib.FdfApp
Dim objFdf As FDFACXLib.FdfDoc
FdfAcX = New FDFACXLib.FdfApp()
objFdf = FdfAcX.FDFCreate()

objFdf.FDFSetFile("MyFile.pdf")

' Prepopulate any fields in the form as necessary

Dim MyFileStream As FileStream
Dim FileSize As Long
Dim strFileName As String
strFileName = Request.PhysicalApplicationPath & "FDFFiles\" & "MyFile" & MyUniqueID & ".fdf"
objFdf.FDFSaveToFile(strFileName)
MyFileStream = New FileStream(strFileName, FileMode.Open)
FileSize = MyFileStream.Length

Dim Buffer(CInt(FileSize)) As Byte
MyFileStream.Read(Buffer, 0, CInt(FileSize))
MyFileStream.Close()

objFdf.FDFClose()
File.Delete(strFileName)
Response.ContentType = "Application/vnd.fdf"
Response.BinaryWrite(Buffer)
Response.End()
>Hi,
>
>One of the members of my team is working on creating Adobe forms to submit data and retrieve data. The submitting works great. We can't get the retrieving to work in ASP.Net. They've been able to get it to work in ASP.
>
>Here's what's happening:
>
>After working with the Adobe product testing things to get it to work in .Net, I have determined that a problem may lie in the response object. I'm unclear how this works in ASP and not ASP.Net. A .PDF file has an associated .FDF with it that contains the tags that map to fields in my database. So to display a "filled in" pdf file, you load the FDF file and open it in the browser. Since this FDF file is tied directly to a PDF, it opens the proper pdf file in adobe on the client. This is performed in ASP by the following:
>'Load FDF File
>...
>'Set the FDF to the appropriate pdf file.
>outputFDF.FDFSetFile(http://localhost/.../Procedures_Forms.pdf)
>
>Response.ContentType = "application/vnd.fdf"
>
>'Write the FDF file to the browser for display.
>Response.BinaryWrite (outputFDF.FDFSaveToBuf) 'SaveToBuf converts the output to a byte() array
>
>In ASP, the binary write line will cause Adobe Reader to open on the client and displays the proper pdf file.
>in ASP.Net, the binary write line causes the browser to download the aspx page. After searching google, and some trial and error, Bob and I found that if we set the Response.Charset="" on the aspx page, the PDF would open with a warning that the file was corrupt. Not knowing enough about the Response object myself, does anyone have any ideas as to a possible solution? I've found one article on Adobe's website in reference to setting the MIME type to Application/vnd.fdf on the server which I've tried, but I'm not sure if I set it properly.
>
>Any insight into this?
>
>Thanks,
>
>Jacci
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform