You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by jeanromain <jr...@gmail.com> on 2007/01/03 19:58:23 UTC

Generate PNG files from SVGs and XML configuration files without events

Hi,

Does anybody know how can a program can load an SVG, modify it (based
on XML configuration file) and transform it in PNG file without using
any event ??

For info:
I do not want to deal with events as I neeed to generate many PNG (and
so to load many SVG). I made a program that works for ONE image but
with 2, 3, ..images . , it doesn't :(

Here is a simplified piece of my code:

        String parserClassName = XMLResourceDescriptor.getXMLParserClassName();
    	SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parserClassName);
    	try {
    		document = f.createDocument(new File(svgFullFilePath).toURL().toString());
    	
    	    //ApplyConfig();
    	
    	} catch(IOException e){
    	    Log.Write(e.toString());
    	}
    	Element r = document.getElementById("SEL_POSITION__AIR_FLOW");
    	r.setAttribute("value", "HI");
    	
        CreatePng(document); // This method works fine

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


Re: Generate PNG files from SVGs and XML configuration files without events

Posted by jeanromain <jr...@gmail.com>.
Thanks for your anwser Thomas,

My problem is now solved.
My program did'nt work because of particular SVG I have to work on.
While SVG loading a javascript file is called and do some
modifications on the SVG.
The solution was make my modifications on the SVG after the javascript
modifications, that is when I cath a specific event launched by the js
program when it finished.

This post may help nobody as it is really specific but now the thread
is closed and the problem solved :)
Happy new year!


On 1/4/07, thomas.deweese@kodak.com <th...@kodak.com> wrote:
>
> Hi Jean,
>
> jeanromain <jr...@gmail.com> wrote on 01/03/2007 01:58:23 PM:
>
>  > Does anybody know how can a program can load an SVG, modify it (based
>  > on XML configuration file) and transform it in PNG file without using
>  > any event ??
>
>    I don't know what you mean by event.  But you can modify any
> SVG anyway you want to before giving it to the PNGTranscoder.
>
> > For info:
>  > I do not want to deal with events as I neeed to generate many PNG (and
>  > so to load many SVG). I made a program that works for ONE image but
>  > with 2, 3, ..images . , it doesn't :(
>
>    Care to say what happens (why it doesn't work) with 2, 3, ...
> images.
>
> > Here is a simplified piece of my code:
>
>    It seems simplified beyond utility, especially w/o
> know what problem you are having with multiple images...
>
> >         String parserClassName = XMLResourceDescriptor.
>  > getXMLParserClassName();
>  >        SAXSVGDocumentFactory f = new
> SAXSVGDocumentFactory(parserClassName);
>  >        try {
>  >           document = f.createDocument(new File(svgFullFilePath).
>  > toURL().toString());
>  >
>  >            //ApplyConfig();
>  >
>  >        } catch(IOException e){
>  >            Log.Write(e.toString());
>  >        }
>  >        Element r = document.getElementById("SEL_POSITION__AIR_FLOW");
>  >        r.setAttribute("value", "HI");
>  >
>  >         CreatePng(document); // This method works fine
>  >
>  >
> ---------------------------------------------------------------------
>  > To unsubscribe, e-mail:
> batik-users-unsubscribe@xmlgraphics.apache.org
>  > For additional commands, e-mail:
> batik-users-help@xmlgraphics.apache.org
>  >
>

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


Re: Generate PNG files from SVGs and XML configuration files without events

Posted by th...@kodak.com.
Hi Jean,

jeanromain <jr...@gmail.com> wrote on 01/03/2007 01:58:23 PM:

> Does anybody know how can a program can load an SVG, modify it (based
> on XML configuration file) and transform it in PNG file without using
> any event ??

   I don't know what you mean by event.  But you can modify any
SVG anyway you want to before giving it to the PNGTranscoder.

> For info:
> I do not want to deal with events as I neeed to generate many PNG (and
> so to load many SVG). I made a program that works for ONE image but
> with 2, 3, ..images . , it doesn't :(

   Care to say what happens (why it doesn't work) with 2, 3, ... 
images.

> Here is a simplified piece of my code:

   It seems simplified beyond utility, especially w/o
know what problem you are having with multiple images...

>         String parserClassName = XMLResourceDescriptor.
> getXMLParserClassName();
>        SAXSVGDocumentFactory f = new 
SAXSVGDocumentFactory(parserClassName);
>        try {
>           document = f.createDocument(new File(svgFullFilePath).
> toURL().toString());
> 
>            //ApplyConfig();
> 
>        } catch(IOException e){
>            Log.Write(e.toString());
>        }
>        Element r = document.getElementById("SEL_POSITION__AIR_FLOW");
>        r.setAttribute("value", "HI");
> 
>         CreatePng(document); // This method works fine
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>