Nathan & Joy <nathanandjoy <at> gmail.com> writes: >Image img = Image.getInstance("image.png");
>if(PdfName.IMAGE.equals(type)) { > PdfReader.killIndirect(obj); > writer.addDirectImageSimple(img, (PRIndirectReference)obj); >} I do believe this is the heart of the matter. I suspect that killIndirect + addDirectImageSimple(Image, reference) isn't getting along well for some reason. I poked around in the source a bit, but nothing jumped out at me. I suggest that instead of trying to reuse the same indirect reference, you add the Image, and get it's new indirect reference and use that instead. Okay... so how the heck does one manage that? It looks like you can wrap the Image in a PdfImage, then add that: PdfImage pdfImage = new PdfImage( img, key, null ); Urgh. PdfImage is public, but PdfWriter.add( PdfImage...) is package private. How nice. Ah. PdfWriter.addToBody( PdfObject ), and PdfImage is a PdfStream is a PdfObject. It returns a PdfIndirectObject, which can then be used to replace the existing dictionary value for that image's name. Your current code doesn't keep the key, you'll need to change that. WARNING: addDirectImageSimple, andd(PdfImage) and so forth have special handling built into them for ICC profiles, masks, and so forth. If you're going to run into any of that, you'll need to borrow heavily from iText's source to handle them properly. --Mark Storer Senior Software Engineer Autonomy Cardiff #include <disclaimer> typedef std::Disclaimer<Cardiff> DisCard; ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ 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