[prev in list] [next in list] [prev in thread] [next in thread]
List: batik-users
Subject: Wrapping a string or image in an <a href>
From: etem <cavenier17 () yahoo ! co ! uk>
Date: 2008-08-31 3:10:36
Message-ID: 19234883.post () talk ! nabble ! com
[Download RAW message or body]
Hello!
I'm using the Batik SVG Generator to render some custom components to a .svg
file. This is excellent and wonderful. However, I would like to put some < a
href > links in the SVG file, and I absolutely cannot figure out how. Can
anyone lend a hand?
Here's what I'm using up top :
DOMImplementation domImpl = GenericDOMImplementation.getDOMImplementation();
Document document = domImpl.createDocument(svgNS, "svg", null);
SVGGeneratorContext ctx = SVGGeneratorContext.createDefault(document);
GenericImageHandler ihandler = new CachedImageHandlerBase64Encoder();
ctx.setGenericImageHandler(ihandler);
SVGGraphics2D svgGenerator = new SVGGraphics2D(ctx, false);
v.paint(svgGenerator);
boolean useCSS = true;
Writer out = new OutputStreamWriter(new FileOutputStream("E:/grrarg.svg"),
"UTF-8");
svgGenerator.stream(out, useCSS);
... which is patched together from the examples on the Batik homepage.
Here's my paint()...
public void paintComponent(Graphics g)
{
...
Graphics2D g2d = (Graphics2D)g;
SVGGraphics2D svg2d = null;
if (g instanceof SVGGraphics2D) svg2d = (SVGGraphics2D)g;
g2d.setBackground(Color.RED);
g2d.clearRect(0,0, getWidth(), getHeight());
g2d.drawString(blah, x, y);
...
}
I'd like to wrap the (for a start, at least), the drawString in an < a href
> , and specify where that link goes.
I've searched batik-users, and I've tried all manner of incantations -
usually variants of createElementNS, and getRoot - but either the resulting
.svg is unchanged, or it's truncated to the header.
Can anyone point me in the right direction, or to some good examples?
Thanks,
--
View this message in context: \
http://www.nabble.com/Wrapping-a-string-or-image-in-an-%3Ca-href%3E-tp19234883p19234883.html
Sent from the Batik - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic