You'll have to provide the PDF.

Paulo

On Fri, Jul 12, 2013 at 1:03 AM, ashish <sog...@gmail.com> wrote:
> Hi,
>
>
> I am using ImageRenderInfo for parsing PDFs and getting ImageBytes but for
> my perticular PDF file which has one big PNG image in it nothing else, the
> ImageRenderInfo.getImage() gives nothing if I save the bytes as .png on
> filesystem the image is all black.
>
> Here is the code.
>
>
> public void renderImage(ImageRenderInfo renderInfo)
>         {
>                 cnt++;
>                 try
>                 {
>           //  String filename;
>           //  FileOutputStream os;
>             PdfImageObject image = renderInfo.getImage();
>
>
>             if (image == null) return;
>             //filename = String.format(path,
> renderInfo.getRef().getNumber(), image.getFileType());
>            // os = new FileOutputStream(filename);
>            // os.write(image.getImageAsBytes());
>             byte [] pageImageBytes = imageMap.get(pageNumber);
>
>             if(pageImageBytes == null)
>             {
>                 pageImageBytes = new byte[image.getImageAsBytes().length];
>
>                 System.arraycopy(image.getImageAsBytes(), 0, pageImageBytes, 
> 0,
> image.getImageAsBytes().length);
>                 imageMap.put(pageNumber, pageImageBytes);
>
>                 //java.io.InputStream _in = new
> ByteArrayInputStream(pageImageBytes);
>                         //BufferedImage im = ImageIO.read(_in);
>                 ImageIO.write(image.getBufferedImage(), "png", new
> File("/Users/ayeole/Desktop/images/Img"+cnt+".png"));
>             }
>             else
>             {
>                 byte [] newBytes = new byte[image.getImageAsBytes().length +
> imageMap.get(pageNumber).length];
>                 System.arraycopy(image.getImageAsBytes(), 0, newBytes, 0,
> image.getImageAsBytes().length);
>                 System.arraycopy(imageMap.get(pageNumber),0,
> newBytes,image.getImageAsBytes().length, imageMap.get(pageNumber).length);
>                 imageMap.put(pageNumber, newBytes);
>             }
>
>
>            // os.flush();
>           //  os.close();
>         }
>                 catch (IOException e)
>         {
>             System.out.println(e.getMessage());
>         }
>         }
>
>
> Please let me know if you anyone has any solution for this...
>
>
>
> --
> View this message in context: 
> http://itext-general.2136553.n4.nabble.com/ImageRenderInfo-getImage-return-empty-bytes-tp4658726.html
> Sent from the iText - General mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> See everything from the browser to the database with AppDynamics
> Get end-to-end visibility with application monitoring from AppDynamics
> Isolate bottlenecks and diagnose root cause in seconds.
> Start your free trial of AppDynamics Pro today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> 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

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
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