Class DefaultHtmlProcessor
java.lang.Object
com.itextpdf.html2pdf.attach.impl.DefaultHtmlProcessor
- All Implemented Interfaces:
-
IHtmlProcessor
The default implementation to process HTML.
-
Constructor Summary
ConstructorDescriptionDefaultHtmlProcessor
(ConverterProperties converterProperties) Instantiates a new default html processor. -
Method Summary
Modifier and TypeMethodDescriptioncom.itextpdf.layout.Document
processDocument
(com.itextpdf.styledxmlparser.node.INode root, com.itextpdf.kernel.pdf.PdfDocument pdfDocument) Parses HTML to add the content to aPdfDocument
.processElements
(com.itextpdf.styledxmlparser.node.INode root) Parses HTML to add the content to a list ofIElement
objects.static void
setConvertedRootElementProperties
(Map<String, String> cssProperties, ProcessorContext context, com.itextpdf.layout.IPropertyContainer propertyContainer) Sets properties to top-level layout elements converted from HTML.
-
Constructor Details
-
DefaultHtmlProcessor
Instantiates a new default html processor.- Parameters:
-
converterProperties
- the converter properties
-
-
Method Details
-
setConvertedRootElementProperties
public static void setConvertedRootElementProperties(Map<String, String> cssProperties, ProcessorContext context, com.itextpdf.layout.IPropertyContainer propertyContainer) Sets properties to top-level layout elements converted from HTML. This enables features set by user via HTML converter API and also changes properties defaults to the ones specific to HTML-like behavior.- Parameters:
-
cssProperties
- HTML document-level css properties. -
context
- processor context specific to the current HTML conversion. -
propertyContainer
- top-level layout element converted from HTML.
-
processElements
Description copied from interface:IHtmlProcessor
Parses HTML to add the content to a list ofIElement
objects.- Specified by:
-
processElements
in interfaceIHtmlProcessor
- Parameters:
-
root
- the root node of the HTML that needs to be parsed - Returns:
- the resulting list
-
processDocument
public com.itextpdf.layout.Document processDocument(com.itextpdf.styledxmlparser.node.INode root, com.itextpdf.kernel.pdf.PdfDocument pdfDocument) Description copied from interface:IHtmlProcessor
Parses HTML to add the content to aPdfDocument
.- Specified by:
-
processDocument
in interfaceIHtmlProcessor
- Parameters:
-
root
- the root node of the HTML that needs to be parsed -
pdfDocument
- thePdfDocument
instance - Returns:
-
a
Document
instance
-