thanks guys, i will look play with these solutions as i'd like to better
understand the pros and cons of different methods. however, i figured a way
last night of using php and css which seems to work quite well. i pass the
color values in a url to a php page which rewrites a generic css file before
sending a svg file to batik containing an external link to that css file.

see here. http://www.root2art.co.uk/svg_color_selector/index.php modify your
colors and press the 'send to myspace background creator' button. the
background pattern is the png output from batik.

if this method is sound, i figure it has one advantage in that it is
accessible to dimwitts like me who are scared of java. most graphic web
designers know a bit of php and css and could do some interesting things
with batik without having to dip into java.


On 20/03/07, Andreas Neumann <[EMAIL PROTECTED]> wrote:

Hi,

below is a wrapper function for printNode which works on various
browsers/SVG UAs: ASV, Batik, Opera, Firefox, Safari, etc.

you can pass a DOM node and get a string containing the XML fragment
which you can send to Batik on the server. There is also a tutorial on
getURL/postURL/XMLHttpRequest at
http://www.carto.net/papers/svg/network_requests/index.shtml

As an alternative to passing the whole document, you could also pass
only simple parameters, such as color values, which are read by a
serverside script/servlet and fed into Batik and used in an onload script.

============

//this is a wrapper function for the different methods to serialize an
XML node to a string
function serializeNode(node) {
if (typeof XMLSerializer != 'undefined') {
   return new XMLSerializer().serializeToString(node);
}
else if (typeof node.xml != 'undefined') {
   return node.xml;
}
else if (typeof printNode != 'undefined') {
   return printNode(node);
}
else if (typeof Packages != 'undefined') {
   try {
     var stringWriter = new java.io.StringWriter();

Packages.org.apache.batik.dom.util.DOMUtilities.writeNode
(node,stringWriter);
     return stringWriter.toString();
   }
   catch (e) {
       alert("Sorry, your SVG viewer does not support the
printNode/serialize function.");
      return '';
   }
}
else {
       alert("Sorry, your SVG viewer does not support the
printNode/serialize function.");
   return '';
}
}

==========

Andreas

[EMAIL PROTECTED] wrote:

>Hi Harvey,
>
>"Harvey Rayner" <[EMAIL PROTECTED]> wrote on 03/19/2007 10:55:38
AM:
>
>
>
>>i have svg files that users can modify using a javascript interface.
>>
>>i want to send these modified svg files to the rasterizer.  what
>>would be the best way to do this?
>>
>>
>
>   Construct a batik.transcoder.TranscoderInput from the
>modified document (requires a little bit of Java programming),
>then pass that to the JPEG/PNGTranscoder class (Assuming
>the modifications are done with the JSVGCanvas).
>
>   You could also use batik.dom.util.DOMUtilities to write
>the document to disk and then run the rasterizer on that,
>but that would be noticably slower.
>
>   If your changes are done in something other than Batik
>then you will have to figure out how to write the modified
>document out (ASV had a method called printNode).
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>


--
----------------------------------------------
Andreas Neumann
Institute of Cartography
ETH Zurich
Wolfgang-Paulistrasse 15
CH-8093  Zurich, Switzerland

Phone: ++41-44-633 3031, Fax: ++41-44-633 1153
e-mail: [EMAIL PROTECTED]
www: http://www.carto.net/neumann/
SVG.Open: http://www.svgopen.org/
Carto.net: http://www.carto.net/


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to