These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Need Help: Issue in opening PDF (application/vnd.fdf) in Safari

harpreetsingh82
Registered: Aug 30 2010
Posts: 1

Hi Everyone..

I need a little help on an issue. Im getting error while opening a pdf file in safari browser using c# code which uses iTextSharp library.

I coded for pre-populating a pdf form which is of MIME-type: "application/vnd.fdf" and opening it in safari browser.

It gives me the error that: "There was an error opening this document. The file cannot be found"

Some how this code works fine for IE, Chrome and Mozilla Firefox browsers.

The following are the lines i coded:

protected void Page_Load(object sender, EventArgs e)
{

Response.Clear();
Response.ContentType = "application/vnd.fdf";
FdfWriter fdfWriter = new FdfWriter();
fdfWriter.File = targetURL;// target url is the location like: http://testsite/pdf/TestForm.pdf
fdfWriter.SetFieldAsName("txtName", userName);
Response.AddHeader("Content-disposition", "inline; filename=TestForm.fdf");
fdfWriter.WriteTo(Response.OutputStream);
Response.End();

}

Need an urgent help over this issue...

Thanx in advance

Perfect Pitcher
Registered: Dec 9 2010
Posts: 1
The '.fdf' file extension or MIME Application vnd.fdf is fully supported by Acrobat Reader. From what I know, Safari and Firefox browsers are automatically configured to associate FDF files with the Adobe Acrobat program. If you experience trouble opening a FDF file, it is likely that your internet browser isn't configured properly to open files with the .fdf extension.

If that's the case, try to uninstall then reinstall your adobe reader. You should then be able to view the files.
NK-INC.COM
Registered: Apr 17 2010
Posts: 93
In Visual Studio, make sure the file is "Included in the Project". Right-Click on the PDF in the Project/Solution explorer window, and select, "Include in Project". Also, you may have to set one of the properties to "Content".

Then rerun you app in debug mode.

Another solution is to, specifically not use debug mode for this test. Try running the file without debug mode.

Let me know if this works.

NK-INC.COM
Registered: Apr 17 2010
Posts: 93
You can also merge the FDF with the PDF, and serve the merged PDF with the data back to the browser.

So, instead of serving FDF/XDP, you merge the data with a blank PDF, and send that to the Response.OutputStream.

For more information on how to merge FDF data with PDF Acrobat and LiveCycle PDF forms, please visit:

FDFToolkit.net:
http://www.fdftoolkit.net/

For ASP.net PDF programming examples:
http://www.nk-inc.com/blog/