You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Ilya Frank <if...@tomsawyer.com> on 2001/07/24 03:05:46 UTC
Problem viewing BATIK-generated files with Adobe Viewer 2.0
Hi everybody,
I am having problems viewing files generated by BATIK with new Adobe Viewer
2.0. They work fine with 1.0
The files get saved, and they look ok in Microsoft Word, but the viewer
always shows blank white screen when it tries to read them.
Steps to reproduce:
Install Adobe Viewer 2.0 from
http://www.adobe.com/svg/viewer/install/main.html
Run this program: Note, that this program is copy and pasted from BATIK
homepage at http://xml.apache.org/batik/svggen.html The only difference is
that the result is written to a file called test.svg instead of System.out
import java.awt.Rectangle;
import java.awt.Graphics2D;
import java.awt.Color;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.IOException;
import org.apache.batik.svggen.SVGGraphics2D;
import org.apache.batik.dom.GenericDOMImplementation;
import org.w3c.dom.Document;
import org.w3c.dom.DOMImplementation;
import java.io.*;
public class TestSVGGen {
public void paint(Graphics2D g2d) {
g2d.setPaint(Color.red);
g2d.fill(new Rectangle(10, 10, 100, 100));
}
public static void main(String [] args) throws IOException {
// Get a DOMImplementation
DOMImplementation domImpl =
GenericDOMImplementation.getDOMImplementation();
// Create an instance of org.w3c.dom.Document
Document document = domImpl.createDocument(null, "svg", null);
// Create an instance of the SVG Generator
SVGGraphics2D svgGenerator = new SVGGraphics2D(document);
// Ask the test to render into the SVG Graphics2D implementation
TestSVGGen test = new TestSVGGen();
test.paint(svgGenerator);
// Finally, stream out SVG to the standard output using UTF-8
// character to byte encoding
boolean useCSS = true; // we want to use CSS style attribute
Writer out = new OutputStreamWriter(new FileOutputStream(new
File("test.svg")), "UTF-8");
svgGenerator.stream(out, useCSS);
}
}
Result: test.svg gets generated but when you try to view it you see only a
white screen.
Does anyone have a fix/workaround for this?
Thanks a lot.
Ilya Frank
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org