Class ConverterProperties

java.lang.Object
com.itextpdf.html2pdf.ConverterProperties

public class ConverterProperties extends Object
Properties that will be used by the HtmlConverter.
  • Constructor Details

  • Method Details

    • getMediaDeviceDescription

      public com.itextpdf.styledxmlparser.css.media.MediaDeviceDescription getMediaDeviceDescription()
      Gets the media device description.

      The properties of the multimedia device are taken into account when creating the SVG and when processing the properties of the СSS.

      Returns:
      the media device description
    • setMediaDeviceDescription

      public ConverterProperties setMediaDeviceDescription (com.itextpdf.styledxmlparser.css.media.MediaDeviceDescription mediaDeviceDescription)
      Sets the media device description.

      The properties of the multimedia device are taken into account when creating the SVG and when processing the properties of the СSS.

      Parameters:
      mediaDeviceDescription - the media device description
      Returns:
      the ConverterProperties instance
    • getFontProvider

      public com.itextpdf.layout.font.FontProvider getFontProvider()
      Gets the font provider.

      Please note that FontProvider instances cannot be reused across several documents and thus as soon as you set this property, this ConverterProperties instance becomes only useful for a single HTML conversion.

      Returns:
      the font provider
    • setFontProvider

      public ConverterProperties setFontProvider (com.itextpdf.layout.font.FontProvider fontProvider)
      Sets the font provider.

      Please note that FontProvider instances cannot be reused across several documents and thus as soon as you set this property, this ConverterProperties instance becomes only useful for a single HTML conversion.

      Parameters:
      fontProvider - the font provider
      Returns:
      the ConverterProperties instance
    • getLimitOfLayouts

      public int getLimitOfLayouts()
      Gets maximum number of layouts.
      Returns:
      layouts limit
    • setLimitOfLayouts

      public ConverterProperties setLimitOfLayouts (int limitOfLayouts)
      Sets maximum number of layouts.
      Parameters:
      limitOfLayouts - layouts limit
      Returns:
      the ConverterProperties instance
    • getTagWorkerFactory

      public ITagWorkerFactory getTagWorkerFactory()
      Gets the TagWorkerFactory instance.

      The tagWorkerFactory is used to create ITagWorker, which in turn are used to convert the HTML tags to the PDF elements.

      Returns:
      the TagWorkerFactory
    • setTagWorkerFactory

      public ConverterProperties setTagWorkerFactory (ITagWorkerFactory tagWorkerFactory)
      Sets the TagWorkerFactory.

      The tagWorkerFactory is used to create ITagWorker, which in turn are used to convert the HTML tags to the PDF elements.

      Parameters:
      tagWorkerFactory - the TagWorkerFactory
      Returns:
      the ConverterProperties instance
    • getCssApplierFactory

      public ICssApplierFactory getCssApplierFactory()
      Gets the CSS applier factory.

      The cssApplierFactory is used to create ICssApplier, which in turn are used to convert the CSS properties to the PDF properties.

      Returns:
      the CSS applier factory
    • setCssApplierFactory

      public ConverterProperties setCssApplierFactory (ICssApplierFactory cssApplierFactory)
      Sets the CSS applier factory.

      The cssApplierFactory is used to create ICssApplier, which in turn are used to convert the CSS properties to the PDF properties.

      Parameters:
      cssApplierFactory - the CSS applier factory
      Returns:
      the ConverterProperties instance
    • getBaseUri

      public String getBaseUri()
      Gets the base URI.

      Base URI is used to resolve other URI.

      Returns:
      the base URI
    • setBaseUri

      public ConverterProperties setBaseUri (String baseUri)
      Sets the base URI.

      Base URI is used to resolve other URI.

      Parameters:
      baseUri - the base URI
      Returns:
      the ConverterProperties instance
    • getResourceRetriever

      public com.itextpdf.styledxmlparser.resolver.resource.IResourceRetriever getResourceRetriever()
      Gets the resource retriever.

      The resourceRetriever is used to retrieve data from resources by URL.

      Returns:
      the resource retriever
    • setResourceRetriever

      public ConverterProperties setResourceRetriever (com.itextpdf.styledxmlparser.resolver.resource.IResourceRetriever resourceRetriever)
      Sets the resource retriever.

      The resourceRetriever is used to retrieve data from resources by URL.

      Parameters:
      resourceRetriever - the resource retriever
      Returns:
      the ConverterProperties instance
    • isCreateAcroForm

      public boolean isCreateAcroForm()
      Check if the createAcroForm flag is set.

      If createAcroForm is set, then when the form is encountered in HTML, AcroForm will be created, otherwise a visually identical, but not functional element will be created. Please bare in mind that the created Acroform may visually differ a bit from the HTML one.

      Returns:
      the createAcroForm flag
    • setCreateAcroForm

      public ConverterProperties setCreateAcroForm (boolean createAcroForm)
      Sets the createAcroForm value.

      If createAcroForm is set, then when the form is encountered in HTML, AcroForm will be created, otherwise a visually identical, but not functional element will be created. Please bare in mind that the created Acroform may visually differ a bit from the HTML one.

      When enabling this acroform creation, it will disable the immediateFlushing property.

      Parameters:
      createAcroForm - true if an AcroForm needs to be created
      Returns:
      the ConverterProperties instance
    • getOutlineHandler

      public OutlineHandler getOutlineHandler()
      Gets the outline handler.

      If outlineHandler is specified, then outlines will be created in the PDF for HTML tags specified in outlineHandler.

      Please note that OutlineHandler is not thread safe, thus as soon as you have set this property, this ConverterProperties instance cannot be used in converting multiple HTMLs simultaneously.

      Returns:
      the outline handler
    • setOutlineHandler

      public ConverterProperties setOutlineHandler (OutlineHandler outlineHandler)
      Sets the outline handler.

      If outlineHandler is specified, then outlines will be created in the PDF for HTML tags specified in outlineHandler.

      Please note that OutlineHandler is not thread safe, thus as soon as you have set this property, this ConverterProperties instance cannot be used in converting multiple HTMLs simultaneously.

      Parameters:
      outlineHandler - the outline handler
      Returns:
      the ConverterProperties instance
    • getCharset

      public String getCharset()
      Gets the encoding charset.

      Charset is used to correctly decode an HTML file.

      Returns:
      the charset
    • setCharset

      public ConverterProperties setCharset (String charset)
      Sets the encoding charset.

      Charset is used to correctly decode an HTML file.

      Parameters:
      charset - the charset
      Returns:
      the ConverterProperties instance
    • setDocumentOutputIntent

      public ConverterProperties setDocumentOutputIntent (com.itextpdf.kernel.pdf.PdfOutputIntent outputIntent)
      Sets pdf document output intent (final destination device) to reproduce the color in the PDF. Required parameter, when converting to pdf/a one have to specify an explicit output intent.

      Note, output intent isn't applicable for HtmlConverter#convertToElements methods (e.g. HtmlConverter.convertToElements(InputStream, ConverterProperties))

      Parameters:
      outputIntent - a PdfOutputIntent instance
      Returns:
      the ConverterProperties instance
    • setPdfAConformanceLevel

      public ConverterProperties setPdfAConformanceLevel (com.itextpdf.kernel.pdf.PdfAConformanceLevel conformanceLevel)
      Sets the generation and strictness level of the PDF/A that must be followed. Required parameter, when converting to pdf/a one have to specify an explicit pdf/a conformance level.
      Parameters:
      conformanceLevel - a PdfAConformanceLevel constant
      Returns:
      the ConverterProperties instance
    • getDocumentOutputIntent

      public com.itextpdf.kernel.pdf.PdfOutputIntent getDocumentOutputIntent()
      Gets pdf document output intent (final destination device) to reproduce the color in the PDF.

      Note, output intent isn't applicable for HtmlConverter#convertToElements methods (e.g. HtmlConverter.convertToElements(InputStream, ConverterProperties))

      Returns:
      pdf output intent
    • getConformanceLevel

      public com.itextpdf.kernel.pdf.PdfAConformanceLevel getConformanceLevel()
      Gets the generation and strictness level of the PDF/A that must be followed.
      Returns:
      pdf/a conformance level
    • isImmediateFlush

      public boolean isImmediateFlush()
      Checks if immediateFlush is set.

      This is used for HtmlConverter.convertToDocument(java.lang.String, com.itextpdf.kernel.pdf.PdfWriter) methods and will be overwritten to false if a page-counter declaration is present in the CSS of the HTML being converted. Has no effect when used in conjunction with HtmlConverter.convertToPdf(java.lang.String, java.io.OutputStream) or HtmlConverter.convertToElements(java.lang.String).

      Returns:
      true if immediateFlush is set, false if not
    • setImmediateFlush

      public ConverterProperties setImmediateFlush (boolean immediateFlush)
      Set the immediate flush property of the layout document.

      This is used for HtmlConverter.convertToDocument(java.lang.String, com.itextpdf.kernel.pdf.PdfWriter) methods and will be overwritten to false if a page-counter declaration is present in the CSS of the HTML being converted. Has no effect when used in conjunction with HtmlConverter.convertToPdf(java.lang.String, java.io.OutputStream) or HtmlConverter.convertToElements(java.lang.String).

      Parameters:
      immediateFlush - the immediate flush value
      Returns:
      the ConverterProperties instance
    • setEventMetaInfo

      public ConverterProperties setEventMetaInfo (com.itextpdf.commons.actions.contexts.IMetaInfo metaInfo)
      Sets html meta info.

      This meta info will be used to determine event origin.

      Parameters:
      metaInfo - meta info to set
      Returns:
      the ConverterProperties instance
    • isContinuousContainerEnabled

      public boolean isContinuousContainerEnabled()
      check if continuous container is enabled.
      Returns:
      true if enabled, false otherwise
    • setContinuousContainerEnabled

      public ConverterProperties setContinuousContainerEnabled (boolean value)
      Sets continuous container support.
      Parameters:
      value - true to set continuous container, false otherwise
      Returns:
      the ConverterProperties instance