Class CssPatcher

java.lang.Object
eu.kartoffelquadrat.svgpatcher.Patcher
eu.kartoffelquadrat.svgpatcher.CssPatcher

public class CssPatcher extends Patcher
Little helper class to add an internal css definition to the SVG file that prevents manual selection of any text objects by the user. See: https://gist.github.com/23maverick23/64b3b587c88697558fac (no text select css definitions) And: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/style (svg css embed mechanism)
Author:
Maximilian Schiedermeier, 2022s
  • Constructor Details

    • CssPatcher

      public CssPatcher(Document svg, String customCssFileReference)
      CssPatcher constructor. Invokes super patcher constructor.
      Parameters:
      svg - as the document to operate on.
      customCssFileReference - absolute path as string to CSS definitions to include in svg.
  • Method Details

    • execute

      public Document execute() throws IOException
      Adds a new child node to the root svg node: "style".
      Specified by:
      execute in class Patcher
      Returns:
      the identical svg object you passed as input, but with patched style node.
      Throws:
      IOException - if patching involves loading of external files which cannot be resolved.