Class HtmlPipelineContext

    • Field Detail

      • BOOKMARK_TREE

        public static final java.lang.String BOOKMARK_TREE
        Key for the memory, used to store bookmark nodes
        See Also:
        Constant Field Values
      • LAST_MARGIN_BOTTOM

        public static final java.lang.String LAST_MARGIN_BOTTOM
        Key for the memory, used in Html TagProcessing
        See Also:
        Constant Field Values
      • queue

        private final java.util.LinkedList<StackKeeper> queue
      • acceptUnknown

        private boolean acceptUnknown
      • ctn

        private final java.util.List<Element> ctn
      • resourcesRootPath

        private java.lang.String resourcesRootPath
      • charset

        private java.nio.charset.Charset charset
      • roottags

        private java.util.List<java.lang.String> roottags
      • autoBookmark

        private boolean autoBookmark
      • memory

        private final java.util.Map<java.lang.String,​java.lang.Object> memory
    • Constructor Detail

      • HtmlPipelineContext

        public HtmlPipelineContext​(CssAppliers cssAppliers)
        Construct a new HtmlPipelineContext object
    • Method Detail

      • resolveProcessor

        protected TagProcessor resolveProcessor​(java.lang.String tag,
                                                java.lang.String nameSpace)
        Parameters:
        tag - the tag to find a TagProcessor for
        nameSpace - the namespace.
        Returns:
        a TagProcessor
      • peek

        protected StackKeeper peek()
        Retrieves, but does not remove, the head (first element) of this list.
        Returns:
        a StackKeeper or null if there are no elements on the stack
      • currentContent

        protected java.util.List<Element> currentContent()
        Returns:
        the current content of elements.
      • acceptUnknown

        public boolean acceptUnknown()
        Returns:
        if this pipelines tag processing accept unknown tags: true. False otherwise
      • isEmpty

        protected boolean isEmpty()
        Returns:
        returns true if the stack is empty
      • autoBookmark

        public boolean autoBookmark()
        Returns:
        true if auto-bookmarks should be enabled. False otherwise.
      • getMemory

        public java.util.Map<java.lang.String,​java.lang.Object> getMemory()
        Returns:
        the memory
      • charSet

        @Experimental
        public HtmlPipelineContext charSet​(java.nio.charset.Charset cSet)
        Set a Charset to use.
        Parameters:
        cSet - the charset.
        Returns:
        this HtmlPipelineContext
      • charSet

        public java.nio.charset.Charset charSet()
        Returns:
        the Charset to use, or null if none configured.
      • getRootTags

        public java.util.List<java.lang.String> getRootTags()
        Specified by:
        getRootTags in interface MarginMemory
        Returns:
        a list of tags to be taken as root-tags. This matters for margins. By default the root-tags are <body> and <div>
      • getLinkProvider

        public LinkProvider getLinkProvider()
        Returns the LinkProvider, used to prepend e.g. http://www.example.org/ to found <a> tags that have no absolute url.
        Returns:
        the LinkProvider if any.
      • setPageSize

        public HtmlPipelineContext setPageSize​(Rectangle pageSize)
        If no pageSize is set, the default value A4 is used.
        Parameters:
        pageSize - the pageSize to set
        Returns:
        this HtmlPipelineContext
      • clone

        public HtmlPipelineContext clone()
                                  throws java.lang.CloneNotSupportedException
        Create a clone of this HtmlPipelineContext, the clone only contains the initial values, not the internal values. Beware, the state of the current Context is not copied to the clone. Only the configurational important stuff like the LinkProvider (same object), ImageProvider (new AbstractImageProvider with same ImageRootPath) , TagProcessorFactory (same object), acceptUnknown (primitive), charset (Charset.forName to get a new charset), autobookmark (primitive) are copied.
        Overrides:
        clone in class java.lang.Object
        Throws:
        java.lang.CloneNotSupportedException
      • setAcceptUnknown

        public HtmlPipelineContext setAcceptUnknown​(boolean acceptUnknown)
        Set to true to allow the HtmlPipeline to accept tags it does not find in the given TagProcessorFactory
        Parameters:
        acceptUnknown - true or false
        Returns:
        this HtmlPipelineContext
      • autoBookmark

        public HtmlPipelineContext autoBookmark​(boolean autoBookmark)
        Set to true to enable the automatic creation of bookmarks on <h1> to <h6> tags. Works in conjunction with Header.
        Parameters:
        autoBookmark - true or false
        Returns:
        this HtmlPipelineContext
      • setRootTags

        public HtmlPipelineContext setRootTags​(java.util.List<java.lang.String> roottags)
        Set the root-tags, this matters for margins. By default these are set to <body> and <div>.
        Parameters:
        roottags - the root tags
        Returns:
        this HtmlPipelineContext
      • setLastMarginBottom

        public void setLastMarginBottom​(java.lang.Float lmb)
        Description copied from interface: MarginMemory
        Set the last margin bottom.
        Specified by:
        setLastMarginBottom in interface MarginMemory
        Parameters:
        lmb - set the float for lmb
      • getResourcesRootPath

        public java.lang.String getResourcesRootPath()
      • setResourcesRootPath

        public void setResourcesRootPath​(java.lang.String resourcesRootPath)