[oXygen-user] SVG rasterizer

Tony Graham
Fri Jun 10 11:09:55 CDT 2011

On Thu, June 9, 2011 4:31 pm, Wendell Piez wrote:
> Of the methods suggested so far, wrapping the rasterizer in XSLT/XSL-FO
> would allow this, since such a transformation could (given the necessary
> permissions) be set up inside the SVG framework.

Just for fun (and a future blog post):

Custom FO processor command line:

"${oxygenInstallDir}/jre/bin/java" -cp
org.apache.batik.apps.rasterizer.Main -scriptSecurityOff -m image/jpeg -d
${out} ${fo}

When configuring the transformation scenario, select "XML URL as input" in
the "FO Processor" tab and use "${cfd}\${cfn}.jpg" as the output file.
Ant transformation scenario build file:

<?xml version="1.0" encoding="UTF-8"?>
    <!-- <oXygen/>-related properties. -->
    <property name="pd" value="."/>
    <property name="cfd" value="."/>
    <property name="cfn" value="."/>
    <property name="cfne" value="."/>
    <property name="oxygenInstallDir" value="."/>

    <target name="rasterize">
        <java classname="org.apache.batik.apps.rasterizer.Main" fork="yes">
            <arg value="-scriptSecurityOff"/>
            <arg value="-m"/>
            <arg value="image/jpeg"/>
            <arg value="-d"/>
            <arg value="${cfd}/${cfn}.jpg"/>
            <arg value="${cfne}"/>

I couldn't find the rasterizer task in oXygen's libraries so I ran it

I couldn't get it to run without 'fork="yes"' because I couldn't set the
Java security permissions properly.

When configuring the Ant transformation, the dialog box for the
undocumented(?) 'Libraries' button has the title "Edit extensions".  Is
that correct?
XProc script file:

<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
    xmlns:c="http://www.w3.org/ns/xproc-step" version="1.0">

    <p:option name="cfd" required="true"/>
    <p:option name="cfn" required="true"/>
    <p:option name="cfne" required="true"/>
    <p:option name="oxygenInstallDir" required="true"/>

    <p:exec result-is-xml="false" arg-separator="#">
        <p:input port="source">

Having to build the 'args' option that way was less than convenient.

Finally, when right-clicking on a file in the Project View and selecting
"Configure Transformation Scenario...", the list of available transforms
isn't filtered by transformation type as it is when you click on the
"Configure Transformation Scenario" button in the toolbar.


Tony Graham                                   
Consultant                                 http://www.mentea.net
Mentea       13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
 --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
    XML, XSL FO and XSLT consulting, training and programming

More information about the oXygen-user mailing list