Hi, I know nothing about ColdFusion. However what you explain sounds like something that can be easily caused by the internal structure of your input files. I once created a sample to show a similar problem here:
http://sourceforge.net/mailarchive/message.php?msg_name=46101A8D.9080204%40t-online.de The example there shows that the content of the inputfile can influence in what way other parts of the created file are displayed. It does not solve your problem but shows how such things can happen. The solution would be to save the graphics state before and restore after you change the state. In your case you might be able to preprocess your files to embed each page in another page of the same size while doing this (saving and restoring graphics state). Most probably there is not only the scanned bitmap in your scans. Your scanner software might add some text to the scans even if it is invisible. After the first page (because of using getovercontent) the graphics state or your text settings change. Best regards, Carsten Hugo Sombreireiro schrieb: > Hi guys, > > First of all I've been using iText for just one day now so please bear > with me (even if you don't have to). > So I was handed a bunch of scanned PDF files (PDF 1.6) and asked to > create dynamic watermarks. I was required to use ColdFusion. I played > around with CFPDF but it was a little bit difficult to get exactly what > I wanted. So I downloaded iText and started working on it through CF's > Java Proxy. > I managed to create the watermark and all but there's this weird thing > going on: the first page of each document (each one has 13), when > printed, gets this weird watermark effect: it's possible to see the > watermark "squared" area and the content bellow that area can only be > seen where there are letters. That is, if the watermark was to be > "TEST", the squared area where TEST would be framed is opaque and the > content bellow the watermark can only be seen inside the body of each > letter of the TEST word, like a mask. That doesn't happen in any of the > following pages, where the watermark is working fine. > > This is my code: > > <cfscript> > fullPathToInputFile = ExpandPath("filein.pdf"); > fullPathToOutputFile = ExpandPath("fileout.pdf"); > savedErrorMessage = ""; > loadPaths = ArrayNew(1); > loadPaths[1] = expandPath("iText-2.0.8.jar"); > > javaLoader = createObject("component", > "javaloader.JavaLoader").init(loadPaths); > > > > pdfReader = > javaLoader.create("com.lowagie.text.pdf.PdfReader").init(fullPathToInputFile); > totalPages = pdfReader.getNumberOfPages(); > > > outStream = createObject("java", > "java.io.FileOutputStream").init(fullPathToOutputFile); > pdfStamper = > javaLoader.create("com.lowagie.text.pdf.PdfStamper").init(pdfReader, > outStream); > > > // criação de objectos do ficheiro > BaseFont = javaLoader.create("com.lowagie.text.pdf.BaseFont"); > bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, > BaseFont.EMBEDDED); > Element = javaLoader.create("com.lowagie.text.Element"); > PageSize = javaLoader.create("com.lowagie.text.PageSize"); > color = createObject("java", "java.awt.Color"); > cor = color.init(javacast("int", 0), javacast("int", 255), > javacast("int", 0)); > > watermark_gstate = > javaLoader.create("com.lowagie.text.pdf.PdfGState"); > watermark_gstate.setFillOpacity(0.3); > watermark_gstate.setStrokeOpacity(0.3); > > > > // adiciona watermark > i = 0; > while (i LT totalPages) { > i = i + 1; > // posiciona watermark por cima do conteúdo actual > over = pdfStamper.getOverContent( javacast("int", i) ); > over.setGState(watermark_gstate); > over.beginText(); > over.setColorFill(cor); > over.setFontAndSize(bf, javacast("float", 18) ); > over.setTextMatrix( javacast("float", 30), javacast("float", > 30) ); > over.setFontAndSize(bf, javacast("float", 32) ); > over.showTextAligned(Element.ALIGN_LEFT, javacast("string", > "ORDER NR. 000000"), > javacast("float", 170), > javacast("float", 690), > javacast("float", 0) ); > over.endText(); > > </cfscript> > > Sorry if this is a very simple question but my lack of experience using > iText doesn't allow me to figure this one out. > > Thanks in advance > Hugo > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > > > ------------------------------------------------------------------------ > > _______________________________________________ > iText-questions mailing list > iText-questions@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/itext-questions > Buy the iText book: http://itext.ugent.be/itext-in-action/ ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/