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

PDF Streaming on iOS devices

 
Dan Lauerman
Greenhorn
Posts: 1
IBM DB2 Eclipse IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JSF page that uses a backing bean to stream a PDF document to the browser. This functionality works great and I haven't had any problems with it until now when testing this functionality on iOS devices.

On Safari on both an iPad and iPod Touch, the PDF stream ends up just being pasted as a non-scrollable layer on the webpage when it gets the response. In the browsers on a desktop, the file prompts to save or open and opens correctly with Adobe Reader. This is an issue because only part of the first page of the PDF shows on the iOS devices and there is no way to view other parts.

I've tested other PDF's on these devices from web and they do not behave the same. Either a PDF application is launched or Safari loads a scrollable preview which are the desired outcomes. Has anyone else had this?

My backing bean writing a buffered input stream of the PDF to an output stream. I have set the following response headers:
response.setContentType ("application/pdf");
response.setContentLength(inputLength);
response.setHeader ("Content-Disposition", "inline;filename=\"" + saveFilename + ".pdf\"");
response.setHeader ("Cache-Control", "must-revalidate, post-check=0, pre-check=0, public");

Please Help! I have attempted to switch content-disposition from inline to attachment, but that did not help.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic