Class HtmlContentTransformer

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void addZoom​(org.w3c.dom.Document document)  
      boolean canTransform​(ViewContent content)  
      protected org.w3c.dom.Element getElementByName​(org.w3c.dom.Element parent, java.lang.String name)  
      protected org.w3c.dom.NodeList getElements​(org.w3c.dom.Document document, java.lang.String xpath)  
      java.lang.String getLabel​(ViewContent content)  
      protected static ExternalContentTransformation invokePandoc​(java.nio.file.Path document, java.lang.String outputExt, java.lang.Object... additionalArgs)
      Converts the HTML to the desired format using Pandoc.
      static java.nio.file.Path pandoc​(java.lang.String html, java.lang.String outputExt, java.lang.Object... additionalArgs)
      Converts the HTML to the desired format using Pandoc.
      static java.nio.file.Path pandoc​(java.nio.file.Path document, java.lang.String outputExt, java.lang.Object... additionalArgs)
      Converts the HTML to the desired format using Pandoc.
      static java.lang.String pandocRaw​(java.lang.String html, java.lang.String outputExt, java.lang.Object... additionalArgs)
      Converts the HTML to the desired format using Pandoc.
      ViewContent transform​(ViewContent content, PictoView pictoView)  
      static java.nio.file.Path wkhtmltopdf​(java.lang.String html)
      Converts HTML to PDF using wkhtmltopdf.
      static java.nio.file.Path wkhtmltopdf​(java.nio.file.Path document)
      Converts HTML to PDF using wkhtmltopdf.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HtmlContentTransformer

        public HtmlContentTransformer()
    • Method Detail

      • addZoom

        protected void addZoom​(org.w3c.dom.Document document)
      • getElementByName

        protected org.w3c.dom.Element getElementByName​(org.w3c.dom.Element parent,
                                                       java.lang.String name)
      • getElements

        protected org.w3c.dom.NodeList getElements​(org.w3c.dom.Document document,
                                                   java.lang.String xpath)
                                            throws java.lang.Exception
        Throws:
        java.lang.Exception
      • pandocRaw

        public static java.lang.String pandocRaw​(java.lang.String html,
                                                 java.lang.String outputExt,
                                                 java.lang.Object... additionalArgs)
                                          throws java.io.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:
        java.io.IOException - If invoking Pandoc fails.
      • pandoc

        public static java.nio.file.Path pandoc​(java.lang.String html,
                                                java.lang.String outputExt,
                                                java.lang.Object... additionalArgs)
                                         throws java.io.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:
        java.io.IOException - If invoking Pandoc fails.
      • pandoc

        public static java.nio.file.Path pandoc​(java.nio.file.Path document,
                                                java.lang.String outputExt,
                                                java.lang.Object... additionalArgs)
                                         throws java.io.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:
        java.io.IOException - If invoking Pandoc fails.
      • invokePandoc

        protected static ExternalContentTransformation invokePandoc​(java.nio.file.Path document,
                                                                    java.lang.String outputExt,
                                                                    java.lang.Object... additionalArgs)
                                                             throws java.io.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:
        java.io.IOException - If invoking Pandoc fails.
      • wkhtmltopdf

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

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