chris glace wrote: > 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.
I don't understand your code. If you say you're looking for the 'position' of an XObject. Do you mean you are looking for the byte offset in the file (where to find an XObject in a PDF file), or do you mean you are looking for the position of an image on a specific page in a PDF document? I assume you mean the latter (because the former is simple). An XObject is a stream that can be reused in many different other streams. For instance: you could have an image XObject of a logo that appears on every page in the document. Suppose that you have some pages in landscape and some in portrait. Then the logo will have different coordinates on these different pages. Therefore the position of the XObject IS NEVER STORED with the XObject, the position can be found in the stream that refers to the XObject. Maybe your reaction is: "Oh right, then it's simple: I have to look in the content stream of the pages using the XObject." Yes and no. That's indeed where you should look, but it's not simple. Because the actual position depends on the current transformation matrix of the state at the moment the image is added. It's quite some programming work to parse the content stream and calculate the position of an XObject. iText doesn't do this. -- This answer is provided by 1T3XT BVBA ------------------------------------------------------------------------- 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/