Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Images and XSL-FO

872 views
Skip to first unread message

Preethi Igoor

unread,
Oct 16, 2003, 9:00:34 PM10/16/03
to
Hello,

This is an XSL-FO question. I have a image which I have programmatically
generated using Java. I wish to embed this into a PDF document.

I know that we can embed image files into XSL-FO. But is there a solution
wherein I can add image represented as byte array from a java program into
PDF?. Writing a byte array into a file and embedding this file may not be a
very efficient solution.

Thanks,


Nikolai Grigoriev

unread,
Oct 17, 2003, 3:19:11 PM10/17/03
to
"Preethi Igoor" <ig...@comcast.net> wrote:

> I know that we can embed image files into XSL-FO. But is there a solution
> wherein I can add image represented as byte array from a java program into
> PDF?. Writing a byte array into a file and embedding this file may not be
> a very efficient solution.

In XSL-FO, images are referenced by URLs; and URLs can contain
the actual data using the "data" URL scheme [RFC 2397,
http://www.ietf.org/rfc/rfc2397.txt]. However, you should
check if your XSL-FO formatter supports "data" scheme.
There is no built-in support for this URL type in Java, so
you don't get it granted.

My company's product, RenderX XEP, supports data URLs.

Best regards,
Nikolai Grigoriev
RenderX

Ricuzzo

unread,
May 5, 2011, 8:32:52 AM5/5/11
to
You can invoke a Java from fo tha returns a base64 String representation of the image (very esay), you can then use the following fo code to use that 64base string as the url source form the graphic:

<fo:external-graphic content-height="10em" content-width="13em" src="url({$urlImagen})"/>

where urlImagen, is something like:

<xsl:variable name="urlImagen">
data:image/auto;base64,
<xsl:value-of select="java:com.tragsega.promis.graficos.ImgCreator.getEncodedString('${nombre}','/img/')"/>
</xsl:template>

It works. Be sure to have appropiate jars (xalan extensions)


0 new messages