dcsimg
.pdf files created by a servlet on linux, Tomcat don't open in the browser, but with a linux pdf viewer
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   liliyaw_woland
Posted On:   Thursday, March 30, 2006 11:28 AM

Please help, The code I'm testing - a servlet - works fine in Windows OS. A servlet creates a pdf file in a .jsp page. But the same code on linux opens up a pdf viewer for the created .pdf file. As a result, you cant see the page from a different computer. I'd appreciate any input, thanks in advance. THis is the code I'm using: Pdf p = new Pdf(req.getParameter("pdfFile")); ServletOutputStream out = resp.getOutputStream(); resp.setHeader("Content-Type", "application/pdf"); resp.setHeader("Content-Disposition", "inline; filename="" + pdfOut + """); ByteArrayOutputStream ba = new ByteArrayOutputStream(); p.writeToStream(ba); resp.setContentLength(ba.size()); ba.writeT   More>>

Please help,
The code I'm testing - a servlet - works fine in Windows OS.
A servlet creates a pdf file in a .jsp page. But the same code on linux opens up a pdf viewer for the created .pdf file. As a result, you cant see the page from a different computer. I'd appreciate any input, thanks in advance.
THis is the code I'm using:
Pdf p = new Pdf(req.getParameter("pdfFile")); ServletOutputStream out = resp.getOutputStream(); resp.setHeader("Content-Type", "application/pdf"); resp.setHeader("Content-Disposition", "inline; filename="" + pdfOut + """); ByteArrayOutputStream ba = new ByteArrayOutputStream(); p.writeToStream(ba); resp.setContentLength(ba.size()); ba.writeTo(out); out.flush();

   <<Less

Re: .pdf files created by a servlet on linux, Tomcat don't open in the browser, but with a linux pdf viewer

Posted By:   Almagest_FUTT  
Posted On:   Thursday, March 30, 2006 05:30 PM

Re: .pdf files created by a servlet on linux, Tomcat don't open in the browser, but with a linux pdf viewer

Posted By:   Almagest_FUTT  
Posted On:   Thursday, March 30, 2006 05:27 PM

I don't understand what your problem is, for I don't get what you mean by:

  "But the same code on linux opens up a pdf viewer for the created .pdf file. As a result, you cant see the page from a different computer."


Anyway, how a browser handles specific content types are matters of the browser alone -- you can't influence that.

About | Sitemap | Contact