On Tue, 16 May 2006, bruno wrote:
Petter Nyström wrote:
How can I get the co-ordinates of a PdfObject / PdfStream on a page?
I use iText for doing stuff with images in PDF documents. In iText I work
with the images as PdfStreams. Looking through the API documentation, I see
that the Image class holds data for the absolute position of an image. My
question is how can I get that for a PdfStream? I suppose I somehow need to
get in touch with the content stream in order to find out the position of a
PdfObject, but can't find any hints in the docs.
Images (iText) are added as Image XObjects (PDF).
In the content stream of the page, you will have something like this:
q 80 0 0 32 36 780 cm /Img0 Do Q
The numbers 80 0 0 32 36 780 are the values of the Current Transformation
Matrix.
In this case, an image of 80 by 32 user units is positioned at x = 36 and y =
780.
That's the simple explanation.
In reality, it can be very difficult to find the exact location of the image
(and you will need to read the PDF Reference to understand any explanation).
Okay, I'm realizing this isn't an easy thing and I will probably consider
an alternative solution for my underlying problem. However, I got curious
and wanted to look what the content stream looks like - but couldn't find
anything of the pattern you described in my small test document.
Now I feel a bit stupid for asking this, but is the content stream somehow
a stream (doh), as in being a binary thing not readable in a text editor?
Can I get the content stream in clear text by using iText? Just questions
out of curiousity here.
Thanks for all your help and work.
Regards,
Petter
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions