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
-- 
View this message in context: 
http://www.nabble.com/getPageAsImage%28%29%2CPdfPatternPainter-and-setPatternFill-problem-tp18587218p18587218.html
Sent from the iText - General mailing list archive at Nabble.com.


-------------------------------------------------------------------------
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

Reply via email to