Class OutlineHandler
java.lang.Object
com.itextpdf.html2pdf.attach.impl.OutlineHandler
A
OutlineHandler handles creating outlines for tags.
This class is not reusable and a new instance shall be created for every new conversion process.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic OutlineHandlerCreates an OutlineHandler with standard predefined mappings.protected StringgenerateOutlineName(com.itextpdf.styledxmlparser.node.IElementNode element) Generate the outline name.protected StringgenerateUniqueDestinationName(com.itextpdf.styledxmlparser.node.IElementNode element) Generate the unique destination name.Gets the destination name prefix.getTagPriorityMapping(String tagName) Gets the tag priority mapping.booleanhasTagPriorityMapping(String tagName) Checks for tag priority mapping.putAllTagPriorityMappings(Map<String, Integer> mappings) Put all tag priority mappings.putTagPriorityMapping(String tagName, Integer priority) Put tag priority mapping.voidreset()Resets the current state so that thisOutlineHandleris ready to process new documentvoidsetDestinationNamePrefix(String destinationNamePrefix) Sets the destination name prefix.
-
Constructor Details
-
OutlineHandler
public OutlineHandler()
-
-
Method Details
-
createStandardHandler
Creates an OutlineHandler with standard predefined mappings.- Returns:
- the outline handler
-
putTagPriorityMapping
Put tag priority mapping.- Parameters:
-
tagName- the tag name -
priority- the priority - Returns:
- the outline handler
-
putAllTagPriorityMappings
Put all tag priority mappings.- Parameters:
-
mappings- the mappings - Returns:
- the outline handler
-
getTagPriorityMapping
Gets the tag priority mapping.- Parameters:
-
tagName- the tag name - Returns:
- the tag priority mapping
-
hasTagPriorityMapping
Checks for tag priority mapping.- Parameters:
-
tagName- the tag name - Returns:
- true, if the tag name is listed in the tag priorities mapping
-
reset
public void reset()Resets the current state so that thisOutlineHandleris ready to process new document -
setDestinationNamePrefix
Sets the destination name prefix. The destination name prefix serves as the prefix for the destination names created in thegenerateUniqueDestinationName(com.itextpdf.styledxmlparser.node.IElementNode)method.- Parameters:
-
destinationNamePrefix- the destination name prefix
-
getDestinationNamePrefix
Gets the destination name prefix. The destination name prefix serves as the prefix for the destination names created in thegenerateUniqueDestinationName(com.itextpdf.styledxmlparser.node.IElementNode)method.- Returns:
- the destination name prefix
-
generateUniqueDestinationName
protected String generateUniqueDestinationName(com.itextpdf.styledxmlparser.node.IElementNode element) Generate the unique destination name. The destination name is a unique identifier for the outline so it is generated for the outline in theaddOutlineAndDestToDocument(com.itextpdf.html2pdf.attach.ITagWorker, com.itextpdf.styledxmlparser.node.IElementNode, com.itextpdf.html2pdf.attach.ProcessorContext)method. You can override this method to set your own way to generate the destination names, to avoid the destination name conflicts when merging several PDF files created by html2pdf.- Parameters:
-
element- the element - Returns:
- the unique destination name
-
generateOutlineName
Generate the outline name. This method is used in theaddOutlineAndDestToDocument(com.itextpdf.html2pdf.attach.ITagWorker, com.itextpdf.styledxmlparser.node.IElementNode, com.itextpdf.html2pdf.attach.ProcessorContext)method. You can override this method to set your own way to generate the outline names.- Parameters:
-
element- the element - Returns:
- the unique destination name
-