Re: 1.1.1 transcoding
On Thursday 20 December 2001 19:35, Anthony Shawver wrote: I created simple little test program to illustrate my problem. The test program has 2 parts; the first part reads an SVG file from disk(I enclosed the one (test.svg) that I used for testing) transcodes(this works). The second part uses a method in the class to create a very simple SVG Document transcodes it(this doesn't work). When you run the code, you will notice that no errors are thrown. However the first part creates a valid jpg whereas the second produces a blank image. So from this I have 2 questions: 1) Why isn't the SVG Document able to be transcoded properly Your test.svg file does not have the proper DOCTYPE to say that this is an SVG document. So you should add the following lines in test.svg ?xml version=1.0 standalone=no? !DOCTYPE svg PUBLIC -//W3C//DTD SVG 1.0//EN http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd; svg xmlns=http://www.w3.org/2000/svg; xmlns:xlink=http://www.w3.org/1999/xlink; width=??? height=??? ... /svg 2) why isn't the transcoder throwing an exception on the SVG Document? See thomas's analysis. Conlcusion: SVG relies on DOM level 2 spec which is namespace aware. So you always have to use the createElementNS(svgNs, localName) method. Where svgNS is the namespace URI of SVG, and localName is the local name of the element to create. PS: to set attributes, use setAttributeNS(null, qualifiedName). For futher details regarding why 'null' is used (attributes are always in the default namespace) - see the W3C namespace specification. Thierry. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: 1.1.1 transcoding
Thanks Thierry Thomas, you've been a great help. One last question: The Batik JavaDocs don't seem to have a class that implements the DocumentType interface. Am I missing something? What is the recommended way to set the DocumentType as you have said below. Thanks, Tony -Original Message- From: Thierry Kormann [mailto:[EMAIL PROTECTED]] Sent: Friday, December 21, 2001 4:07 AM To: Batik Users; Anthony Shawver Subject: Re: 1.1.1 transcoding Your test.svg file does not have the proper DOCTYPE to say that this is an SVG document. So you should add the following lines in test.svg ?xml version=1.0 standalone=no? !DOCTYPE svg PUBLIC -//W3C//DTD SVG 1.0//EN http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd; svg xmlns=http://www.w3.org/2000/svg; xmlns:xlink=http://www.w3.org/1999/xlink; width=??? height=??? ... /svg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: 1.1.1 transcoding
I cannot vouch for the xml transcoders, but it works fine with svg transcoders in both 1.0 and 1.1 -Original Message- From: Anthony Shawver [mailto:[EMAIL PROTECTED]] Sent: 18 December 2001 22:56 To: Batik Users Subject: 1.1.1 transcoding Hi All, I created an application with version 1.0 and was forced (due to I think, a bug at the time) to create the XML, write to disk, then read from disk for transcoding files to jpeg format. I would like to call the transcoder with just the XML and not create any temporary files. Has anyone verified this works properly with 1.1.1? I think it is simply a matter of using: public void transcode(TranscoderInput input, TranscoderOutput output) and passing it a TranscoderInput using a Document as the argument instead of my current way which passes a URI as the constructor's argument. Can anyone verify this functionality? Thanks, Tony This Internet E-mail is intended solely for the person to whom it is addressed. It may contain confidential or privileged information. If you have received it in error please notify us immediately by telephone and destroy the transmission. You must not copy, distribute or take any action in reliance on it. Aerosystems International Phone: +44 (0)1935 443000 Fax : +44 (0)1935 443111 Web : www.aeroint.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: 1.1.1 transcoding
Thanks, David. However I still get the problem: Previously when transcoding, I used the new TranscoderInput(String URI) constructor for input, and everything works fine. My output stream size is about 5k in this instance. transcoder.transcode(new TranscoderInput(uri), new TranscoderOutput(ostream)); However, now I'm attempting to use the new TranscoderInput(Document doc) constructor for input, and I do not seem to get any image output. My output stream is 991 in this instance. transcoder.transcode(new TranscoderInput(document), new TranscoderOutput(ostream)); The rest of the code (including the TranscoderOutput) is identical. The only thing I can get from debugging it is the difference in output size. The only thing I have changed is the transcode method. I need to do this because performance in unacceptable the other way. Has anyone used the document version of transcode successfully? Thanks, Tony -Original Message- From: David Smith [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 19, 2001 3:52 AM To: 'Batik Users' Subject: RE: 1.1.1 transcoding I cannot vouch for the xml transcoders, but it works fine with svg transcoders in both 1.0 and 1.1 -Original Message- From: Anthony Shawver [mailto:[EMAIL PROTECTED]] Sent: 18 December 2001 22:56 To: Batik Users Subject: 1.1.1 transcoding Hi All, I created an application with version 1.0 and was forced (due to I think, a bug at the time) to create the XML, write to disk, then read from disk for transcoding files to jpeg format. I would like to call the transcoder with just the XML and not create any temporary files. Has anyone verified this works properly with 1.1.1? I think it is simply a matter of using: public void transcode(TranscoderInput input, TranscoderOutput output) and passing it a TranscoderInput using a Document as the argument instead of my current way which passes a URI as the constructor's argument. Can anyone verify this functionality? Thanks, Tony This Internet E-mail is intended solely for the person to whom it is addressed. It may contain confidential or privileged information. If you have received it in error please notify us immediately by telephone and destroy the transmission. You must not copy, distribute or take any action in reliance on it. Aerosystems International Phone: +44 (0)1935 443000 Fax : +44 (0)1935 443111 Web : www.aeroint.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]
Re: 1.1.1 transcoding
On Wednesday 19 December 2001 17:50, Anthony Shawver wrote: Thanks, David. However I still get the problem: Previously when transcoding, I used the new TranscoderInput(String URI) constructor for input, and everything works fine. My output stream size is about 5k in this instance. transcoder.transcode(new TranscoderInput(uri), new TranscoderOutput(ostream)); However, now I'm attempting to use the new TranscoderInput(Document doc) constructor for input, and I do not seem to get any image output. My output stream is 991 in this instance. transcoder.transcode(new TranscoderInput(document), new TranscoderOutput(ostream)); The rest of the code (including the TranscoderOutput) is identical. The only thing I can get from debugging it is the difference in output size. The only thing I have changed is the transcode method. I need to do this because performance in unacceptable the other way. Has anyone used the document version of transcode successfully? The following page on our website shows how to use the ImageTranscoder with a Document. http://xml.apache.org/batik/rasterizerTutorial.html --- Things to care about: a. Your Document must have been created using our DOMImplementation (see the documentation on the website). This is due to the fact that we need some special features that are *not* part of the standard DOM api. So the xerces (or others) DOM implementation can *not* be used. If you can not bootstrap your DOM using our DOMImplementation, you can use the DocumentWrapper class (package org.apache.batik.dom) that will wrap your SVG DOM subtree into another identical DOM subtree using our DOMImplementation (xerces - batik DOM for example). Then, the resulting tree can be sent to the transcoder. b. if your document uses external references (such as external use, image...), you must specify the URL of your document (ie. that will be used to find and load thoses external resources). You can do that using the ((SVGOMDocument)doc).setURLObject(url) Hpoe that helps, Thierry. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]