Class HtmlContentTransformer

java.lang.Object
org.eclipse.epsilon.picto.transformers.HtmlContentTransformer
All Implemented Interfaces:
ViewContentTransformer

public class HtmlContentTransformer extends Object implements ViewContentTransformer
  • Field Details

  • Constructor Details

    • HtmlContentTransformer

      public HtmlContentTransformer()
  • Method Details

    • canTransform

      public boolean canTransform(ViewContent content)
      Specified by:
      canTransform in interface ViewContentTransformer
    • getLabel

      public String getLabel(ViewContent content)
      Specified by:
      getLabel in interface ViewContentTransformer
    • transform

      public ViewContent transform(ViewContent content, PictoView pictoView) throws Exception
      Specified by:
      transform in interface ViewContentTransformer
      Throws:
      Exception
    • addZoom

      protected void addZoom(Document document)
    • getElementByName

      protected Element getElementByName(Element parent, String name)
    • getElements

      protected NodeList getElements(Document document, String xpath) throws Exception
      Throws:
      Exception
    • pandocRaw

      public static String pandocRaw(String html, String outputExt, Object... additionalArgs) throws IOException
      Converts the HTML to the desired format using Pandoc.
      Parameters:
      html - The raw HTML text.
      outputExt - The output file format.
      additionalArgs - Other arguments to pass to Pandoc.
      Returns:
      The raw output of the file as a String.
      Throws:
      IOException - If invoking Pandoc fails.
    • pandoc

      public static Path pandoc(String html, String outputExt, Object... additionalArgs) throws IOException
      Converts the HTML to the desired format using Pandoc.
      Parameters:
      html - The raw HTML text.
      outputExt - The output file format.
      additionalArgs - Other arguments to pass to Pandoc.
      Returns:
      The output file.
      Throws:
      IOException - If invoking Pandoc fails.
    • pandoc

      public static Path pandoc(Path document, String outputExt, Object... additionalArgs) throws IOException
      Converts the HTML to the desired format using Pandoc.
      Parameters:
      document - The HTML file.
      outputExt - The output file format.
      additionalArgs - Other arguments to pass to Pandoc.
      Returns:
      The output file.
      Throws:
      IOException - If invoking Pandoc fails.
    • invokePandoc

      protected static ExternalContentTransformation invokePandoc(Path document, String outputExt, Object... additionalArgs) throws IOException
      Converts the HTML to the desired format using Pandoc.
      Parameters:
      html - The HTML file.
      outputExt - The output file format.
      additionalArgs - Other arguments to pass to Pandoc.
      Returns:
      The transformation, prior to running it.
      Throws:
      IOException - If invoking Pandoc fails.
    • wkhtmltopdf

      public static Path wkhtmltopdf(String html) throws IOException
      Converts HTML to PDF using wkhtmltopdf.
      Parameters:
      html - The raw HTML text.
      Returns:
      The output PDF file.
      Throws:
      IOException - If invoking wkhtmltopdf fails.
    • wkhtmltopdf

      public static Path wkhtmltopdf(Path document) throws IOException
      Converts HTML to PDF using wkhtmltopdf.
      Parameters:
      html - The HTML file.
      Returns:
      The output PDF file.
      Throws:
      IOException - If invoking wkhtmltopdf fails.