[
https://issues.apache.org/jira/browse/BATIK-1051?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13753563#comment-13753563
]
Christoph Stichlberger edited comment on BATIK-1051 at 8/29/13 1:56 PM:
------------------------------------------------------------------------
I've got the same problem - and a workaround.
If you have the option use a own build of batik - commenting out this block in
org.apache.batik.bridge.SVGPatternElementBridge resolves the problem and the
svg renders as it should
if (!purl.complete())
throw new BridgeException(ctx, patternElement,
ERR_URI_MALFORMED,
new Object[] {uri});
Introducing this workaround can be done as follows
- create a patched version of SVGPatternElementBridge
- use the following code for transcoding (in this example with the
PNGTranscoder)
PNGTranscoder my_converter = new PNGTranscoder() {
//temporary workaround for
https://issues.apache.org/jira/browse/BATIK-1051
BridgeContext createBridgeContext(String svgVersion) {
if ("1.2".equals(svgVersion)) {
return new SVG12BridgeContext(userAgent){
public void registerSVGBridges() {
super.registerSVGBridges();
this.putBridge(new
SVGPatternElementBridgePatched());
}
};
} else {
return new BridgeContext(userAgent) {
public void registerSVGBridges() {
super.registerSVGBridges();
this.putBridge(new
SVGPatternElementBridgePatched());
}};
}
}
}
was (Author: cstichlberger):
I've got the same problem - and a workaround.
If you have the option use a own build of batik - commenting out this block in
org.apache.batik.bridge.SVGPatternElementBridge resolves the problem and the
svg renders as it should
if (!purl.complete())
throw new BridgeException(ctx, patternElement,
ERR_URI_MALFORMED,
new Object[] {uri});
> org.apache.batik.transcoder.TranscoderException then the element <pattern>
> has no children while exporting to PDF
> -----------------------------------------------------------------------------------------------------------------
>
> Key: BATIK-1051
> URL: https://issues.apache.org/jira/browse/BATIK-1051
> Project: Batik
> Issue Type: Bug
> Reporter: Alexey Dergunov
> Priority: Critical
>
> We export svg files to PDF. The code looks like this:
> http://pastebin.com/y0bZJMK7
> It seems that Batik cannot operate svg files with tags <pattern> without
> children.
> There are two svg-files:
> http://pastebin.com/Wd47nhCu - this one works fine
> http://pastebin.com/6yseBWmQ - and this one causes an exception
> org.apache.batik.transcoder.TranscoderException: null
> Enclosed Exception:
> null:-1
> The URI "#p1"
> specified on the element <pattern> is invalid
> at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown
> Source)
> at org.apache.fop.svg.PDFTranscoder.transcode(PDFTranscoder.java:193)
> at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown
> Source)
> at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown
> Source)
> According to W3C site (http://www.w3.org/TR/SVG/pservers.html#Patterns), "If
> this element has no children, and the referenced element does (possibly due
> to its own 'xlink:href' attribute), then this element inherits the children
> from the referenced element."
> Browsers (Chrome, Firefox, IE) show both svg files correctly, but Batik
> throws this exception while processing the second file.
> Additional info: exception occurs in class
> org.apache.batik.util.ParsedURLData, in method buildURL(), in the last line:
> return new URL(toString());
> Method toString() returns "#p1" in our case, and java.net.URL class doesn't
> want to consider it as correct URL.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]