Re: Inlining SVG's not working on Unix Server but External SVG's ok

[email protected]
Newsgroups gmane.text.xml.fop.user
Message-ID <[email protected]>
Hi Matt,

we have a Stone Age Linux, but the rest is fairly up-to-date:

SUSE Linux Enterprise Server 11.1 (x86_64)2.6.32.46-0.3-default

openjdkversion "17" 2021-09-14
OpenJDKRuntime Environment (build 17+35-2724)
OpenJDK64-Bit Server VM (build 17+35-2724, mixed mode, sharing)

Apache FOP v2.6

As suggested on
https://xmlgraphics.apache.org/fop/trunk/graphics.html
I did start the server with...
-Djava.awt.headless=true
...without really knowing what that does, but it made no difference.

I wonder whether the headless remarks are historical in nature
& not relevant for current Batik releases?
(we are using the current Batik v1.14)

I also went to great lengths to reproduce the exact same Classpath order 
under Windows,
defining each Library individually & using a comparable JDK with Eclipse 
2021-09:
openjdkversion "17.0.1" 2021-10-19 LTS
OpenJDKRuntime Environment Zulu17.30+15-CA (build 17.0.1+12-LTS)
OpenJDK64-Bit Server VM Zulu17.30+15-CA (build 17.0.1+12-LTS, mixed 
mode, sharing)

What doesn't make sense to me is how FOP managed to render the external SVG
but inlining it, the SVG Graphic was not rendered.
(from the trace it looked like it was doing some SVG rendering)

Surely, if it can render an external SVG, it must be able to render an 
inline one?!

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, <[email protected]> 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 <http://www.claritum.com>
>
> Claritum Limited. Registered Office: 37 Great Pulteney Street, Bath, 
> BA2 4DA  Registered in England and Wales 3878694
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.