Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

modified PDF/image to be sent to servlet

 
Prem Shankar
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am able to retrieve a document from a fileserver and show it in a browser by setting :
response.setContentType("application/pdf");
ServletOutputStream outStream = response.getOutputStream();
outStream.write(content);

I am planning to have two frames one for the PDF and other frame will have the "SUBMIT" with other input form fields.Now if im adding some comment/annotations to the PDF( using PDF writer) and submitting the page, i need to save the modifed PDF to the file server back again along with the form fields to some DB.

Could somebody reply how it can be achieved?

Rgds,
prem.
 
Senthil B Kumar
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are setting the content type of a request to pdf, then you cannot have a normal html/jsp page in the lower frame of your page.
 
Prem Shankar
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well im able to view both the frames(one with pdf and other with Html). wht u mean by normal html/jsp??
Still my query is how can i submit the changed PDF along with the Html form.
 
Ajith Anand
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Prem,

you will have to use multipart/form-data to submit such type of content types like images, pdfs, docs...etc

The submission would be a two step process.

1. you will need to save the pdf after entering the annotations on your local machine.

2. use <input type="file" >
to submit this pdf along with the other fields in your form.
 
Prem Shankar
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thnks ajith, but whtever u say is jus file upload rite; U have to save it then give the path where the file is stored.. well that should be my last option.
 
Ajith Anand
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Prem Shankar:
Still my query is how can i submit the changed PDF along with the Html form.


Are there any other options left ?? I think that is the only option...ofcourse other than using javascript to simulate the same....Let me know if you have something else in mind ...
 
Prem Shankar
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ajith:
yeah i agree i dont have any options either...but how can u simulate the same using javascript ...(getting the modified PDF and sending it to controller from other frame)..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic