Class SvgPatcher

java.lang.Object
eu.kartoffelquadrat.svgpatcher.SvgPatcher

public class SvgPatcher extends Object
Code based on the example by mkyong: https://mkyong.com/java/how-to-read-xml-file-in-java-dom-parser/
  • Constructor Details

    • SvgPatcher

      public SvgPatcher()
      Default constructor.
  • Method Details

    • main

      Makes to changes to a provided SVG document (generated by omnigraffle). First: boosts the svg dimensions so the svg is correctly rendered and not too tiny. Second: searches for IDs that Omnigraffle places as title attributes and adapts these id values as actual svg ids, so browser javascript frameworks can actually find them and conveniently modify the DOM.
      Parameters:
      args - first argument in input file to parse, second argument is where to store the target file. Last argument is link to a file with custom css definitions (pass empty file if not needed).
      Throws:
      IOException - in case provided file can not be read
      SAXException - in case provided file can not be interpreted as svg / does not comply to DTD
      ParserConfigurationException - in case the parser arguments cannot be applied
      TransformerException - in case the modified svg cannot be persisted to disk