Hi Rajeev

you should set the mime type to application/vnd.fdf.

If you set the the NeedAppearances flag in AcroForm using PDFBox then Reader 
will generate the appearances for you when the document is opened. Might be an 
alternative to using FDF.

BR

Maruan

Am 28.10.2014 um 15:33 schrieb Rajeev Menon <[email protected]>:

> Hi,
> 
> I am populating a PDF file by creating a FDF file and sending it to the
> browser. The FDF file has the url of the PDF that it should open to fill
> the data. The file opens fine inside the browser (inline), but when I want
> to force it to open with acrobat reader, it just shows a white page in the
> reader. Here is the relevant code.
> 
> response.setContentType("application/pdf");
> response.setHeader("Content-disposition","attachment;
> filename=\"somefile.fdf\"");
> 
>            output.println("%FDF-1.2");
>            output.println("1 0 obj <<");
>            output.println("/FDF <<");
>            output.println("/F(https://servername/sample.pdf)");
> 
>            output.println("/Fields[");
>            output.println("<</T(FieldName1)/V (Hello World)>>");
>            output.println("]");
>            output.println(">>/Type/Catalog");
>            output.println(">>");
>            output.println("endobj");
>            output.println("trailer");
>            output.println("<</Root 1 0 R>>");
>            output.println("%%EOF");
> 
>            output.flush();
>            output.close();
> 
> Please let me know if I am missing something here. I implemented the PDF
> form filling using both the PDFBox and the FDF approaches, but I am
> experiencing some issues with the PDFBox.
> 
> Thanks,
> Rajeev.

Reply via email to