Is there a simple example somewhere to find all images in a PDF and
get them as a byte array?  I want to extract them for the purpose of
barcode scanning.

I have something like this:

final PdfReader reader = new PdfReader(pdfBytes);
                        PdfDictionary pg = reader.getPageN(1);
                        PdfDictionary res = (PdfDictionary)
PdfReader.getPdfObject(pg.get(PdfName.RESOURCES));
                        PdfDictionary xobj = (PdfDictionary)
PdfReader.getPdfObject(res.get(PdfName.XOBJECT));
                        if (xobj != null) {
                                for (Iterator it = xobj.getKeys().iterator(); 
it.hasNext();) {
                                        PdfObject obj = xobj.get((PdfName) 
it.next());
                                        if (obj.isIndirect()) {
                                                PdfDictionary tg = 
(PdfDictionary) PdfReader.getPdfObject(obj);
                                                PdfName type = (PdfName) 
PdfReader.getPdfObject(tg.get(PdfName.SUBTYPE));
                                                if (PdfName.IMAGE.equals(type)) 
{
                                                        
System.out.println("FOUND AN IMAGE");
                                                }
                                        }
                                }
                        }
..and I print the FOUND AN IMAGE, but am not clear on how to actually
get the bytes that represent it?  Any pointers?

Thanks in advance,
Davis

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to