HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML v3 Archived Forums (Read Only) › HTML/CSS rendering issues › Batik implementation
- This topic has 4 replies, 3 voices, and was last updated Jul 01, 2019
09:13:25 by swati.
-
AuthorPosts
-
June 18, 2019 at 13:56#27216
Hi there,
We’re currently using PD4ML v4, and are having a little trouble getting Batik working as an external renderer in Java. On the GitHub page it states “PD4ML provides a way to plug Batik, JEuclid or another library and to associate it with a particular or custom tag (<svg>, <math>, <etc>)”.
What are the steps required to “plug Batik” into PD4ML? We have the PD4ML v4 library and the Batik library on our classpath. As far as I can see, the only Batik related class in PD4ML is BatikSvgCustomTag, so I’m assuming that it has something to do with that, unless I’m missing something obvious.
Kind regards
- This topic was modified 5 years, 5 months ago by PD4ML.
June 19, 2019 at 10:18#30209Batik requires quite a lot of third-party components to run. Probably some of them are missing in your environment.
In Maven-driven projects it is sufficient just to add
[language=xml:2pnm7b2i]
org.apache.xmlgraphics
batik-all
1.9.1
pom
[/language:2pnm7b2i]
net.sourceforge.jeuclid
jeuclid-mathviewer
3.1.9
I’ve also shown JEuclid MathML dependency above for a case you (or someone else) need to have them both. JEuclid also pulls a lot of additional components and some of them conflict with Batik dependencies. The above version combination is safe and works fine.
June 19, 2019 at 10:46#30210Hi there,
We’ve got the Batik-all dependency setup fine. The issue is more with the Java steps required to use Batik within PD4ML. The code that we have is essentially as follows:
this.pd4ml = new com.pd4ml.PD4ML();
Dimension dimension= PD4Constants.A4;
pd4ml.setPageSize(new PageSize(dimension.width, dimension.height));Insets insets = new java.awt.Insets(5,5,5,5);
pd4ml.setPageMargins(new PageMargins(insets.left, insets.top, insets.right, insets.bottom));pd4ml.readHTML(is);
pd4ml.writePDF(baos);I’m not exactly sure where Batik fits in this process, though I’d imagine it’d be somewhere between readHTML and writePDF.
To clarify exactly what the issue is, we are trying to render a SVG textpath (which doesn’t seem to be supported by the PD4ML in-built SVG renderer), so we’re trying to use Batik within the code that we currently have, but are not sure how.
Is there a method that needs to be called in order to load Batik into PD4ML?
Kind regards
June 19, 2019 at 11:00#30211When PD4ML encounters
No explicit API calls needed to activate it.
Batik is more strict regarding SVG syntax, so if it starts to panic e.g. because of missing namespace xmlns=”http://www.w3.org/2000/svg” in <svg> tag – that means Batik is definitely in action.
You may explicitly disable Batik by
com.pd4ml.plugins.BatikSvgCustomTag.disable = true;
July 1, 2019 at 09:13#30212Really great information
web design company -
AuthorPosts
The forum ‘HTML/CSS rendering issues’ is closed to new topics and replies.