[
https://issues.apache.org/jira/browse/FOP-2972?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18068016#comment-18068016
]
Joao Goncalves edited comment on FOP-2972 at 3/24/26 5:45 PM:
--------------------------------------------------------------
[[email protected]] the width and height are set on the svg as well:
{code:java}
<svg xmlns="http://www.w3.org/2000/svg" width="12cm" height="12cm"> {code}
I missed the auto on the fo:external-graphic, hence why I closed the ticket,
because I was able to fix the issue with minor changes to the SVG.
-I'll have a look at this whenever I'm able to. I'll reopen it now.-
I had the chance of looking into this further, and I still think FOP does not
have an issue. FOP is using the dimensions given by the SVG and using that to
determine how much space to give the image. I do believe the problem lies with
the fact that FOP uses by default 72dpi as a resolution, while most browsers
use 96dpi. When I set the _source-resolution_ conf to 96dpi, I no longer see
the clipping on the side.
I've attached a PDF and a slightly altered SVG. The PDF was generated using the
changed conf I mentioned above. If you open both the PDF and the SVG, you are
able to see that they look similar.
was (Author: JIRAUSER302961):
[[email protected]] the width and height are set on the svg as well:
{code:java}
<svg xmlns="http://www.w3.org/2000/svg" width="12cm" height="12cm"> {code}
I missed the auto on the fo:external-graphic, hence why I closed the ticket
because I was able to fix the issue with minor changes to the svg.
I'll have a look at this whenever I'm able to. I'll reopen it now.
> 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
> Assignee: Joao Goncalves
> 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)