LOL, I don't imagine this will help, but the high bit is probably being set to zero. Whoever is creating all those content attach/disposition things probably doesn't know it is not text.
marchywka:/home/marchywka# od -ax Desktop/Car-Diagnosis_Visualization.pdf | sed -e 's/ /\n/g' | grep "^....$" | cut -c 1 | sort | uniq -c 152 0 146 1 273 2 1537 3 202 4 194 5 327 6 215 7 marchywka:/home/marchywka# ________________________________ > Date: Mon, 22 Feb 2010 15:30:21 +0100 > From: sebastian.fu...@googlemail.com > To: itext-questions@lists.sourceforge.net > Subject: Re: [iText-questions] Writing to ServletOutputStream > > Of course it were good hints - the problem is me :) > > OK I try to explain my problem: > > I have created a JSP-Servlet which shall return a PDF Document on request. > > //Get the file content > ByteArrayOutputStream bstream = > de.d3web.empiricalTesting.caseVisualization.jung.JUNGCaseVisualizer.getInstance().getByteArrayOutputStream(t.getRepository()); > > > //Response > response.setContentType("application/pdf"); > response.setHeader("Content-Disposition", > "attachment;filename=\""+filename+"\""); > > response.setContentLength(bstream.size()); > > //Write the data from the ByteArray to the ServletOutputStream of the response > bstream.writeTo(response.getOutputStream()); > response.flushBuffer(); > > > The pdf document is created by iText and should contain a graph (Graphics2D > Object). > > init(cases); > > int w = vv.getGraphLayout().getSize().width; > int h = vv.getGraphLayout().getSize().height; > > > ByteArrayOutputStream bstream = new ByteArrayOutputStream(); > Document document = new Document(); > > try { > > PdfWriter writer = > PdfWriter.getInstance(document, bstream); > > document.setPageSize(new Rectangle(w, h)); > document.open(); > > PdfContentByte cb = writer.getDirectContent(); > PdfTemplate tp = cb.createTemplate(w, h); > Graphics2D g2 = tp.createGraphics(w, h); > > paintGraph(g2); > > g2.dispose(); > tp.sanityCheck(); > cb.addTemplate(tp, 0, 0); > cb.sanityCheck(); > > document.close(); > > > } catch (DocumentException e) { > Logger.getLogger(this.getClass().getName()) > .warning("Error while writing to file. The file was not created. " + > e.getMessage()); > > } > > return bstream; > > If I delegate the ByteArrayOutputStream created in the method posted above to > a FileOutputStream the pdf has the desired content - but If I delegate it to > a ServletOutputStream the content (the Graphics2D Object) is missing. > > > I attached the pdf where the Graphics is missing. Maybe you can get some > information out of it. > > Thank you in advance! > > Best regards > > Sebastian Furth > > > 2010/2/22 1T3XT info> > > Sebastian Furth wrote: > >> Once again, thanks for your reply. Unfortunately I think I don't have > >> enough experience to understand your hints :) > > > > It were good hints though; I thought everybody knew wget. > > > > If possible, can you explain your problem as good as Mike explained how > > to use wget? For instance: save the PDF on your local system and open it > > using a text editor such as Notepad++, Wordpad,... What do you see? > > > > ------------------------------------------------------------------------------ > > Download Intel® Parallel Studio Eval > > Try the new software tools for yourself. Speed compiling, find bugs > > proactively, and fine-tune applications for parallel performance. > > See why Intel Parallel Studio got high marks during beta. > > http://p.sf.net/sfu/intel-sw-dev > > _______________________________________________ > > iText-questions mailing list > > iText-questions@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/itext-questions > > > > Buy the iText book: http://www.1t3xt.com/docs/book.php > > Check the site with examples before you ask questions: > http://www.1t3xt.info/examples/ > > You can also search the keywords list: http://1t3xt.info/tutorials/keywords/ > > _________________________________________________________________ Your E-mail and More On-the-Go. Get Windows Live Hotmail Free. http://clk.atdmt.com/GBL/go/201469229/direct/01/ ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/