Sorry Dave, been snowed under for the last few days.

Looking at the debug output for the embedded SVG, you've got an empty xmlns
declaration on the "g" element:

<g xmlns="" style="fill-opacity:0;stroke-width:2;stroke:black">

If I remove that it renders the FO just fine.

HTH

Matt


On Sat, 29 Jan 2022 at 09:00, <xmlgraphics.d...@apconsult.de> wrote:

> Matt,
>
> could you maybe share a Stylesheet (or excerpt) with a working inline SVG?
>
> All the best,
> Dave
>
>
> On 28/01/2022 14:04, Matt Kynaston wrote:
>
> We render inline SVGs on linux (RHEL7 atm) all the time, without needing
> to install anything special - although it does pull in a "headless" version
> of openjdk.
>
> Which linux? Which java? Which version of FOP?
>
> Matt
>
> On Sun, 23 Jan 2022 at 14:01, <xmlgraphics.d...@apconsult.de> wrote:
>
>> Hi there,
>>
>> we are using Apache FOP to generate PDF's & have an issue with SVG's.
>>
>> To include an SVG we're using something like the following...
>>
>> <fo:block>
>>     <fo:external-graphic  src="classpath:image/MyImage.svg"  
>> content-width="150mm"/></fo:block>
>>
>> The above works fine in all environments.
>>
>> Now I'm trying to inline an SVG in the Stylesheet, like this...
>>
>> <fo:block>
>>     <fo:instream-foreign-object content-width="272.6mm">
>>         <svg xmlns="http://www.w3.org/2000/svg"; <http://www.w3.org/2000/svg> 
>> width="780" height="120" viewBox="0 0 780 120">
>>             <g style="fill-opacity:0;stroke-width:2;stroke:black">
>>                 <rect x="2"    y="2"   width="254"  height="99"/>
>>                 <rect x="256"  y="2"   width="485"  height="99"/>
>>             </g>
>>         </svg>
>>     </fo:instream-foreign-object></fo:block>
>>
>> That works OK under Windows, but when deployed on our Linux Server, seems
>> to do nothing.
>>
>> I have read some comments on the Apache FOP Website about it using Apache
>> Batik to render SVG's
>> and that this requires a Graphical Environment, so will not work in many
>> Unix configurations.
>>
>> What I don't understand is, how come the external SVG is working ok on
>> the Unix Server & inline is not?
>>
>> Also, the Apache FOP Website recommends a Tool called PJA toolkit
>> <https://www.eteks.com/pja/en/> to workaround this issue,
>> but it looks very dated, so I wonder if its going to work with our JDK 17?
>> (and indeed its developer, Emmanuel Puybaret, is quite surprised anyone
>> would still be recommending use of this tool)
>>
>> I would be grateful if anyone has some Info about this.
>>
>> All the best,
>> Dave
>>
>
>
> --
>
>
> Matt Kynaston
> Lead Developer
> Tel: +441225851666
> www.claritum.com
>
> Claritum Limited. Registered Office: 37 Great Pulteney Street, Bath, BA2
> 4DA  Registered in England and Wales 3878694
>
>
>

-- 


Matt Kynaston
Lead Developer
Tel: +441225851666
www.claritum.com

Claritum Limited. Registered Office: 37 Great Pulteney Street, Bath, BA2
4DA  Registered in England and Wales 3878694

Reply via email to