Hi All,

We are using iText with success in our web application, but now need to include an image in the resulting PDF.

We are using XML to create the report to allow division of labour, but have hit a snag - to include the image it seem straightfoward enough to use the image tag, but how can we resolve the image file from within our war file?

For example, if we say:

<image url="/path/to/foo.jpg"/>

it will resolve this path from the working directory of the application server (Tomcat in our case). Since the war is exploded in a randomly-named temp directory, there's no way we can know this path in advance.

I suppose we could use an http link? But this would need a full path as well, and it would be nice not to have to put the server name in there (it could be dev, staging, production, etc.). Plus it just seems wrong to pull the image back through HTTP...

Is there any way to resolve the image in our servlet using Image.getInstance() and then pass that in to iText somehow, with some sort of image tag in the XML that acts as the placeholder for where it should be positioned? Also seems a bit kludgy though..

Sorry if this is has been covered, but I can't find a reference to this problem in the documentation nor mailing-list archives. I don't really believe we are the first to encounter this problem?

Thanks in advance for all help and/or tips...

Cheers,
Ossie

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to