Hello Leonard & Mark, Thanks for the Reply. Explanation for the Loenard question, why not just process all of your PDFs through Multivalent before sending them along... We do not want to use multivalent tool as this project is not active on sourceforge, the licensing also little convoluted and the source code is not available for this project. As we all know all kinds of critical problems will come in production most of the times :) we do not want to take the chance.
The explanation is given below as part of the answer for Mark's question, how are you adding the images? We are doing some thing called image translation to rectify some problem with image (I am adding that image for your reference) and passing the java.awt.Image which comes as a result of above translation to IText. The sample code for translation is given below, > public java.awt.Image translate( InputStream inFile , boolean > isMonochrome ) throws Exception { > BufferedImage im = ImageIO.read(imageStream); > waitForImage(img); > BufferedImage outImage = null; > if( isMonochrome ) > outImage = new BufferedImage(im.getWidth(), im.getHeight(), > BufferedImage.TYPE_BYTE_GRAY); > else > outImage = new BufferedImage(im.getWidth(), im.getHeight(), > BufferedImage.TYPE_INT_RGB); > Graphics imageGfx = outImage.getGraphics(); > imageGfx.drawImage(im, 0, 0, new Color(255, 255, 255), null); > imageGfx.dispose(); > return outImage; > } > And feeding it to IText using Image image = Image.getInstance(awtImage, null); We couldn’t found exact reason but observed that passing awtImage to Image.getInstace causing the image size to get huge. So, As a solution what we did yesterday was writing the awtImage to a temp file and feeding this temp file to IText using > Image image = Image.getInstance(tempFilePath) > Solved the problem. The temp file writing code is given below. > File file = File.createTempFile("translate", ".jpg"); > ImageIO.write((RenderedImage)im, "jpeg", file); > Now the generated PDF is with less size and if we pass this PDF to multivalent there is not compression and it shows compression ratio 0%. Some how we managed to solve. Thanks to one and all for your valuable support. :) From the above fix I am still now sure where the problem lies (In the bufferedImage or Image.getInstance(awtImage, null); Any views on this? http://www.nabble.com/file/p24732832/4.jpg 4.jpg Thanks, Srinivas Mark Storer-2 wrote: > > The reason you're files are shrinking so much has to do with the type of > compression applied to the images. > > In your original file, everything (images, content, etc) are compressed > with > FlateDecode (zip). In the modified files, they use DCTDecode (jpeg). > > iText supports writing out JPEG images **that were read in as a JPEG** > (image.type() == Image.JPEG). It supports CCITTFaxDecode for images that > were > built with raw image data (image.isImgRaw() == true && image.getBpc() > > 0xFF). > > It looks like everything else is written out as FlateDecode... which, as > you may > have noticed, is sub-optimal. :/ > > So how are you adding the images? > > --Mark Storer > > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 > 30-Day > trial. Simplify your report design, integration and deployment - and focus > on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > 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/ > > :-):-):-) -- View this message in context: http://www.nabble.com/Problem-with-Pdf-Size%3APdf-Size-is-reduced-by-87--When-i-ran-IText-Generated-Pdf-using-Multivalent20060102.jar-tool.-tp24699273p24732832.html Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ 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/