I'm trying to find the position of an xobject in an existing pdf file. I'm wondering if there is a way to use stream.get(PdfName. . . to return the location of the object. The code I'm using is as follows.
for (int i = 1; i < reader.getXrefSize(); i++) { PdfObject pdfobj = reader.getPdfObject(i); if (!pdfobj.isStream()) { continue; } PdfStream stream = (PdfStream) pdfobj; PdfObject pdfsubtype = stream.get(PdfName.SUBTYPE); if (pdfsubtype == null) { continue; } if (!pdfsubtype.toString().equals(PdfName.IMAGE.toString())) { continue; } byte[] img = PdfReader.getStreamBytesRaw((PRStream) stream); System.out.println("height:" + stream.get(PdfName.HEIGHT)); System.out.println("width:" + stream.get(PdfName.WIDTH)); System.out.println("Position: " + stream.get(PdfName.IMAGE)); System.out.println("bitspercomponent:" + stream.get(PdfName.BITSPERCOMPONENT)); } } } ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/