cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Mieth <simon.mi...@t-online.de>
Subject Re: Out of Memory error base64 encoded to SVG to JPG
Date Sat, 11 Sep 2004 08:44:42 GMT
On Sat, 11 Sep 2004 10:15:08 +0800
"Lincoln Mitchell" <lincoln@linc.net.au> wrote:

> I need to convert multiple wordml images (base64 encoded) to JPG.
> I am currently using the following code but get an "Out of Memory" error. If
> I am lucky I get 2 images appear on screen.
> I will try importing low quality JPEG into word to see if that helps and
> also thinking of upgrading RAM or PC current spec is Celeron 2.4GHz, 448MB
> RAM, Running Windows XP (home edition).
> 
> 
> Any clues/recommendations?

Hi Lincoln,

It looks like the cocoon.bat set no parameter for the memory usage, if so the VM only use
64M.
 
maybe this can help

set JAVA_OPTIONS='-Xms32M -Xmx350M'

add this to your cocoon.bat on top? (I dont know  much about BATCH-scripts)


Or:


You can try to use the stx-transformer instead of the xslt-transformer.
The xslt-transformation build a DOM-Document,which consume many memory and you only need to
extract a fragment of this document. 
The stx-transformation is SAX-based and can extract the fragment too without building a DOM-Document.

Based on your document-structure of wordml, the w:binData-element has the attribute w:name
which looks like it is a unique  id. If so you could try to work with this id to extract the
binData. This could be done with the following stx-stylesheet.

<?xml version="1.0"?>
<stx:transform xmlns:stx="http://stx.sourceforge.net/2002/ns" xmlns="http://www.w3.org/1999/xhtml"
xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" version="1.0">

  <stx:param name="image" select="''"/>

  <stx:template match="w:binData[@w:name = $image]">
    <svg:svg xmlns:svg="http://www.w3.org/SVG" width="40" height="30">
      <svg:g>
        <svg:image xmlns:xlink="http://www.w3.org/1999/xlink" width="40" height="30">
          <stx:attribute name="xlink:href">
            <stx:text>data:image/png;base64,</stx:text>
            <stx:value-of select="."/>
          </stx:attribute>
        </svg:image>
      </svg:g>
    </svg:svg>
  </stx:template>
</stx:transform>


and a pipeline like this
<map:match pattern="*.jpg">
	<map:generate src="content/content.xml"/>
	<map:transform src="stylesheets/wordml2svg.stx" type="stx">
		<map:parameter name="image" value="wordml://{1}.jpg"/>
	</map:transform>
	<map:serialize type="svg2jpeg"/>
</map:match>

inside your html-xsl you have to extract the w:binData/@w:name
and with the string-functions of xsl you can get substring (remove the 'wordml://' and '.jpg')
for your imageid.


The different of stx and xsl is in this case small, but stx is limited
look at http://stx.sourceforge.net 

Best Regards,

Simon

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message