Do you have a link to your page? Bruce -----Original Message----- From: horstpeter [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 11, 2007 2:25 PM To: [email protected] Subject: RE: rasterize on server
IE6, with firefox i don't get any message back. thanks Bruce Rindahl wrote: > > What browser are you using? > Bruce > > -----Original Message----- > From: horstpeter [mailto:[EMAIL PROTECTED] > Sent: Tuesday, September 11, 2007 2:20 PM > To: [email protected] > Subject: RE: rasterize on server > > > Thank you already, but when I do all that, I get a message "no method to > serialize node". > Where do i put the function serializeNode (node) {? In the html script > area? > Do I need a Init(evt)? > Thnak you so much, it seems like i am a lot closer now. > > > Bruce Rindahl wrote: >> >> I have a button in my SVG file that calls the following script: >> >> -------------------------------------------------------------------- >> function makePDF() { >> var dom = serializeNode(document.getElementById('printArea')); >> dom = dom.replace('onload="init(evt);"',''); >> var postDataObj = new postXMLData('makePDF.php', dom, madePDF); >> postDataObj.postData(); >> } >> -------------------------------------------------------------------- >> >> Here my main SVG document has an id of 'print area'. >> The current DOM (after the user manipulates it) is copied by the >> serializeNode function in line 1. I then remove the onload function >> (things >> are done in init() that are no longer needed) in line 2. I then post the >> DOM to a php function that creates a PDF on my server in lines 3 and 4. >> The >> third parameter in line 3 updates a link to the newly created PDF file. >> >> The function serializeNode is: >> >> -------------------------------------------------------------------------- >> //Serialize node from Martin Honnen - see >> http://www.faqts.com/knowledge_base/view.phtml/aid/34646 >> >> function serializeNode (node) { >> if (typeof XMLSerializer != 'undefined') { >> var nodeString = new XMLSerializer().serializeToString(node) >> return nodeString; >> } >> else if (typeof node.xml != 'undefined') { >> return node.xml; >> } >> else if (typeof printNode != 'undefined') { >> var nodeString = printNode(node); >> //IE+ASV does not escape the '&' in a url string that Batik needs for PDF >> conversion >> var re = new RegExp("&","g") >> return nodeString.replace(re,'&'); >> } >> 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) { >> // might want to handle problem here >> return ''; >> } >> } >> else { >> // might want to handle problem here >> alert("No method to serialize node!"); >> return ''; >> } >> } >> > ---------------------------------------------------------------------------- >> >> The PHP file makePDF.php is: >> >> ------------------------------------------------------------------------- >> <?php >> set_time_limit(6000); >> $post = $HTTP_RAW_POST_DATA; >> header("Content-Type: text/xml"); >> $numbytes = file_put_contents("xxx.svg",$post); >> exec("java.exe -jar -Xmx512m batik-rasterizer.jar -m application/pdf -w >> 1632 >> -h 1056 xxx.svg"); >> exec("move xxx.pdf output.pdf"); >> echo '<g id="output.pdf?'.time().'" />'; >> ?> >> -------------------------------------------------------------------------- >> The result is a new file on the server called output.pdf that is a >> snapshot >> of the users display. >> >> I think there is a parameter available in batik-rasterizer.jar to prevent >> the onload stuff I eliminated in Line 2 of the first function. >> >> Bruce >> >> >> >> -----Original Message----- >> From: horstpeter [mailto:[EMAIL PROTECTED] >> Sent: Tuesday, September 11, 2007 1:01 PM >> To: [email protected] >> Subject: rasterize on server >> >> >> OK, I know a lot of people had the same problem, but reading through >> forums >> for 2 days now didn't help me at all. >> I have a basic website with a svg embedded. The SVG has some JS in there >> for >> the user to change the svg. I would love to have a button to export the >> svg >> to a JPEG. >> I already downloaded the batik package and put it on the server, I just >> can't find the right way to call the rasterizer. >> Thank you so much. >> -- >> View this message in context: >> http://www.nabble.com/rasterize-on-server-tf4424626.html#a12621425 >> Sent from the Batik - Users mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> 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] >> >> >> > > -- > View this message in context: > http://www.nabble.com/rasterize-on-server-tf4424626.html#a12622899 > Sent from the Batik - Users mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > 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] > > > -- View this message in context: http://www.nabble.com/rasterize-on-server-tf4424626.html#a12622996 Sent from the Batik - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- 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]
