Title: problem(Bug ?) in Transcoder

Hi dear BATIK Team,

I am a student and I am using the 1.5 BETA 3 Version for a student project.

I try to transcode a SVG into a GIF or a JPEG.
The picture contains lines, rects,circles , text and paths (see code above)

Only the circles and the paths are transcoded into GIF/JPEG when I am using the transcoder package

Do I have to configure the Transcoder in a special way or does the XML code has to be in a special way ?

Thanks in advance for your help.

Kai Unewisse
University of Furtwangen, Germany



SVG Code :


<?xml version="1.0" encoding="UTF-8"?>
<svg contentScriptType="text/ecmascript" width="500" zoomAndPan="magnify" contentStyleType="text/css" height="500" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" version="1.0">

   <g stroke-width="2" stroke="black">
      <rect x="35" y="5" fill="#DCDCDC" width="460" height="460" stroke-width="1" />
      <line y2="465" stroke-width="2" x1="35" x2="35" y1="5" />
      <line y2="465" stroke-width="2" x1="35" x2="495" y1="465" />
   </g>

   <g font-size="30" fill="grey" font-family="Verdana" stroke="grey" font-weight="bold" stroke-width="2">
      <text x="230" y="230" text-anchor="middle">A text</text>
   </g>
   <g font-family="Verdana">
      <text x="267" font-size="14" y="490" font-family="Verdana" text-anchor="middle">Axisname</text>
      <text x="2" font-size="14" y="15" font-family="Verdana" text-anchor="start">1</text>
      <text x="2" font-size="14" y="450" font-family="Verdana" text-anchor="start">2</text>
      <text x="10" font-size="14" y="235" writing-mode="tb" text-anchor="middle" glyph-orientation-vertical="0">Axisname</text>

      <text x="35" font-size="14" y="485" font-family="Verdana" text-anchor="start">2</text>
      <text x="500" font-size="14" y="485" font-family="Verdana" text-anchor="end">1</text>
   </g>
   <path fill="#0000CD" d="M338,445 v-30 a30,30 0 0,1 0,60 z" stroke-width="1" stroke="#FFF8DC" />
   <circle fill="#0000CD" r="3" cx="440" cy="440" stroke="#191970" />
   <path fill="#FFD700" d="M138,245 v-30 a30,30 0 0,0 -6.5442972418962695,59.27750285816242 z" stroke="#DAA520" />
</svg>


Transcode Code :

    public void addAsJPEG(OutputStream ostream){
        JPEGTranscoder t = new JPEGTranscoder();
        t.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, new Float(1.0));
 
        try{
             TransformerFactory tFactory = TransformerFactory.newInstance();
            Transformer transformer = tFactory.newTransformer();

            StreamResult result = new StreamResult(ostream);
            DOMSource source = new DOMSource(doc);
            transformer.transform(source, result);
            ostream.flush();
        }
        catch (Exception tce)
        {
            System.out.println("Transformer ConfigurationException during transforming to Stream: " + tce.getMessage() );

        }
    
       
           
     }
   
    public boolean saveAsJPEG(String name) {
        JPEGTranscoder t = new JPEGTranscoder();
        t.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, new Float(1.0));
 
        try{
            OutputStream ostream = new FileOutputStream(name + ".jpg");    
            TranscoderOutput output = new TranscoderOutput(ostream);
            t.transcode(input, output);
            ostream.flush();
            ostream.close();
            return true;       
        }
        catch (Exception tce)
        {
            System.out.println("Transformer ConfigurationException during transforming to Stream: " + tce.getMessage() );

        }

EOM

NOTICE - This message and any attached files may contain information that is confidential and/or subject of legal privilege intended only for use by the intended recipient. If you are not the intended recipient or the person responsible for delivering the message to the intended recipient, be advised that you have received this message in error and that any dissemination, copying or use of this message or attachment is strictly forbidden, as is the disclosure of the information therein.  If you have received this message in error please notify the sender immediately and delete the message.

Reply via email to