Hi, The attached code produces some strange results. It writes some text and draws a GIF with some transparent pixels over it. If you look at it on the screen, it looks good. If you print it, you get a big black thing with random white pixels instead of the image.
I tried with acrobat reader versions 8 and 9 and both are showing the same behavior. But with kpdf, the printed results are correct. I'm using iText version 2.1.5. Do you guys have any idea on what may be wrong? My guess: Acrobat, but what can we do? Thanks. -- Patrick Valsecchi Senior Software Engineer Camptocamp Suisse SA http://www.camptocamp.com +41 21 619 1030
import com.lowagie.text.Document; import com.lowagie.text.DocumentException; import com.lowagie.text.Image; import com.lowagie.text.PageSize; import com.lowagie.text.pdf.BaseFont; import com.lowagie.text.pdf.PdfContentByte; import com.lowagie.text.pdf.PdfStream; import com.lowagie.text.pdf.PdfWriter; import java.io.FileOutputStream; import java.io.IOException; import java.net.URL; public class BugGif { public static void main(String[] args) throws IOException, DocumentException { FileOutputStream out = new FileOutputStream("bugGIF.pdf"); Document doc = new Document(PageSize.A4); PdfWriter writer = PdfWriter.getInstance(doc, out); writer.setFullCompression(); writer.setPdfVersion(PdfWriter.PDF_VERSION_1_5); writer.setCompressionLevel(PdfStream.BEST_COMPRESSION); doc.open(); PdfContentByte dc = writer.getDirectContent(); dc.setFontAndSize(BaseFont.createFont(), 18); dc.beginText(); dc.moveText(40, 140); dc.showText("This text should be fully readable even when printed"); dc.endText(); final Image image = Image.getInstance(new URL("http://dev.mapfish.org/tmp/bugPDF.gif")); image.setAbsolutePosition(100, 100); image.scaleAbsolute(256, 256); dc.addImage(image); dc.rectangle(100, 100, 256, 256); dc.stroke(); doc.close(); writer.close(); out.close(); } }
bugGIF.pdf
Description: Adobe PDF document
------------------------------------------------------------------------------ Register Now & Save for Velocity, the Web Performance & Operations Conference from O'Reilly Media. Velocity features a full day of expert-led, hands-on workshops and two days of sessions from industry leaders in dedicated Performance & Operations tracks. Use code vel09scf and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________ 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