Ok, I'll get a look out there ... assuming that I don't want it to be downloaded but displayed within the browser window. Thx
Cheers Stéphane Gauthier -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] Sent: Thursday, May 24, 2007 5:18 PM To: [email protected] Subject: Re: [magnolia-user] Problem with pdf You need to set specific headers if you want to open a pdf inline with IE. Has not much to do with magnolia. I remember seeing a sample in iText's FAQ for instance. Cheers g On May 24, 2007, at 17:13 , Gauthier, Stephane (CH) wrote: > Cache is off. > > Here is my code: > > final public void service(HttpServletRequest request, > HttpServletResponse response) > throws ServletException, IOException { > > String uuid = request.getParameter("id"); > String versionName = request.getParameter("mgnlVersion"); > > HierarchyManager hm = MgnlContext.getHierarchyManager > (DMSModule.getInstance().getRepository()); > Content node; > try { > node = hm.getContentByUUID(uuid); > Document doc = new Document(node, versionName); > InputStream is = doc.getFileStream(); > > response.setContentLength((int) doc.getFileSize()); > ServletOutputStream os = response.getOutputStream(); > response.setContentLength(new BigDecimal(doc.getFileSize > ()).intValue()); > response.setContentType(doc.getMimeType()); > > byte[] buffer = new byte[8192]; > int read = 0; > while ((read = is.read(buffer)) > 0) { > os.write(buffer, 0, read); > } > os.flush(); > os.close(); > } > catch (Exception e) { > response.sendError(HttpServletResponse.SC_NOT_FOUND); > return; > } > > } > > > Perhaps Magnolia already write something in the outputstream? > > Stéphane Gauthier > > > > -----Original Message----- > From: [email protected] [mailto:[EMAIL PROTECTED] > Sent: Thursday, May 24, 2007 5:06 PM > To: [email protected] > Subject: Re: [magnolia-user] Problem with pdf > >> In order to not expose dms url to Internet, I use a Servlet to >> display pdf content. (Acrobat is set to display pdf in browser) >> With Internet Explorer the opened window refuse to display pdf >> content and pops up a new Acrobat instance. >> I'm doing the same on another website that is not under magnolia >> and with Internet Explorer the pdf is displayed within the opened >> window. >> I have tried a lot of things regarding Headers, Content-type, etc ... >> >> I'd like to know if there is any filter that could modify pdf >> opening behaviour. > > Cache? Try to switch it off? > > Philipp Bracher > > > > > ---------------------------------------------------------------- > for list details see > http://documentation.magnolia.info/docs/en/editor/stayupdated.html > ---------------------------------------------------------------- > > ********************************************************************** > ************** > This email and any files transmitted with it are confidential and > intended solely for the use of the individual or entity to whom > they are addressed. > If you have received this email in error, please notify the system > manager ([EMAIL PROTECTED]) and delete the message with any > attached files from your system. > The confidentiality and integrity of this message cannot be > guaranteed on the Internet and the sender does not accept liability > for its content. > > ********************************************************************** > ************* > > > ---------------------------------------------------------------- > for list details see > http://documentation.magnolia.info/docs/en/editor/stayupdated.html > ---------------------------------------------------------------- ---------------------------------------------------------------- for list details see http://documentation.magnolia.info/docs/en/editor/stayupdated.html ---------------------------------------------------------------- ************************************************************************************ This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error, please notify the system manager ([EMAIL PROTECTED]) and delete the message with any attached files from your system. The confidentiality and integrity of this message cannot be guaranteed on the Internet and the sender does not accept liability for its content. *********************************************************************************** ---------------------------------------------------------------- for list details see http://documentation.magnolia.info/docs/en/editor/stayupdated.html ----------------------------------------------------------------
