Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

opening pdf inline in a new pop up

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I am currently trying to display a pdf file inline in a new pop up window and not as an attachment.Following is the serverside code in an Action class in struts.

byte[] content = getByteArray();

try {
ServletOutputStream outputStream = response.getOutputStream();
response.setContentType("application/pdf");
response.setHeader("Content-disposition","inline; filename=Example.pdf" );
response.setHeader("Cache-Control","no-cache");
response.setHeader("Pragma","no-cache");
BufferedOutputStream bos = new BufferedOutputStream(outputStream);
bos.write(content);
bos.close();
} catch (Exception e) {
e.printStackTrace();
}


The pdf opens fine (inline) in the main browser for both mozilla and IE.
when I use the same server side code with the same pdf content in a new pop up window using javascript it works fine in Mozilla(inline) but not in IE (save as attachment pops up and not inline).

Following is the javascript snippet that is being used for pop up.

var page = "<html:rewrite page='/ViewDetailAction.do'/>";
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
windowprops = "height="+h+",width="+w+",top="+wint+",left="+winl+",location=yes,"
+ "scrollbars=no,menubar=yes,toolbars=yes,resizable=yes";

window.open(page, "Popup", windowprops);


IE version : 6.0.2900
Mozilla Firefox version : 2.0.0.2
OS : Windows XP Professional

Any pointers would be of great help.

Not sure if this should be posted in servlet forum or javascript forum so have placed it in both.

Thanks in advance.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Please do not cross-post the same question in multiple forums. It wastes people's time when multiple redundant conversations take place.

When unsure, choose one and if it turns out to be incorrect, have a moderator move it for you.
 
    Bookmark Topic Watch Topic
  • New Topic