}
protected InlineArea getInlineArea() {
+ setup();
if(url == null) {
return null;
}
url = ImageFactory.getURL(url);
// if we need to load this image to get its size
- // FopImage fopimage = ImageFactory.getImage(url, userAgent);
+ ImageFactory fact = ImageFactory.getInstance();
+ FopImage fopimage = fact.getImage(url, userAgent);
// if(fopimage == null) {
// error
// }
return vp;
}
- public void setup() throws FOPException {
+ public void setup() {
// Common Accessibility Properties
AccessibilityProps mAccProps = propMgr.getAccessibilityProps();
// this.properties.get("overflow");
// this.properties.get("scaling");
// this.properties.get("scaling-method");
- // this.properties.get("src");
+ url = this.properties.get("src").getString();
// this.properties.get("text-align");
// this.properties.get("width");
}
this.imageInfo = info;
this.m_width = this.imageInfo.width;
this.m_height = this.imageInfo.height;
- loaded = loaded & DIMENSIONS;
+ loaded = loaded | DIMENSIONS;
}
public String getMimeType() {
if(!success) {
return false;
}
- loaded = loaded & DIMENSIONS;
+ loaded = loaded | DIMENSIONS;
}
if(((type & BITMAP) != 0) && ((loaded & BITMAP) == 0)) {
success = success && loadBitmap(ua);
if(success) {
- loaded = loaded & BITMAP;
+ loaded = loaded | BITMAP;
}
}
return success;
public int height;
public Object data;
public String mimeType;
+ public String str;
}
}
imgClassName = "org.apache.fop.image.JimiImage";
// imgClassName = "org.apache.fop.image.JAIImage";
} else if ("image/svg+xml".equals(imgMimeType)) {
- imgClassName = "org.apache.fop.image.SVGImage";
+ imgClassName = "org.apache.fop.image.XMLImage";
+ } else if ("text/xml".equals(imgMimeType)) {
+ imgClassName = "org.apache.fop.image.XMLImage";
}
if (imgClassName == null) {
log.error("Unsupported image type (" +
+++ /dev/null
-/*
- * $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
- * For details on use and redistribution please refer to the
- * LICENSE file included with these sources.
- */
-
-package org.apache.fop.image;
-
-// Java
-import java.net.URL;
-import org.w3c.dom.svg.SVGDocument;
-
-// FOP
-import org.apache.fop.apps.Driver;
-import org.apache.fop.image.analyser.ImageReader;
-import org.apache.fop.image.analyser.SVGReader;
-import org.apache.fop.fo.FOUserAgent;
-
-import org.apache.batik.dom.svg.SAXSVGDocumentFactory;
-
-/**
- * @see AbstractFopImage
- * @see FopImage
- */
-public class SVGImage extends AbstractFopImage {
- SVGDocument doc;
-
- public SVGImage(URL href, FopImage.ImageInfo imgInfo) {
- super(href, imgInfo);
- if(imgInfo.data instanceof SVGDocument) {
- doc = (SVGDocument)imgInfo.data;
- }
- }
-
- /**
- * creates a SAX parser, using the value of org.xml.sax.parser
- * defaulting to org.apache.xerces.parsers.SAXParser
- *
- * @return the created SAX parser
- */
- public static String getParserName() {
- String parserClassName = Driver.getParserClassName();
- return parserClassName;
- }
-
- protected boolean loadData(FOUserAgent ua) {
- try {
- SAXSVGDocumentFactory factory =
- new SAXSVGDocumentFactory(SVGImage.getParserName());
- doc = factory.createDocument(this.m_href.toExternalForm());
- } catch (Exception e) {
- ua.getLogger().error("Could not load external SVG: "
- + e.getMessage(), e);
- return false;
- }
- return true;
- }
-
- public SVGDocument getSVGDocument() {
- return doc;
- }
-
-}
--- /dev/null
+/*
+ * $Id$
+ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * For details on use and redistribution please refer to the
+ * LICENSE file included with these sources.
+ */
+
+package org.apache.fop.image;
+
+// Java
+import java.net.URL;
+import org.w3c.dom.Document;
+
+// FOP
+import org.apache.fop.apps.Driver;
+import org.apache.fop.image.analyser.ImageReader;
+import org.apache.fop.image.analyser.SVGReader;
+import org.apache.fop.fo.FOUserAgent;
+
+/**
+ * @see AbstractFopImage
+ * @see FopImage
+ */
+public class XMLImage extends AbstractFopImage {
+ Document doc;
+ String ns = "";
+
+ public XMLImage(URL href, FopImage.ImageInfo imgInfo) {
+ super(href, imgInfo);
+ if(imgInfo.data instanceof Document) {
+ doc = (Document)imgInfo.data;
+ }
+ ns = imgInfo.str;
+ }
+
+ /**
+ * creates a SAX parser, using the value of org.xml.sax.parser
+ * defaulting to org.apache.xerces.parsers.SAXParser
+ *
+ * @return the created SAX parser
+ */
+ public static String getParserName() {
+ String parserClassName = Driver.getParserClassName();
+ return parserClassName;
+ }
+
+ protected boolean loadData(FOUserAgent ua) {
+ return true;
+ }
+
+ public Document getDocument() {
+ return doc;
+ }
+
+ public String getNameSpace() {
+ return ns;
+ }
+}
formats.add(new PNGReader());
formats.add(new TIFFReader());
formats.add(new EPSReader());
+ // the xml parser through batik closes the stream when finished
+ // so there is a workaround in the SVGReader
formats.add(new SVGReader());
+ formats.add(new XMLReader());
};
// TODO - a way to add other readers
import org.w3c.dom.svg.SVGSVGElement;
// FOP
-import org.apache.fop.image.SVGImage;
+import org.apache.fop.image.XMLImage;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
import org.apache.batik.dom.svg.SVGDOMImplementation;
import java.io.File;
+import java.io.InputStream;
import java.net.URL;
import java.util.List;
import java.util.ArrayList;
* the SVGReader class.
*/
class Loader {
- private FopImage.ImageInfo getImage(String uri, BufferedInputStream fis,
+ private FopImage.ImageInfo getImage(String uri, InputStream fis,
FOUserAgent ua) {
// parse document and get the size attributes of the svg element
try {
+ int length = 5;
+ fis.mark(length);
+ byte[] b = new byte[length];
+ fis.read(b);
+ String start = new String(b);
+ fis.reset();
+
+ if(start.equals("<?xml")) {
+ // we have xml, might be another doc
+ // so stop batik from closing the stream
+ final InputStream input = fis;
+ fis = new InputStream() {
+ public int read() throws IOException {
+ return input.read();
+ }
+
+ public int read(byte[] b) throws IOException {
+ return input.read(b);
+ }
+
+ public int read(byte[] b, int off, int len) throws IOException {
+ return input.read(b, off, len);
+ }
+
+ public long skip(long n) throws IOException {
+ return input.skip(n);
+ }
+
+ public int available() throws IOException {
+ return input.available();
+ }
+
+ public void mark(int rl) {
+ input.mark(rl);
+ }
+
+ public boolean markSupported() {
+ return input.markSupported();
+ }
+
+ public void reset() throws IOException {
+ input.reset();
+ }
+
+ public void close() throws IOException {
+ }
+ };
+ }
+
FopImage.ImageInfo info = new FopImage.ImageInfo();
+
info.mimeType = getMimeType();
+ info.str = SVGDOMImplementation.SVG_NAMESPACE_URI;
- int length = fis.available();
- fis.mark(length);
+ length = fis.available();
+ fis.mark(length + 1);
SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory(
- SVGImage.getParserName());
+ XMLImage.getParserName());
SVGDocument doc = factory.createDocument(uri, fis);
info.data = doc;
return info;
} catch (NoClassDefFoundError ncdfe) {
+ try {
+ fis.reset();
+ } catch (IOException ioe) { }
batik = false;
//ua.getLogger().error("Batik not in class path", ncdfe);
return null;
--- /dev/null
+/*
+ * $Id$
+ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * For details on use and redistribution please refer to the
+ * LICENSE file included with these sources.
+ */
+
+package org.apache.fop.image.analyser;
+
+// Java
+import java.io.BufferedInputStream;
+import java.io.IOException;
+
+import org.xml.sax.InputSource;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.w3c.dom.*;
+import org.w3c.dom.DOMImplementation;
+
+import java.io.File;
+import java.net.URL;
+import java.util.HashMap;
+
+import org.apache.fop.image.FopImage;
+import org.apache.fop.fo.FOUserAgent;
+import org.apache.fop.image.XMLImage;
+
+/**
+ * ImageReader object for XML document image type.
+ */
+public class XMLReader implements ImageReader {
+ private static HashMap converters = new HashMap();
+
+ public static void setConverter(String ns, Converter conv) {
+ converters.put(ns, conv);
+ }
+
+ public XMLReader() {
+ }
+
+ public FopImage.ImageInfo verifySignature(String uri, BufferedInputStream fis,
+ FOUserAgent ua) throws IOException {
+ return loadImage(uri, fis, ua);
+ }
+
+ public String getMimeType() {
+ return "text/xml";
+ }
+
+ /**
+ * This means the external svg document will be loaded twice.
+ * Possibly need a slightly different design for the image stuff.
+ */
+ protected FopImage.ImageInfo loadImage(String uri, BufferedInputStream fis,
+ FOUserAgent ua) {
+ return createDocument(fis, ua);
+ }
+
+ public FopImage.ImageInfo createDocument(BufferedInputStream is, FOUserAgent ua) {
+ Document doc = null;
+ FopImage.ImageInfo info = new FopImage.ImageInfo();
+ info.mimeType = getMimeType();
+
+ try {
+ int length = is.available();
+ is.mark(length);
+
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ doc = dbf.newDocumentBuilder().parse(is);
+ info.data = doc;
+
+ Element root = doc.getDocumentElement();
+ ua.getLogger().debug("ns:" + root.getAttribute("xmlns"));
+ String ns = root.getAttribute("xmlns");
+ info.str = ns;
+
+ Converter conv = (Converter)converters.get(ns);
+ if(conv != null) {
+ FopImage.ImageInfo i = conv.convert(doc);
+ if(i != null) {
+ info = i;
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ try {
+ is.reset();
+ } catch (IOException ioe) { }
+ return null;
+ }
+ return info;
+ }
+
+ public static interface Converter {
+ public FopImage.ImageInfo convert(Document doc);
+ }
+}
+
// FOP
import org.apache.fop.render.PrintRenderer;
-import org.apache.fop.image.FopImage;
+import org.apache.fop.render.XMLHandler;
+import org.apache.fop.render.RendererContext;
+import org.apache.fop.fo.FOUserAgent;
+import org.apache.fop.image.*;
import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.properties.*;
import org.apache.fop.datatypes.*;
*
*/
public class PDFRenderer extends PrintRenderer {
+ public static final String mimeType = "application/pdf";
/**
* the PDF Document being created
producer = prod;
}
+ public void setUserAgent(FOUserAgent agent) {
+ super.setUserAgent(agent);
+ PDFXMLHandler xmlHandler = new PDFXMLHandler();
+ //userAgent.setDefaultXMLHandler(mimeType, xmlHandler);
+ String svg = "http://www.w3.org/2000/svg";
+ userAgent.addXMLHandler(mimeType, svg, xmlHandler);
+ }
+
public void startRenderer(OutputStream stream) throws IOException {
ostream = stream;
this.pdfDoc = new PDFDocument();
// multiply with current CTM
currentStream.add(ctm.toPDFctm() + " cm\n");
// Set clip?
+ currentStream.add("BT\n");
}
protected void endVParea() {
+ currentStream.add("ET\n");
currentStream.add("Q\n");
}
protected void renderRegion(RegionReference region) {
// Draw a rectangle so we can see it!
// x=0,y=0,w=ipd,h=bpd
- currentStream.add("BT\n");
super.renderRegion(region);
- currentStream.add("ET\n");
}
-
protected void renderLineArea(LineArea line) {
super.renderLineArea(line);
closeText();
pdf = pdf.append("/" + name + " " + (size / 1000) + " Tf\n");
}
}
+
+ public void renderImage(Image image) {
+ String url = image.getURL();
+ ImageFactory fact = ImageFactory.getInstance();
+ FopImage fopimage = fact.getImage(url, userAgent);
+ if(fopimage == null) {
+ return;
+ }
+ if(!fopimage.load(FopImage.DIMENSIONS, userAgent)) {
+ return;
+ }
+ String mime = fopimage.getMimeType();
+ if("text/xml".equals(mime)) {
+ if(!fopimage.load(FopImage.ORIGINAL_DATA, userAgent)) {
+ return;
+ }
+ Document doc = ((XMLImage)fopimage).getDocument();
+ String ns = ((XMLImage)fopimage).getNameSpace();
+
+ renderDocument(doc, ns);
+
+ } else if("image/svg+xml".equals(mime)) {
+ if(!fopimage.load(FopImage.ORIGINAL_DATA, userAgent)) {
+ return;
+ }
+ Document doc = ((XMLImage)fopimage).getDocument();
+ String ns = ((XMLImage)fopimage).getNameSpace();
+
+ renderDocument(doc, ns);
+
+ } else if("image/eps".equals(mime)) {
+ if(!fopimage.load(FopImage.ORIGINAL_DATA, userAgent)) {
+ return;
+ }
+ int xobj = pdfDoc.addImage(fopimage);
+ fact.releaseImage(url, userAgent);
+ } else if("image/jpg".equals(mime)) {
+ if(!fopimage.load(FopImage.ORIGINAL_DATA, userAgent)) {
+ return;
+ }
+ int xobj = pdfDoc.addImage(fopimage);
+ fact.releaseImage(url, userAgent);
+ } else {
+ if(!fopimage.load(FopImage.BITMAP, userAgent)) {
+ return;
+ }
+ int xobj = pdfDoc.addImage(fopimage);
+ fact.releaseImage(url, userAgent);
+
+ closeText();
+ int w = fopimage.getWidth();
+ int h = fopimage.getHeight();
+
+ currentStream.add("ET\nq\n" + ((float)w) + " 0 0 "
+ + ((float)-h) + " "
+ + (((float)currentBlockIPPosition) / 1000f) + " "
+ + (((float)(currentBPPosition - 1000 * h)) / 1000f) + " cm\n" + "/Im"
+ + xobj + " Do\nQ\nBT\n");
+ }
+
+ }
+
+ public void renderForeignObject(ForeignObject fo) {
+ Document doc = fo.getDocument();
+ String ns = fo.getNameSpace();
+ renderDocument(doc, ns);
+ }
+
+ public void renderDocument(Document doc, String ns) {
+ RendererContext context;
+ context = new RendererContext(mimeType);
+ context.setLogger(log);
+
+ context.setProperty(PDFXMLHandler.PDF_DOCUMENT, pdfDoc);
+ context.setProperty(PDFXMLHandler.PDF_STREAM, currentStream);
+ context.setProperty(PDFXMLHandler.PDF_X, new Integer(currentBlockIPPosition));
+ context.setProperty(PDFXMLHandler.PDF_Y, new Integer(currentBPPosition));
+ FontState fs = null;
+ try {
+ fs = new FontState(fontInfo, "Helvetica", "",
+ "", 12 * 1000, 0);
+ } catch (org.apache.fop.apps.FOPException fope) {
+ fope.printStackTrace();
+ }
+
+ context.setProperty(PDFXMLHandler.PDF_FONT_STATE, fs);
+ context.setProperty(PDFXMLHandler.PDF_FONT_NAME, currentFontName);
+ context.setProperty(PDFXMLHandler.PDF_FONT_SIZE, new Integer(currentFontSize));
+ context.setProperty(PDFXMLHandler.PDF_XPOS, new Integer(currentBlockIPPosition));
+ context.setProperty(PDFXMLHandler.PDF_YPOS, new Integer(currentBPPosition));
+ closeText();
+ currentStream.add("ET\n");
+ userAgent.renderXML(context, doc, ns);
+ currentStream.add("BT\n");
+
+ }
+
+ public void renderViewport(Viewport viewport) {
+ /*if (clip && w != 0 && h != 0) {
+ currentStream.add(x / 1000f + " " + y / 1000f + " m\n");
+ currentStream.add((x + w) / 1000f + " " + y / 1000f + " l\n");
+ currentStream.add((x + w) / 1000f + " " + (y - h) / 1000f
+ + " l\n");
+ currentStream.add(x / 1000f + " " + (y - h) / 1000f + " l\n");
+ currentStream.add("h\n");
+ currentStream.add("W\n");
+ currentStream.add("n\n");
+ }*/
+ super.renderViewport(viewport);
+ }
}
--- /dev/null
+/*
+ * $Id$
+ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * For details on use and redistribution please refer to the
+ * LICENSE file included with these sources.
+ */
+
+package org.apache.fop.render.pdf;
+
+import org.apache.fop.fo.FOUserAgent;
+import org.apache.fop.render.XMLHandler;
+import org.apache.fop.render.RendererContext;
+import org.apache.fop.pdf.*;
+import org.apache.fop.svg.*;
+import org.apache.fop.layout.FontState;
+
+import org.apache.log.Logger;
+
+import org.apache.batik.dom.util.DOMUtilities;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Attr;
+
+import java.io.Writer;
+import java.io.IOException;
+
+import org.apache.batik.bridge.*;
+import org.apache.batik.swing.svg.*;
+import org.apache.batik.swing.gvt.*;
+import org.apache.batik.gvt.*;
+import org.apache.batik.gvt.renderer.*;
+import org.apache.batik.gvt.filter.*;
+import org.apache.batik.gvt.event.*;
+
+import org.w3c.dom.*;
+import org.w3c.dom.svg.*;
+import org.w3c.dom.css.*;
+import org.w3c.dom.svg.SVGLength;
+
+import java.awt.geom.AffineTransform;
+
+/**
+ */
+public class PDFXMLHandler implements XMLHandler {
+public static final String PDF_DOCUMENT = "pdfDoc";
+public static final String PDF_STREAM = "pdfStream";
+public static final String PDF_X = "x";
+public static final String PDF_Y = "y";
+public static final String PDF_FONT_STATE = "fontState";
+public static final String PDF_FONT_NAME = "fontName";
+public static final String PDF_FONT_SIZE = "fontSize";
+public static final String PDF_XPOS = "xpos";
+public static final String PDF_YPOS = "ypos";
+
+ public PDFXMLHandler() {
+ }
+
+ public void handleXML(RendererContext context, Document doc,
+ String ns) throws Exception {
+ PDFDocument pdfDoc = (PDFDocument) context.getProperty(PDF_DOCUMENT);
+ PDFInfo pdfi = new PDFInfo();
+ pdfi.pdfDoc = (PDFDocument)context.getProperty(PDF_DOCUMENT);
+ pdfi.currentStream = (PDFStream)context.getProperty(PDF_STREAM);
+ pdfi.x = ((Integer)context.getProperty(PDF_X)).intValue();
+ pdfi.y = ((Integer)context.getProperty(PDF_Y)).intValue();
+ pdfi.fs = (FontState)context.getProperty(PDF_FONT_STATE);
+ pdfi.currentFontName = (String)context.getProperty(PDF_FONT_NAME);
+ pdfi.currentFontSize = ((Integer)context.getProperty(PDF_FONT_SIZE)).intValue();
+ pdfi.currentXPosition = ((Integer)context.getProperty(PDF_XPOS)).intValue();
+ pdfi.currentYPosition = ((Integer)context.getProperty(PDF_YPOS)).intValue();
+
+ String svg = "http://www.w3.org/2000/svg";
+ if (svg.equals(ns)) {
+ SVGHandler svghandler = new SVGHandler();
+ svghandler.renderSVGDocument(context, doc, pdfi);
+ } else {
+ }
+ }
+
+ class PDFInfo {
+ PDFDocument pdfDoc;
+ PDFStream currentStream;
+ int x;
+ int y;
+ FontState fs;
+ String currentFontName;
+ int currentFontSize;
+ int currentXPosition;
+ int currentYPosition;
+ }
+
+ protected class SVGHandler {
+ protected void renderSVGDocument(RendererContext context, Document doc, PDFInfo pdfInfo) {
+ float sx = 1, sy = 1;
+ int xOffset = pdfInfo.x, yOffset = pdfInfo.y;
+
+ org.apache.fop.svg.SVGUserAgent ua
+ = new org.apache.fop.svg.SVGUserAgent(new AffineTransform());
+ ua.setLogger(context.getLogger());
+
+ GVTBuilder builder = new GVTBuilder();
+ BridgeContext ctx = new BridgeContext(ua);
+ TextPainter textPainter = null;
+ textPainter = new PDFTextPainter(pdfInfo.fs);
+ ctx.setTextPainter(textPainter);
+
+ PDFAElementBridge aBridge = new PDFAElementBridge();
+ aBridge.setCurrentTransform(new AffineTransform(sx, 0, 0, sy, xOffset / 1000f, yOffset / 1000f));
+ ctx.putBridge(aBridge);
+
+ GraphicsNode root;
+ try {
+ root = builder.build(ctx, doc);
+ } catch (Exception e) {
+ context.getLogger().error("svg graphic could not be built: "
+ + e.getMessage(), e);
+ return;
+ }
+ // get the 'width' and 'height' attributes of the SVG document
+ float w = (float)ctx.getDocumentSize().getWidth() * 1000f;
+ float h = (float)ctx.getDocumentSize().getHeight() * 1000f;
+ ctx = null;
+ builder = null;
+
+ /*
+ * Clip to the svg area.
+ * Note: To have the svg overlay (under) a text area then use
+ * an fo:block-container
+ */
+ pdfInfo.currentStream.add("q\n");
+ // transform so that the coordinates (0,0) is from the top left
+ // and positive is down and to the right. (0,0) is where the
+ // viewBox puts it.
+ pdfInfo.currentStream.add(sx + " 0 0 " + sy + " " + xOffset / 1000f + " "
+ + yOffset / 1000f + " cm\n");
+
+ SVGSVGElement svg = ((SVGDocument)doc).getRootElement();
+ AffineTransform at = ViewBox.getPreserveAspectRatioTransform(svg, w / 1000f, h / 1000f);
+ if(!at.isIdentity()) {
+ double[] vals = new double[6];
+ at.getMatrix(vals);
+ pdfInfo.currentStream.add(PDFNumber.doubleOut(vals[0]) + " "
+ + PDFNumber.doubleOut(vals[1]) + " "
+ + PDFNumber.doubleOut(vals[2]) + " "
+ + PDFNumber.doubleOut(vals[3]) + " "
+ + PDFNumber.doubleOut(vals[4]) + " "
+ + PDFNumber.doubleOut(vals[5]) + " cm\n");
+ }
+
+ PDFGraphics2D graphics = new PDFGraphics2D(true, pdfInfo.fs, pdfInfo.pdfDoc,
+ pdfInfo.currentFontName,
+ pdfInfo.currentFontSize,
+ pdfInfo.currentXPosition,
+ pdfInfo.currentYPosition);
+ graphics.setGraphicContext(new org.apache.batik.ext.awt.g2d.GraphicContext());
+
+ try {
+ root.paint(graphics);
+ pdfInfo.currentStream.add(graphics.getString());
+ } catch (Exception e) {
+ context.getLogger().error("svg graphic could not be rendered: "
+ + e.getMessage(), e);
+ }
+
+ //currentAnnotList = graphics.getAnnotList();
+
+ pdfInfo.currentStream.add("Q\n");
+ }
+ }
+}
+
currentYPosition = ypos;
currentXPosition = xpos;
fontState = fs;
+ graphicsState = new PDFState();
}
protected PDFGraphics2D(boolean textAsShapes) {
import org.apache.batik.util.XMLResourceDescriptor;
import org.apache.batik.dom.svg.SVGDOMImplementation;
+import org.w3c.dom.DOMImplementation;
public class SVGElementMapping implements ElementMapping {
-
private static HashMap foObjs = null;
+ private static boolean batik = true;
private static synchronized void setupSVG() {
if (foObjs == null) {
}
public void addToBuilder(FOTreeBuilder builder) {
- try {
- setupSVG();
- String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
- builder.addMapping(svgNS, foObjs);
- } catch (Throwable t) {
- // if the classes are not available
+ if(batik) {
+ try {
+ setupSVG();
+ String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
+ builder.addMapping(svgNS, foObjs);
+ } catch (Throwable t) {
+ // if the classes are not available
+ // the DISPLAY is not checked
+ batik = false;
+ }
}
}