We have a weird problem, we're converting png to pdf format with this simple
code, the pdf result image has extra lines draw around some elements of the
image, not shown in the original png image.
Why is the resulting itext pdg generated with these new lines drawn?
(Using itext version 2.1.7, we can not change easily the version, perhaps is
some kind of know bug in this version?)

try {
            com.lowagie.text.Rectangle pageSize = new
com.lowagie.text.Rectangle(267.7f, 167.2f);
            Document document = new Document(pageSize);
            try {
                PdfWriter.getInstance(document, new
FileOutputStream("c://image.pdf"));
                document.open();                          
                com.lowagie.text.Image
convertBmp=com.lowagie.text.pdf.codec.PngImage.getImage("c://image.png");
                     convertBmp.setAbsolutePosition(0, 0);
                     convertBmp.scaleAbsolute(267.7f, 167.2f);
                     document.add(convertBmp);   
                } catch (Exception e) {
                e.printStackTrace();
            }
            document.close();

We have tried too to create pdf in a different way like this:
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(image, "png", baos); //image is a BufferedImage
byte[] resultImageAsRawBytes = baos.toByteArray();
com.lowagie.text.Image
img1=com.lowagie.text.Image.getInstance(resultImageAsRawBytes);
But we get the same lines draw in the pdf...


Any ideas of what is happening?
Background image is transparent with some elements draw on it, but lines
appear around these elements and in other places inside image, like boxes
surrounding rectangles in the image, but not a complete rectangle is draw
only top, or right or top and right line of the rectangle...

Regards.


--
View this message in context: 
http://itext-general.2136553.n4.nabble.com/PNG-to-PDF-creates-lines-around-boxes-automatically-tp4548343p4548343.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to