File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes Making EPS (or whatever) into SVG Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Making EPS (or whatever) into SVG" Watch "Making EPS (or whatever) into SVG" New topic

Making EPS (or whatever) into SVG

Tim Berglund

Joined: Sep 28, 2000
Posts: 13
I am creating FOP documents that are to contain line drawings. The right way to do this, I am told, is to use the Scalable Vector Graphics (SVG) format. (As an aside, I am using all of the Apache Stuff for XML parsing and FOP rendering.)
Now, SVG is a well-documented, XML-based means of describing scalable graphics, and a guy could write his own XML/SVG documents to create the appropriate line drawings, but sheesh, that sounds tedious. Especially if he already had then in Adobe Illustrator format.
The question: does anybody know of an EPS-to-SVG conversion utility? It sounds like a slam-dunk kind of thing that someone ought to have written. If anybody knows of a converter that require input files in something other than EPS, that might do as well.
Thanks in advance.
P.S. Note: I haven't conducted an exhaustive web search for this thing; I'm just trying to see if anybody already knows of one. So nobody go spending any time looking! I'll do that myself if nobody knows of anything around here.
Tim Berglund

Joined: Sep 28, 2000
Posts: 13
Apparently, you're supposed to actually *read* the applicable W3C pages on SVG. (You don't say?)
There is a wealth of information on this topic here at the W3C site. Moreover, a Windows Metafile-to-SVG converter can be had on the web here. The Java source to a command-line version is available at the Blackdirt site.
Hope this is useful to someone. I'm digging it.
[This message has been edited by Tim Berglund (edited November 13, 2000).]
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
Well I'm interested. I have an upcoming project with which I plan to use FOP and SVG, so it's nice to know you've got it all working.

Read about me at ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Tim Berglund

Joined: Sep 28, 2000
Posts: 13
An important distinction: I don't quite have it all working yet. That is, I'm not programmatically generating FO trees (including way-slick SVG graphics) and rendering them into PDFs just yet. I have merely cracked the something-to-SVG conversion nut at this point.
I'll post here when I've got it all going. This effort is a low-priority background task that keeps getting preempted by other things, so it could literally take longer than deciding the current Presidential election. We'll see.
Tim Berglund

Joined: Sep 28, 2000
Posts: 13
As I warned, I have been on and off this project over the past six weeks. Here is a brief update:
The Blackdirt product proved unsuitable. It was unable to convert the WMF files generated by Adobe Illustrator 7.0.
Mayura Draw is a nice shareware package that does a nice job with conversions between EPS, WMF, PDF, Illustrator 7.0, and SVG files. It would have done the trick for me if I had been able to get a decent WMF out of Illustrator. Interestingly, I found that Illustrator 7.0 appeared to have a lithium tremor or something when rendering certain certain curves. There were unacceptably flat and in some cases just plain wrong. WMF is not its strong suit.
Illustrator 9.0 provides for direct export to SVG. This works well, at least with Adobe's SVG viewer plug-in for Internet Explorer. I haven't tried viewing the files anywhere else, assuming that they are indeed well-formed.
Apache FOP 0.15 (it was 0.14 when I started this) has a problem of some kind with the moderately complex SVG files I am now giving it. I can successfully render a PDF with text, tables, and a very simple SVG file, but things fall apart with my production images. I will be submitting example files to the FOP-DEV Apache list in the next day or two. There were very responsive on two other questions I had, so my hopes are high. Still, if FOP doesn't pan out, I may be forced to write my own PDF generation code.
This project is getting tabled again for about a month, so I probably won't have much to say until then. If you're doing similar work and you have a suggestion for me, or you have a question you think I might be able to help with, feel free to ask.
[This message has been edited by Tim Berglund (edited December 19, 2000).]
Swapan Golla
Ranch Hand

Joined: May 31, 2000
Posts: 32
Adobe Illustrator 10 can save the eps files to svg format directly. It was not available in previous Illustrator versions. Also, somehow, I couldn't get my images working in 0.20 FOP version as it was saying about corrupt JPEG. I am pasting my exception here. Let me know if anybody has an idea on this. I am just using save as option on the illustrator 10 and running this svg image through FOP processor.
[1]Corrupt JPEG data: 107 extraneous bytes before marker 0xc0
com.sun.image.codec.jpeg.ImageFormatException: Bogus DHT counts
at sun.awt.image.codec.JPEGImageDecoderImpl.readJPEGStream(Native Method)
at sun.awt.image.codec.JPEGImageDecoderImpl.decodeAsBufferedImage(
at org.apache.batik.ext.awt.image.spi.JPEGRegistryEntry$
Thanks in Advance,
I agree. Here's the link:
subject: Making EPS (or whatever) into SVG
It's not a secret anymore!