User Tools

Site Tools


devel:dependency:batik

Preparing minimal Apache Batik

The aim is to prepare a cut-down version of Apache Batik with the minimal set of JARs necessary for building and running Workcraft (this effort results in ~10MB size reduction):

  1. Download JARs of Batik binary distribution from https://xmlgraphics.apache.org/batik/download.html
  2. Remove not needed JARs based on the following Workcraft dependency analysis:
    • Compile-time dependency
      • batik-anim – needed for SVG (SAXSVGDocumentFactory)
      • batik-awt-util – needed for SVG (AbstractGraphics2D, SVGGraphics2D)
      • batik-bridge – needed for GUI (UserAgentAdapter, BridgeContext, GVTBuilder)
      • batik-constants – needed for XML constants (XMLConstants)
      • batik-css – needed for creating icon from SVG (CSSContext)
      • batik-dom – needed for creating icon from SVG (DocumentFactory)
      • batik-gvt – needed for creating icon from SVG (GraphicsNode)
      • batik-svg-dom – needed for creating icon from SVG (SVGDocumentFactory)
      • batik-svggen – needed for exporting in SVG format (SVGGraphics2D)
      • batik-transcoder – needed for exporting in PDF, PS, EPS formats (Transcoder, TranscoderInput, TranscoderOutput, TranscoderException)
      • batik-util – needed for loading SVG files (XMLResourceDescriptort)
      • fop-transcoder – needed for exporting in PDF, PS, EPS formats (PDFTranscoder, PSTranscoder, EPSTranscoder, PNGTranscoder)
    • Run-time dependency
      • batik-codec – needed for loading SVG files (java.lang.NoClassDefFoundError: org/apache/xmlgraphics/java2d/color/NamedColorSpace)
      • batik-ext – needed for loading SVG files (java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal)
      • batik-i18n – needed for loading SVG files (java.lang.NoClassDefFoundError: org/apache/batik/anim/dom/SVGDOMImplementation)
      • batik-parser – needed for loading SVG files (java.lang.NoClassDefFoundError: org/apache/batik/parser/UnitProcessor$Context)
      • batik-script – needed for loading SVG files (java.lang.NoClassDefFoundError: Could not initialize class org.apache.batik.bridge.BridgeContext)
      • batik-xml – needed for loading SVG files (java.lang.NoClassDefFoundError: org/apache/batik/dom/util/DOMUtilities)
      • xml-apis-ext – needed for loading SVG files (java.lang.NoClassDefFoundError: org/apache/batik/anim/dom/SVGOMDocument)
      • xmlgraphics-commons – needed for loading SVG files (java.lang.NoClassDefFoundError: org/apache/xmlgraphics/java2d/color/NamedColorSpace)
    • Not needed
      • batik-extension
      • batik-gui-util
      • batik-js
      • batik-rasterizer
      • batik-rasterizer-ext
      • batik-shared-resources (since v1.18)
      • batik-slideshow
      • batik-squiggle
      • batik-squiggle-ext
      • batik-svgbrowser (since v1.18)
      • batik-svgpp
      • batik-svgrasterizer
      • batik-swing
      • batik-test
      • batik-test-old
      • batik-test-svg
      • batik-test-swing
      • batic-ttf2svg
      • batik-util-*-tests (since v1.18)
      • fop-pdf-images
      • rhino (since v1.18)
      • serialiser (since v1.18)
      • xml-apis – there is still run-time dependency on xml-apis-ext

If extra ~10MB and several unnecessary dependencies are not a problem, then Batik and FOP transcoders can be included via Gradle in dependencies section of WorkcraftCore\build.gradle as follows:

lib 'org.apache.xmlgraphics:batik-transcoder:1.18'
lib 'org.apache.xmlgraphics:fop-transcoder:2.10'
Copyright © 2014-2024 workcraft.org

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki