473,382 Members | 1,665 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

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

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 xmlns:xlink="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: br*********@hotmail.com

Thanks for answering the question! : )
Jul 20 '05 #1
0 2070

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Gemmel | last post by:
Hi, im using batik to draw several rectangles via graphics2D. now i would like to add a link to another html or svg document to the rectangle. if the user clicks on the rectangle, the other...
2
by: Subodh | last post by:
Hi, Currently we get data from more then 200 different sources and all of our vendors provide data in different file formats. The problem is we have more then 100 DTS packages now and the...
1
by: pratyush.aditya | last post by:
hi, can anybody tell me what are the steps and procedures that are to be taken for video editing like frame extraction etc from avi,mpeg files using C programming.
0
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
2
by: Valerian John | last post by:
Hello: In ASP.NET, how can one get the properties (length of audio clip, length of video clip, dimensions of gif or jpg, etc.) for any given file? I am primarily interested in media files. One...
0
by: FrankV | last post by:
I am not a developer but am looking for a .NET control to allow users to upload and crop graphics files from a web page. I need to be able to transform the following file formats. eps, jpg, tif,...
12
by: Xah Lee | last post by:
Of Interest: Introduction to 3D Graphics Programing http://xahlee.org/3d/index.html Currently, this introduction introduces you to the graphics format of Mathematica, and two Java Applet...
7
by: JoeC | last post by:
I am trying to create a windows program that reads binary graphics as a resource. This has nothing to do with win32 but conversion of data with memcpy. graphic::graphic(UINT uiResID, HINSTANCE...
10
by: happyse27 | last post by:
Hi All, I got this apache errors(see section A1 and A2 below) when I used a html(see section b below) to activate acctman.pl(see section c below). Section D below is part of the configuration...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.