François Miermont wrote: > The problem is that the text does not use the Alpha parameter for the > Color. I’d like to have the “Preview” to be in top of document, but with > transparency.
They do exist, iText developers who don't own "iText in Action" yet ;-) Transparency is discussed in chapter 11 and you'll find some examples here: http://www.1t3xt.info/examples/browse/?page=toc&id=16 But in chapter 14, you'll find an example that has exactly the code snippets you are looking for: http://www.1t3xt.info/examples/browse/?page=example&id=224 PdfGState gstate = new PdfGState(); gstate.setFillOpacity(0.3f); gstate.setStrokeOpacity(0.3f); PdfContentByte contentunder = writer.getDirectContentUnder(); contentunder.saveState(); contentunder.setGState(gstate); contentunder.addImage(image, image.getWidth() * 4, 0, 0, image.getHeight() * 4, 120, 650); contentunder.setColorFill(color); contentunder.beginText(); contentunder.setFontAndSize(helv, 48); contentunder.showTextAligned(Element.ALIGN_CENTER, "My Watermark Under " + writer.getPageNumber(), document.getPageSize().getWidth() / 2, document.getPageSize().getHeight() / 2, 45); contentunder.endText(); contentunder.restoreState(); This example is different on 2 accounts: 1. getDirectContentUnder() is used, so the newly added content doesn't cover the existing content, it goes UNDER it. 2. The Graphics State is changed to transparent. Experiment with the example and read the book for more info. -- This answer is provided by 1T3XT BVBA ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Do you like iText? Buy the iText book: http://www.1t3xt.com/docs/book.php Or leave a tip: https://tipit.to/itexttipjar