SVG files not scaling properly in PDF publishing

Post here questions and problems related to editing and publishing DITA content.
lkollar
Posts: 6
Joined: Fri Aug 04, 2017 5:51 pm

SVG files not scaling properly in PDF publishing

Post by lkollar »

We have a set of documents that use SVG files to overlay callouts onto screen shots. The screen shots are PNG format, embedded in the SVG.

Opened in Inkscape, Oxygen (19.1), Chrome, or Firefox, the SVG file looks right. Callouts are positioned properly.

Published to PDF, the callouts and screenshots get scaled differently, so the overall piece looks wrong.

This is probably a FOP issue, but any ideas about how to fix it are appreciated.
Dan
Posts: 501
Joined: Mon Feb 03, 2003 10:56 am

Re: SVG files not scaling properly in PDF publishing

Post by Dan »

What scenario are you using to transform your documents? Your SVGs have information about their size? A small sample would be good to determine the fix.

Many regards,
Dan
lkollar
Posts: 6
Joined: Fri Aug 04, 2017 5:51 pm

Re: SVG files not scaling properly in PDF publishing

Post by lkollar »

Thanks for the reply, Dan.
What scenario are you using to transform your documents?
Using DITA-OT 2.5.4 with a custom PDF plugin. We get the same results from both Oxygen and Astoria (our CMS).
Your SVGs have information about their size?
Yes. Here's the code for one, eliding the big wad of Base64-encoded bitmap. As I said, they look fine anywhere but in the PDF.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:stl="http://stilo.com/migrate" version="1.1" width="674.64567" height="280.62992">
<style type="text/css">

.CR-CalloutFR-ABEC6709 {
line-height: 8pt;
font-name: Open Sans;
font-size: 8pt;
}
</style>
<g>
<image id="ID4-503"
xlink:href="data:image/png;base64, **70K worth**
"
width="14.526cm" height="6.906cm" x="110.96693" y="12.32126"/>
<text x="12.01890" y="69.78268" class="CR-CalloutFR-ABEC6709">
<tspan font-size="8pt">XML Config </tspan>
</text>
<text x="12.01890" y="85.78268" font-size="8pt" class="CR-CalloutFR-ABEC6709">Files panel</text>
<text x="12.01890" y="152.44094" class="CR-CalloutFR-ABEC6709">
<tspan font-size="8pt">Component </tspan>
</text>
<text x="12.01890" y="168.44094" font-size="8pt" class="CR-CalloutFR-ABEC6709">tree</text>
<text x="0.00000" y="221.08976" class="CR-CalloutFR-ABEC6709">
<tspan font-size="8pt">Configuration </tspan>
</text>
<text x="0.00000" y="237.08976" font-size="8pt" class="CR-CalloutFR-ABEC6709">File</text>
<line fill-opacity="0" stroke="blue" stroke-width="1.0pt" x1="84.01890" y1="69.31654" x2="108.01890" y2="69.31654"/>
<line fill="none" stroke="blue" stroke-width="1.0pt" x1="84.01890" y1="153.33543" x2="120.00000" y2="153.33543"/>
<line fill="none" stroke="blue" stroke-width="1.0pt" x1="84.01890" y1="225.33543" x2="252.01890" y2="225.33543"/>
</g>
</svg>
lkollar
Posts: 6
Joined: Fri Aug 04, 2017 5:51 pm

Re: SVG files not scaling properly in PDF publishing

Post by lkollar »

Hm. That last post got stuck in Moderator Limbo.

Replacing the embedded PNG file with the original BMP fixed the problem. I'm not sure if the converter (ImageMagick) introduced a problem (invisible to everything but the publishing part, mind you), or if FOP (or PDF) just prefers to work with uncompressed images when embedded.

I still want to get to the bottom of this, but at least now I have a way forward.
Post Reply