There is an option on the PdfGraphics2D object to not convert the images to JPEG.
It would be fairly trivial to modify this class to generate PNG images (using ImageIO), but I am not certain that PDF supports PNG as a native format however. Are you sure that the Distiller is not using JPEG images with an image mask? On Jan 20, 2007, at 1:59 PM, Steven Case wrote: > I have an existing internal application that uses Swing/AWT and > makes fairly > extensive use of AWT's APIs for printing the documents created by the > application. In the past, users have generated PDF versions of > documents by > printing to Acrobat Distiller. I now have a need to support a more > automated generation of PDF versions of the documents and have been > using > iText to provide that support. Everything is working adequately. > However, > there are a couple of side-effects that I would like to try to improve > within this application and the PDFs produced using iText. > > One very appealing benefit of iText is that the PDF version of > documents > produced by this application are now produced significantly more > quickly > than when using Acrobat Distiller. In fact, the documents are > generated in > about 1/5 to 1/10 the time, which is certainly a welcome advantage. > > There is, however, a disadvantage that I have encountered. For > quite a few > users, the iText generated documents are also significantly > larger. Most of > the documents contain a large number of images. At the moment, I > have used > the Graphics2D interfaces to iText in order to avoid rewriting a large > amount of code since users still need the ability to print to a > regular > printer. I can generate PDF files that are nearly identical in > size to > those generated by Acrobat Distiller, provided that I create a > Graphics2D > object that is set to convert images to JPEG format so that the > images are > compressed > > Unfortunately, I cannot use this specific Graphics2D feature for > all of the > images. Many of the images are png files that have transparent pixels > within the images (such as icons). Internally, the images use ARGB > format. > I'm wondering if there is any way to dynamically enable and disable > the > conversion of images to JPEG? It would be beneficial if a Graphics2D > instance could be created with the JPEG option enabled, but while > using the > Graphics2D object to be able to temporarily disable that feature so > that > images that should not be converted (so as to prevent the lost of > features > that are not supported by JPEG). Enabling and disabling the > conversion of > the images could be controlled via a new method or via the use of a > rendering hint. Alternatively, a Graphics2D object that would > convert to > another compressed image format that retains the transparent pixels > (such as > PNG) would also work. > > Any thoughts or recommendations? > > Regards, > Steve > > > ---------------------------------------------------------------------- > --- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to > share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php? > page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > iText-questions mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/itext-questions > Buy the iText book: http://itext.ugent.be/itext-in-action/ ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/
