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 Matthew Case <ma...@loanprotector.com> on 2003/12/15 22:27:56 UTC

Embedding bitmaps directly in XSL/FOP Rendering

Hello all.

About a year ago I developed a database-enabled text-parsing engine that can
be used to create letters and faxes and other happy things that the
business-types here like. The rendering is done using FOP 0.20.5, so my
question is relevant and two fold. The first part is XSL-FO related, and the
second part is FOP related.

I'm wondering if it would be possible for me to embed bitmap data directly
into an XSL-FO document? I'd like to query a logo out of my database and
slap it right in there instead of saving it to an external file first. I've
seen the "instream-foreign-object" tag and it seems promising but i haven't
seen any use of it, much less embedding a bitmap directly in the xml before
rendering. Is this possible? Has anyone done it?

The FOP-related question is: Even if this is possible from an XSL-FO
standpoint, is it possible using FOP 0.20.5?

Deadlines are looming. Answers would be greatly appreciated. Thanks in
advance.

 - Matt Case

Re: Embedding bitmaps directly in XSL/FOP Rendering

Posted by Jeremias Maerki <de...@greenmail.ch>.
(comments inline)

On 15.12.2003 22:27:56 Matthew Case wrote:
> About a year ago I developed a database-enabled text-parsing engine that can
> be used to create letters and faxes and other happy things that the
> business-types here like. The rendering is done using FOP 0.20.5, so my
> question is relevant and two fold. The first part is XSL-FO related, and the
> second part is FOP related.
> 
> I'm wondering if it would be possible for me to embed bitmap data directly
> into an XSL-FO document? I'd like to query a logo out of my database and
> slap it right in there instead of saving it to an external file first. I've
> seen the "instream-foreign-object" tag and it seems promising but i haven't
> seen any use of it, much less embedding a bitmap directly in the xml before
> rendering. Is this possible?

Yes.

> Has anyone done it?

I dont' know.

> The FOP-related question is: Even if this is possible from an XSL-FO
> standpoint, is it possible using FOP 0.20.5?

Yes. Create a FOP extension as described here: http://xml.apache.org/fop/dev/extensions.html

As an example for a FOP extension you can have a look at my pet project, Krysalis
Barcode (in the process of being renamed to Barcode4J), at
http://barcode4j.krysalis.org. The relevant sources are here:
http://cvs.sourceforge.net/viewcvs.py/barcode4j/barcode4j/src/fop-0.20.5/java/org/krysalis/barcode4j/fop0205/

I think this extension should give you some idea on how to create an
extension that can load a bitmap embedded in a
fo:instream-foreign-object. Not everything's there, you might need to
modify the FOP sources a bit, but it's definately a possibility.

> Deadlines are looming. Answers would be greatly appreciated. Thanks in
> advance.

Ok, you've got a deadline, so I would suggest you take the easier route
to create a servlet that reads the bitmap from your database. In this
case you only embed a URL in a fo:external-graphic to references the
image you want to appear. 

I hope this helps. If you decide to create that extension for the
in-stream bitmaps it would be cool if you could share it as I remember
that this is a topic that has come up before. Good luck.

Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org