Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Open file from JSP or Servlet in Acrobat reader  RSS feed

 
Julia Smith
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have several files, which I need to open from servlet or JSP page in acrobat reader.
These files are partially protected, so if user opens them in Acrobat, print and save options are disable.

I have following code in my servlet:

url = "/RESULT2.pdf";
RequestDispatcher requestDispatcher = getServletContext().getRequestDispatcher(url);
requestDispatcher.forward(request, response);

In this case, file is open in IE and user could print it.

Thanks in advance,
Julia
[ July 31, 2005: Message edited by: Julia Smith ]
 
D Rog
Ranch Hand
Posts: 472
Linux Objective C Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you provide a bit more information, like version of Acrobat, version of pdf, how you did protection? You can try to copy your pdf under static web server content and open it without involving a servlet in IE to compare results.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you set the content-disposition header to 'attachment' (as opposed to 'inline') and then stream the PDF to the browser, the user will be shown a save/open dialog. If they choose to open, it will open a seperate instance of acrobat.
 
Julia Smith
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ben,
Thank you for your help, this is working.
But if I am trying to open the same file second time,
it opens in IE instead of Acrobat.
How could I prevent it?
Thanks in advance
Julia

[ July 31, 2005: Message edited by: Julia Smith ]
[ July 31, 2005: Message edited by: Julia Smith ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!