open fdf/pdf from servlet
I am having a creepy problem opening a fdf file from struts action.
I am creating a new fdf file using the data from the database, and want to display everything in fdf file to the user with a "SUBMIT" button. when user press the button it should store the file as a pdf in the database. here is a sample of my code
//I have already inserted the data in the fdf file.
String templateURL = localhost:8080/project/someaction.do;
fdf.SetFile(templateURL);
//Before this I am doing the code for the submit button
//Prepare to send the FDF stream
// First set the response content type
response.setContentType("application/vnd.fdf");
response.setHeader("Content-Disposition","inline; filename=\"" + fdf +"\"");
OutputStream os = response.getOutputStream();
fdf.Save(os);
response.flushBuffer();
Everything looks good and the system was working until last week thats when I installed the update of Acrobat Professional (From 7.0 to 7.0.7) since then I am getting a pop up box asking me to SAVE the document in a pdf format, notice there is no option to open it, when I save it it just saves the pdf with put any data. I unstalled and reinstalled both acrobat professional and acrobat reader, still getting this mesasage. When I uninstall reader I get message box with both save or open option when I open the file I see the data in it with bunch of garbage.
anyone know about this problem? I am using IE 6.0
[1719 byte] By [
alifa] at [2007-10-2 20:28:42]

I am very surprised that your code could *ever* work. HTTP doesn't downloading multiple data formats as far as I know. Only uploading them. When a page is downloaded (sent to the browser) it has to be either a PDF, an HTML page, a text page etc. Not both. That means that in the same page you cannot both send HTML buttons, and a PDF. Those are two different data formats, and the browser will not know what to do with them.
But, perhaps, I just misunderstood something, but I just don't think what you want to do could work.
I colleague of mine is working on something very similar these days. A file (word file, PDF etc. ) is downloaded from the server. The file is to be opened in word, Acrobat, Excell etc. for editing. Once edited, the user closes the program and then the file is to be uploaded to the server again, and stored either in a file system or database. Here is how he has done:
1) The link to the file in the browser opens a new browser window. The page displayed in that window contains an applet. The applet knows what file to download from the server. The applet stores the downloaded file on the client machine. Then the applet opens the matching program (on windows just attempt to execute the file. If you try to execute a Word file, word opens with the file open). The applet waits for the program to exit. This can be done with the Runtime class in Java. When the program exits, control is returned to the applet which reads the file and uploads it to the server again.
For this little trick to work the applet must be signed. There are plenty of guides for that online.
I am sorry I should have explained in details. Button is not a HTML button its a pdf submit button. I have a signature field in my fdf, all other fields are coming from the database. I should display everything in the fdf page and get the user signature through a digital pad (just like you sign your credit card receipt at wall mart through digital pad) paste the signature on the fdf's signature field and when I press the buitton on fdf its suppose to be converted into pdf and stored in the database.
I added few more libraries and I think its of libraries creating this problem. anyway I am going to backtrrack and pick up the application from where I left it functional.
Thanks for your response.
alifa at 2007-7-13 23:11:38 >
