Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #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 4 years, 8 months ago by PD4ML.
    #30209

    Batik 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


    net.sourceforge.jeuclid
    jeuclid-mathviewer
    3.1.9
    [/language:2pnm7b2i]

    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.

    #30210

    Hi 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

    #30211

    When PD4ML encounters tag it tries to instantiate BatikSvgCustomTag class. If Batik library is missing it fails and fallbacks to our built-in proprietary SVG renderer.

    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&#8221; in <svg> tag – that means Batik is definitely in action.

    You may explicitly disable Batik by com.pd4ml.plugins.BatikSvgCustomTag.disable = true;

    • This reply was modified 4 years, 8 months ago by PD4ML.
    • This reply was modified 4 years, 8 months ago by PD4ML.
    #30212

    Really great information
    web design company

Viewing 5 posts - 1 through 5 (of 5 total)

The forum ‘HTML/CSS rendering issues’ is closed to new topics and replies.