Sorry to the list if you see this question twice. I previously posted this message yesterday, but hasn't shown up on the list yet, so I'll try it again.
I've used the iText Java API to create a PDF with several images. Now I'd like to write a unit test to verify my image placement logic. I used Image.setAbsolutePosition to set the image when I initially created the PDF. Now how do I get the position of that image when I reopen the PDF? I know I can get the height and width of images with something like this: PdfReader pdfReader = new PdfReader("mytestdoc.pdf"); for (int i = 0; i < reader.getXrefSize(); i++) { PdfObject pdfobj = reader.getPdfObject(i); if (pdfobj != null && pdfobj.isStream()) { PdfStream stream = (PdfStream) pdfobj; PdfObject pdfsubtype = stream.get(PdfName.SUBTYPE); if (pdfsubtype != null && PdfName.IMAGE.toString().equals(pdfsubtype.toString())) { int height = ((PdfNumber) stream.get(PdfName.HEIGHT)).intValue(); int width = ((PdfNumber) stream.get(PdfName.WIDTH)).intValue(); System.err.println("image width/height: " + width + ","+ height); } } } But how do I find the "x" and "y" of the image? Thanks.............. Larry ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ 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/