Class HtmlContentTransformer
- java.lang.Object
-
- org.eclipse.epsilon.picto.transformers.HtmlContentTransformer
-
- All Implemented Interfaces:
ViewContentTransformer
public class HtmlContentTransformer extends Object implements ViewContentTransformer
-
-
Field Summary
Fields Modifier and Type Field Description protected List<HtmlElementTransformer>
htmlElementTransformers
protected XmlHelper
xmlHelper
-
Constructor Summary
Constructors Constructor Description HtmlContentTransformer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addZoom(Document document)
boolean
canTransform(ViewContent content)
protected Element
getElementByName(Element parent, String name)
protected NodeList
getElements(Document document, String xpath)
String
getLabel(ViewContent content)
protected static ExternalContentTransformation
invokePandoc(Path document, String outputExt, Object... additionalArgs)
Converts the HTML to the desired format using Pandoc.static Path
pandoc(String html, String outputExt, Object... additionalArgs)
Converts the HTML to the desired format using Pandoc.static Path
pandoc(Path document, String outputExt, Object... additionalArgs)
Converts the HTML to the desired format using Pandoc.static String
pandocRaw(String html, String outputExt, Object... additionalArgs)
Converts the HTML to the desired format using Pandoc.ViewContent
transform(ViewContent content, PictoView pictoView)
static Path
wkhtmltopdf(String html)
Converts HTML to PDF using wkhtmltopdf.static Path
wkhtmltopdf(Path document)
Converts HTML to PDF using wkhtmltopdf.
-
-
-
Field Detail
-
htmlElementTransformers
protected List<HtmlElementTransformer> htmlElementTransformers
-
xmlHelper
protected XmlHelper xmlHelper
-
-
Method Detail
-
canTransform
public boolean canTransform(ViewContent content)
- Specified by:
canTransform
in interfaceViewContentTransformer
-
getLabel
public String getLabel(ViewContent content)
- Specified by:
getLabel
in interfaceViewContentTransformer
-
transform
public ViewContent transform(ViewContent content, PictoView pictoView) throws Exception
- Specified by:
transform
in interfaceViewContentTransformer
- Throws:
Exception
-
addZoom
protected void addZoom(Document document)
-
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.
-
-