[jira] [Commented] (FOP-2972) Incorrectly trim edges of svg figure when using 'auto'
"Joao Goncalves (Jira)" <[email protected]> Fri, 1 May 2026 14:50:00 +0000 (UTC)
| Newsgroups | gmane.text.xml.fop.devel |
|---|---|
| Message-ID | <[email protected]> |
[ https://issues.apache.org/jira/browse/FOP-2972?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18077664#comment-18077664 ]
Joao Goncalves commented on FOP-2972:
-------------------------------------
My solution allows you to set the DPI to whatever value you need, thus working with any SVG. Even if I were to change the default DPI value, it doesn't mean it won't cause issues elsewhere. There are different defaults for DPI values, and for FOP it was set to 72dpi long ago, with the ability to change it to match anyone's needs. The conf can be adapted for each example as well, depending on your needs.
I'm not trying to convince anyone to change their policies; I'm just saying that, if anyone wants to use FOP, they can change the source-resolution conf to match their needs.
> Incorrectly trim edges of svg figure when using 'auto'
> ------------------------------------------------------
>
> Key: FOP-2972
> URL: https://issues.apache.org/jira/browse/FOP-2972
> Project: FOP
> Issue Type: Bug
> Components: image/svg
> Affects Versions: 2.3
> Environment: Debian Buster
> Reporter: Petter Reinholdtsen
> Priority: Major
> Labels: Debian
> Attachments: circles.svg, table14.pdf
>
>
> When using docbook to create a document with a SVG figure, the figure left and right edges are clipped. The following script demonstrate the problem. This problem was first reported to the docbook xslt project as issue #212.
> ```
> #!/bin/sh
> cat > circles.svg <<EOF
> <?xml version="1.0"?>
> <!-- from [http://www.sagehill.net/docbookxsl/SVGimages.html] -->
> <svg xmlns="http://www.w3.org/2000/svg" width="12cm" height="12cm">
> <g style="fill-opacity:0.7; stroke:black; stroke-width:0.1cm;">
> <circle cx="6cm" cy="2cm" r="100" style="fill:red;"
> transform="translate(0,50)" />
> <circle cx="6cm" cy="2cm" r="100" style="fill:blue;"
> transform="translate(70,150)" />
> <circle cx="6cm" cy="2cm" r="100" style="fill:green;"
> transform="translate(-70,150)"/>
> </g>
> </svg>
> EOF
> cat > test.xml <<EOF
> <?xml version='1.0' encoding='UTF-8' ?>
> <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
> "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
> <book lang="en">
> <title>...</title>
> <chapter>
> <title>...</title>
> <para>...</para>
> <figure id="figure">
> <title>A set of circles, should be perfectly round</title>
> <mediaobject>
> <imageobject>
> <imagedata fileref="circles.svg"/>
> </imageobject>
> <textobject>
> <phrase>With fop the left and right edges are flat</phrase>
> </textobject>
> </mediaobject>
> </figure>
> </chapter>
> </book>
> EOF
> xsltproc --output test.fo /usr/share/xml/docbook/stylesheet/docbook-xsl/fo/docbook.xsl test.xml
> fop -fo test.fo -pdf test.pdf
> ```
>
> See the docbook bug report above for an example rendering with the flat edges of the circles.
> The relevant FO output look like this:
> ```
> <fo:block id="d0e12">
> <fo:external-graphic src="url(circles.svg)"
> width="auto"
> height="auto"
> content-width="auto"
> content-height="auto" />
> </fo:block>
> ```
--
This message was sent by Atlassian Jira
(v8.20.10#820010)