Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Apache Batik - Question on editing SVG file and transform the graphics to other formats (e.g. JPG, PNG...)

Reply
Thread Tools

Apache Batik - Question on editing SVG file and transform the graphics to other formats (e.g. JPG, PNG...)

 
 
Brian K
Guest
Posts: n/a
 
      10-12-2003
I am new to Apache Batik and I am now doing a SVG Editor for my
project.

I use Java as programming language. I use Batik to generate the SVG
from Java Graphics2D, as I would like to transform the SVG to other
graphics formats (e.g. JPG, PNG, TIFF), an error occured, the error is
that the graphics don't specify the size of graphics, so that even I
can transform to JPG (for example), but the JPG file cannot display
any graphics. Then I edit the SVG source code (XML) manually to
specify the width and height, it's work. Then I program the code to
edit the XML, SVG source code, then there is a problem. The way I used
is read the XML file by using java.io then pass to a stringbuffer to
edit, but it's so strange that the java.io skip some line of SVG
source code. The original source code are shown as following:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.0//EN'
'http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd'>
<svg xmlnslink="http://www.w3.org/1999/xlink" style="fill-opacity:1;
color-rendering:auto; color-interpolation:auto; stroke:black;
text-rendering:auto; stroke-linecap:square; stroke-miterlimit:10;
shape-rendering:auto; stroke-opacity:1; fill:black;
stroke-dasharray:none; font-weight:normal; stroke-width:1;
font-family:&apos;sansserif&apos;; font-style:normal;
stroke-linejoin:miter; font-size:12; stroke-dashoffset:0;
image-rendering:auto;" xmlns="http://www.w3.org/2000/svg">
<!--Generated by the Batik Graphics2D SVG Generator-->
<defs id="genericDefs" />
<g>
<g style="fill:blue; stroke:blue;">
<circle r="50" style="stroke:none;" cx="60" cy="60" />
</g>
</g>
</svg>

The lines skip are:
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.0//EN'
'http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd'>

<!--Generated by the Batik Graphics2D SVG Generator-->

As the last one is comment, then it's not problem, but I think that
the reason that cannot transform to JPG is that the java.io skip the
line of <?xml...> and <!DOCTYPE svg...>

Usually the java.io ignore the syntax of the text, then what's
happened so that it skipped the line?

Or if there any method or class in Batik can be used to edit the SVG
source code by programming?

Please reply to me though email: http://www.velocityreviews.com/forums/(E-Mail Removed)

Thanks for answering the question! : )
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
editing svg in batik problem milof83 Java 0 08-18-2006 10:20 AM
batik svg editing problem milof83@gazeta.pl Java 0 08-18-2006 10:18 AM
[SVG] probleme dessin d'images SVG avec Batik Mardagg Java 0 05-12-2006 02:13 PM
[SVG] problem with SVG image drawing with Batik Library Mardagg Java 0 05-12-2006 02:12 PM
Apache Batik - Question on editing SVG file and transform the graphics to other formats (e.g. JPG, PNG...) Brian K Java 0 10-12-2003 03:44 PM



Advertisments