With 

<xsl:value-of select="$image-base64" />

i get the base64 content as tekst inside the pdf.

But with

<fo:external-graphic src="url('data:image/gif;base64,{$image-base64}')"
height="3cm" width="3cm" />

i still get no visible image :-(

The error i got before was due to an mistake i made in another part of my
xsl stylesheet.

-----Oorspronkelijk bericht-----
Van: Joerg Heinicke [mailto:[email protected]] 
Verzonden: dinsdag 23 december 2008 20:39
Aan: [email protected]
Onderwerp: Re: generate pdf from xml with embedded image?


Marten van der Honing wrote:

> Peter: Did you write a preprocessor in cocoon? Where can i find more 
> info on that?
> 
> Meanwhile i tried another approach:
> <xsl:variable name="image-base64" select=".//IMAGE"/>

You might try
<xsl:variable name="image-base64" select="string(.//IMAGE)"/> just to be
sure.

> <fo:external-graphic 
> src="url('data:image/gif;base64,{$image-base64}')"
> height="3cm" width="3cm" />
> 
> But now i get an error in html instead of an pdf file:
> 
> java.lang.NullPointerException:
> 
> Cocoon stacktrace[hide]
> 
> java.lang.NullPointerException cocoon://fop_post/xsl - 4:14
> 
> Exception in StreamGenerator.generate() cocoon://fop_post/xsl - 4:14 
> [TransformerException] context://fop_post/sitemap.xmap - 11:32 
> <map:serialize type="xml"> context://fop_post/sitemap.xmap - 7:33 
> <map:generate type="stream"> context://fop_post/sitemap.xmap - 44:37 
> <map:serialize type="fo2pdf"> context://fop_post/sitemap.xmap - 43:42 
> <map:transform> context://fop_post/sitemap.xmap - 32:38 <map:generate>
> context://sitemap.xmap - 1034:92 <map:mount> 

Can you post parts of the actual Java stack trace?

Joerg

> Maybe i should try to show the base64 as text in the pdf first to see 
> if it still there.
> 
> -----Oorspronkelijk bericht-----
> Van: Peter Flynn [mailto:[email protected]]
> Verzonden: donderdag 18 december 2008 10:24
> Aan: [email protected]
> Onderwerp: Re: generate pdf from xml with embedded image?
> 
> 
> Ken Starks wrote:
> [...]
>> I did have a few images that were stored also in a database, but I
>> would pre-process them in a seperate stage, generating a local copy, 
>> and populating a table of the database with the path. This was a batch 
>> process, not an interactive one, and it used python rather than 
>> cocoon. (Actually, it could do a minor amount of image-processing as 
>> well, such as cropping, changing contrast, creating thumbnails, 
>> changing to a different format, Etc and used Image magick as well as 
>> python).
> 
> I do something very similar, taking in Word XML documents. The
> preprocessor extracts any encoded image data, converts them back to 
> image format, creates thumbnails and web-res versions, and adds details 
> of them to an XML file in their directory, rather than using a database. 
> The XSL[T] processes then reference them externally as images, which is 
> probably faster than doing database extraction and image conversion in 
> real time.
> 
>> I suppose it depends on the amount of storage you have, and how 
>> important it is to you to store your images on a database.
> 
> In this case there are typically only a handful of images, so a 
> database
> would be overkill: YMMV.
> 
> ///Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to