2011-09-26 22 views
0

圖像被斬去當我試圖SVG文件轉換爲使用org.apache.batik.apps.rasterizer.SVGConverter png圖片。的Java代碼如下。圖像被斬去,同時使用SVG轉換器

SVGConverter svgConverter = new SVGConverter(); 
svgConverter.setDestinationType(DestinationType.PNG); 
svgConverter.setSources(new String[]{ new File(svgsource).toURL().toString() }); 
svgConverter.setDst(new File(imgDest)); 
svgConverter.execute(); 

另請參閱SVG文件的代碼。

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> 
<line x1="10" y1="0" x2="10" y2="500" style="stroke: #000000; stroke-width: 1;" /> 
<line x1="10" y1="500" x2="500" y2="500" style="stroke: #000000; stroke-width: 1;" /> 

<text x="0" y="520" style="stroke: none; fill: #000000; font-family: Arial; font-size: 10px;" >3PA</text> 
<line x1="100" y1="0" x2="100" y2="500" style="stroke: darkgray; stroke-width: 0.2" /> 
<text x="100" y="520" style="stroke: none; fill: #000000; font-family: Arial; font-size: 10px;" >3PB</text> 
<line x1="200" y1="0" x2="200" y2="500" style="stroke: darkgray; stroke-width: 0.2" /> 
<text x="200" y="520" style="stroke: none; fill: #000000; font-family: Arial; font-size: 10px;" >3PC</text> 
<line x1="300" y1="0" x2="300" y2="500" style="stroke: darkgray; stroke-width: 0.2" /> 
<text x="300" y="520" style="stroke: none; fill: #000000; font-family: Arial; font-size: 10px;" >4PA</text> 
<line x1="400" y1="0" x2="400" y2="500" style="stroke: darkgray; stroke-width: 0.2" /> 
<text x="400" y="520" style="stroke: none; fill: #000000; font-family: Arial; font-size: 10px;" >4PB</text> 

<line x1="10" y1="100" x2="500" y2="100" style="stroke: darkgray; stroke-width: 0.2" /> 
<line x1="10" y1="200" x2="500" y2="200" style="stroke: darkgray; stroke-width: 0.2" /> 
<line x1="10" y1="300" x2="500" y2="300" style="stroke: darkgray; stroke-width: 0.2" /> 
<line x1="10" y1="400" x2="500" y2="400" style="stroke: darkgray; stroke-width: 0.2" /> 


<line x1="10" y1="450" x2="100" y2="450" 
     style="stroke:yellow; stroke-width:5; stroke-linejoin:miter" /> 


<line x1="100" y1="450" x2="200" y2="330" 
     style="stroke:yellow; stroke-width:5; stroke-linejoin:miter" /> 


<line x1="200" y1="330" x2="300" y2="380" 
     style="stroke:yellow; stroke-width:5; stroke-linejoin:miter" /> 



<polygon points="300,380 400,320 400,360 300,380" 
    style="fill:paleturquoise; stroke: darkturquoise; stroke-width:1" /> 


<line x1="100" y1="420" x2="100" y2="460" 
    style="fill:darkturquoise; stroke: darkturquoise; stroke-width:7" /> 


<line x1="200" y1="340" x2="200" y2="380" 
     style="stroke:darkturquoise; stroke: darkturquoise; stroke-width:7" /> 

<line x1="300" y1="310" x2="300" y2="350" 
     style="stroke:darkturquoise; stroke: darkturquoise; stroke-width:7" /> 


<line x1="400" y1="320" x2="400" y2="360" 
     style="stroke:darkturquoise; stroke: darkturquoise; stroke-width:7" /> 


<text x="400" y="320" style="stroke: none; fill: #000000; font-family: Arial; font-size: 10px;" >320</text> 
<text x="400" y="360" style="stroke: none; fill: #000000; font-family: Arial; font-size: 10px;" >360</text> 




</svg> 

請還可以找到在線編輯圖像是由Java代碼enter image description here產生Online_Editor_image.JPG和PNG文件。

請幫我得到完整的圖像在線圖像編輯器。

回答

0

提到像

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="600" height="600">

在SVG標籤的高度和寬度