Paulo Soares
Tue, 22 Jul 2008 06:40:39 -0700
You'll have to complain to whoever wrote PdfDecoder, probably jpedal. Paulo > -----Original Message----- > From: [EMAIL PROTECTED] > [EMAIL PROTECTED] On > Behalf Of Laurent Godard > Sent: Tuesday, July 22, 2008 12:40 PM > To: itext-questions@lists.sourceforge.net > Subject: [iText-questions] getPageAsImage(), > PdfPatternPainter and setPatternFill problem > > > Hi all > > I experience some troubles using getPageAsImage() with > objects drawn with > image patterns > > All is ok when the file is generated as PDF, but while trying > to extract a > page to generate an image (png), the image background are not > taken into > account > > Here is how i create my zones containing images as backround > (obviously, > these zones are not regular rectangle or circles) > > //---- this is pseudo code > -------------------------------------------------------- > pdfTemplate.lineTo(x,y); > pdfTemplate.lineTo(x,y); > pdfTemplate.lineTo(x,y); > .... > > PdfPatternPainter pattern = pdfTemplate.createPattern(width, > height, width, > height); > image.scaleAbsolute(width, height); > image.setAbsolutePosition(0, 0); > pattern.addImage(image); > pdfTemplate.setPatternFill(pattern); > pdfTemplate.closePathFillStroke(); > //------------------------------------------------------------ > > creating a PDF file is ok, all my special forms have the > pattern image as > background > > but when exporting as Image, i get no background and a lot of > of my objects > are completely black color filled. > I reproduce this for filters such as png, jpg or bmp > > so i suspect the problem to be in the the getPageAsImage() > (no problem when using rectangle API though) > > Here is the code used to create the image > //------------------------------------------------------------ > ByteArrayOutputStream baos; > > PdfDecoder decoder = new PdfDecoder(true); > decoder.useHiResScreenDisplay(true); > decoder.openPdfArray(baos.toByteArray()); > > BufferedImage img = decoder.getPageAsImage(1); > img.flush(); > > ByteArrayOutputStream image = new ByteArrayOutputStream(); > ImageIO.write(img, "png", image); > //------------------------------------------------------------ > > Has someone already experience this ? is something i do wrong ? > Feel free to ask for mor details > > Thanks in advance > > Laurent Aviso Legal: Esta mensagem é destinada exclusivamente ao destinatário. Pode conter informação confidencial ou legalmente protegida. A incorrecta transmissão desta mensagem não significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de usar, revelar ou distribuir qualquer parte desta mensagem. Disclaimer: This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message.
------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________ 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