You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Jeremias Maerki <je...@outline.ch> on 2002/03/28 08:23:53 UTC

Re: How to generate image on pdf from binary stream ?

> How to generate image on pdf from  binary stream ?
> I want to display logo image in pdf file, but I only have the binary stream of the gif file
> retrieved from database, and I don't want to create the gif file. Can anyone tell me how to 
> generate image on pdf file  from binary stream.

If I get you right, you want to load the GIF from the database instead
of from a file. Images are getting loaded by FOP using URLs.
Ok, then you have to create a new protocol handler so you can fetch the
image using an URL such as myimages://mydb/id76723644, for example,
where myimages is your custom protocol, mydb your database and
id76723644 the id of the images in the database. Your protocol handler
will then establish a connection to the database lookup the id of the
image and return the InputStream on the blob in openStream().

There's a good tutorial on how to create such protocol handlers:
http://developer.java.sun.com/developer/onlineTraining/protocolhandlers/

Good luck!

Cheers,
Jeremias Märki

mailto:jeremias.maerki@outline.ch

OUTLINE AG
Postfach 3954 - Rhynauerstr. 15 - CH-6002 Luzern
Tel. +41 41 317 2020 - Fax +41 41 317 2029
Internet http://www.outline.ch