Whenever you enter the transparency/opacity realm everything slows down and looks different. It doesn't matter if the PDF was created with iText or something else. If you just want to put a background in a PDF you don't need opacity, use PdfStamper.
> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of Ruud Huynen > Sent: Wednesday, March 02, 2005 5:09 PM > To: [email protected] > Subject: [iText-questions] Printing takes 5 times longer when > using a PdfTransparencyGroup > > Hello > > We have a document archive keeping documents and background-formulars > seperate. > On the fly a document is merged with its background (PDF containing a > TIFF (non-transparent) or text). > > Here is an excerpt of my program, showing the fast printing > OPTION 1 (1 > page=30 seconds) > and the desired, but slow printing OPTION 2 ( 1 page = 3 minutes). > > ================================================================== > com.lowagie.text.pdf.PdfReader readerBG = new > com.lowagie.text.pdf.PdfReader(doc_bg); > int BGPagesCount = readerBG.getNumberOfPages(); > com.lowagie.text.pdf.PdfImportedPage pageBG = > writer.getImportedPage(readerBG, 1); > > com.lowagie.text.pdf.PdfContentByte cb = writer.getDirectContent(); > document.setPageSize(psize); > > int page = 0; > while (page < docPagesCount) { > document.newPage(); > // OPTION 1: > // Working only for textual documents: Overlay this > background with a > textual document > OPTION 1: cb.addTemplate(pageBG, m[0], m[1], m[2], m[3], m[4], > m[5]); > > page++; > // write document > com.lowagie.text.pdf.PdfImportedPage pageDoc = > writer.getImportedPage(reader, page); > > // OPTION 2: > // Instead using the previous "cb.addTemplate(pageBG" > // printing is very slow > cb.saveState(); > PdfGState gs = new PdfGState(); > gs.setFillOpacity(1f); > gs.setBlendMode(PdfGState.BM_MULTIPLY); > cb.setGState(gs); > PdfTransparencyGroup group = new PdfTransparencyGroup(); > pageBG.setGroup(group); > cb.addTemplate(pageBG, m[0], m[1], m[2], m[3], m[4], m[5]); > cb.restoreState(); > // end OPTION 2 > > } > ================================================================== > > With OPTION 1 I have > - a PDF with a background and a textual document > - printing is fast > - cannot create a PDF with a document containing a TIFF (overlay > background) > > With OPTION 2 I have > - a PDF is created with document and a background (TIFF) added using > transparency > - printing is fast for a TIFF document > - printing is slow for a textual document > - printing as an image option within acrobat is not an > option, because > the quality of the text, in 300, 600 and 1200 dpi is not good > > What I want is to use OPTION2 instead of OPTION1 to also correctly > display TIFF documents with TIFF backgrounds. > > The PDFs are correctly displayed within Acrobat. With OPTION 2 I > noticed Acrobat showing a message "Flattening layers" when printing, > this should be correct. > My questions: > - Is the coding correct for OPTION 2 ? > - Why is printing so slow for a textual document combined with a TIFF > image ? > > I got stuck with this problem, so any help is very much appreciated. > Ruud > > > > > > > -------------------------------------------------------------- > ----------- > This message is intended for the addressee only and may > contain confidential or privileged information. If you > are not the intended receiver, any disclosure, copying > to any person or any action taken or omitted to be taken > in reliance on this e-mail, is prohibited and may be un- > lawful. You must therefore delete this e-mail. > Internet communications may not be secure or error-free > and may contain viruses. They may be subject to possible > data corruption, accidental or on purpose. This e-mail is > not and should not be construed as an offer or the > solicitation of an offer to purchase or subscribe or sell > or redeem any investments. > -------------------------------------------------------------- > ----------- > > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from > real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > iText-questions mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/itext-questions > ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_ide95&alloc_id396&op=click _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions
