Ok, thanks for the reply! This is the background to my question: I'm working on an application where we have an image markup tool that lets the user put a message somewhere on the image. The message is stored together with the coordinates of where on the image it is placed.
Now, when we run the report, I want the message to be displayed on top of the image in the correct place. I want this to work even if the picture has been scaled down to fit the paper. To place the text on the correct place, I have to compare the intrinsic dimensions of the image with the fixed dimensions of the image in the report, to correctly place the message on top. I currently have a working solution for this, but it is not very good from a performance perspective: Before running the report I download the image and get the dimensions using Sanselan and I send these dimensions to the report. If I could profit from the image cache, that would of course be great. But I'm not really sure how I could write my own extension to do this. Another solution to my problem would be if I somehow could find out by how much the image was scaled. Is that possible to find out? (In a simple way :) -----Original Message----- From: Jeremias Maerki [mailto:d...@jeremias-maerki.ch] Sent: Tuesday, July 26, 2011 1:09 PM To: fop-users@xmlgraphics.apache.org Subject: Re: Outputting intrinsic dimension info of images Erik, you can "preload" the image using the XML Graphics Commons image loading framework (which FOP uses, too): http://xmlgraphics.apache.org/commons/image-loader.html#preloading The ImageInfo object will then contain the intrinsic size. You can use the ImageManager from the FopFactory and probably re-use the ImageSessionContext from the FOUserAgent: ImageManager imageManager = fopFactory.getImageManager(); ImageSessionContext imageSessionContext = foUserAgent.getImageSessionContext(); This allows you to profit from the image cache. What you do with the values and where exactly you want to write it in the PDF is a different question. I don't know what you have in mind here. Do you want to print the values on the page along with the image? Sounds like an XSLT extension then. On 26.07.2011 18:42:15 Erik Wiklander wrote: > Hi, > > I'm using fo:external-graphic to include images in the pdf. Is there > any way that I can find out the intrinsic width and height of an image? So > that I can include that information in the resulting pdf. > > Thanks > //Erik > Jeremias Maerki --------------------------------------------------------------------- To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org