Hello Folks,

I'm trying insert a images on empty pages of pdf file existing. My code for
this purpose is the next:

        pdfReader    = new PdfReader("source.pdf");
        pdfStamper     = new PdfStamper("destination.pdf"));

        for(Iterator<FinalPageImage>
itFinalPageImg=imgageList.iterator();itFinalPageImg.hasNext();){
            FinalPageImage image = itFinalPageImg.next();

            BufferedImage image     = image.getImage();

            Raster tmpRaster = image.getRaster();
            DataBuffer db = tmpRaster.getDataBuffer();
            byte[] bytes = new byte[db.getSize()];

            // I need to do a transformation
            for (int l_i = 0; l_i < bytes.length; l_i++) {
                bytes[l_i] =
(byte)Math.round(db.getElemFloat(l_i)*(float)255);
            }

            PdfContentByte content =
pdfStamper.getOverContent(image.getPageNum());
            Image iTextImg = Image.getInstance(tmpRaster.getWidth(),
tmpRaster.getHeight(),    4, 8, bytes);
            iTextImg.setSmask(false);
            iTextImg.setAbsolutePosition(0,0);
            content.addImage(iTextImg);
        }
        pdfReader.close();
        pdfStamper.close();

The result is nothing, the document destination page is blank. If I make a
document from scratch with pdfWriter the result is ok, the documents with
the image are dumped to file.

Could somebody help me, please?.

Thanks in advance.
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
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