PdfWriter.setTransparencyBlending(true). Paulo
----- Original Message ----- From: "pavanp" <[email protected]> To: <[email protected]> Sent: Wednesday, September 23, 2009 10:36 PM Subject: Re: [iText-questions] PDFStamper: Color of text in PDF changes when replacing button with PNG Image Is there any solution for this? I am adding a PdfPtable with background colors in the table cells. but when i add a png image to the page, the colors appear darker on the first page and the rest of the pages look good(no image on the other pages). so the first page colors and the other pages colors are looking different. Thanks Pavan Leo Erlandsson wrote: > > Hi, > > I noticed a strange behaviour in PDFStamper yesterday. Maybe I am doing > something wrong... > > The color of text (and images, and other objects, note the faded red color > of the box in the example documents) in PDF changes when replacing a push > button with PNG Image. But this only happens if I flatten the form. An > unflattened form maintains the color in the document. > > Code snippet of code reproducing the problem: > > // Get fields > AcroFields form = stamper.getAcroFields(); > > // Load PNG Image > Image image = Image.getInstance("image.png"); > > // Replace button with image > PushbuttonField bt = form.getNewPushbuttonFromField("picture1"); > bt.setLayout(PushbuttonField.LAYOUT_ICON_ONLY); > bt.setProportionalIcon(true); > bt.setImage(image); > form.replacePushbuttonField("picture1", bt.getField()); > > // Flatten (or not) and close. > stamper.setFormFlattening(flatten); // Should we flatten form? > stamper.close(); > out.close(); > > > Please find the attached example template, image, complete example code > and resulting files. > > > I am using Adobe Acrobat Reader 8.0. If I view the file in e.g Sun's > PDFRenderer, the color is OK. Maybe the problem is in Adobe Acrobat > Reader? But it is interesting that the color of the document is preserved > if flattening is not done, but altered when the form is flattened. > > > > > P.S I bought The Book yesterday. Great stuff! > > Sincerely yours > Leo > ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ iText-questions mailing list [email protected] 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/
