Package com.evopdf

Class HtmlToPdfVariableElement


public class HtmlToPdfVariableElement extends HtmlToPdfElement
This class encapsulates a HTML to PDF converter functionality. Objects of this class can be added at any location in a Template to render HTML. A conversion is performed for each PDF page where the Template is rendered
  • Constructor Details

    • HtmlToPdfVariableElement

      public HtmlToPdfVariableElement(String htmlStringToConvert, String htmlStringBaseURL)
      Creates a HTML string to PDF converter element that will be rendered at the (0,0) location in PDF page using a base URL to resolve the external resources and a document URL to resolve the internal links. The width of element in PDF page is the available width in PDF page and the height is auto determined
      Parameters:
      htmlStringToConvert - The HTML string to convert to PDF
      htmlStringBaseURL - The full URL of the page from where this String was taken used to resolve the images and CSS files referenced by a relative URL in the HTML String. This parameter is optional and the default value is NULL
    • HtmlToPdfVariableElement

      public HtmlToPdfVariableElement(float x, float y, String htmlStringToConvert, String htmlStringBaseURL)
      Creates a HTML string to PDF converter element at the specified x and y coordinates in PDF page using a base URL to resolve the external resources and a document URL to resolve the internal links. The width of element in PDF page is the available width in PDF page and the height is auto determined
      Parameters:
      x - the x position in points where the rendered content will be placed
      y - the y position in points where the rendered content will be placed
      htmlStringToConvert - the HTML string to convert to PDF
      htmlStringBaseURL - the full URL of the page from where this String was taken used to resolve the images and CSS files referenced by a relative URL in the HTML String. This parameter is optional and the default value is NULL. When this parameter is NULL no base URL will be used
    • HtmlToPdfVariableElement

      public HtmlToPdfVariableElement(float x, float y, float width, String htmlStringToConvert, String htmlStringBaseURL)
      Creates a HTML string to PDF converter element at the specified x and y coordinates with the specified width using a base URL to resolve the external resources and a document URL to resolve the internal links. The height in PDF is auto determined
      Parameters:
      x - the x position in points where the rendered content will be placed
      y - the y position in points where the rendered content will be placed
      width - the destination width in points for the rendered content. If the specified with is less or equal 0, the destination width will be given by the available width in page
      htmlStringToConvert - the HTML string to convert to PDF
      htmlStringBaseURL - the full URL of the page from where this String was taken used to resolve the images and CSS files referenced by a relative URL in the HTML String. This parameter is optional and the default value is NULL. When this parameter is NULL no base URL will be used
    • HtmlToPdfVariableElement

      public HtmlToPdfVariableElement(float x, float y, float width, float height, String htmlStringToConvert, String htmlStringBaseURL)
      Creates a HTML string to PDF converter element at the specified x and y coordinates with the specified width and height using a base URL to resolve the external resources and a document URL to resolve the internal links
      Parameters:
      x - the x position in points where the rendered content will be placed
      y - the y position in points where the rendered content will be placed
      width - the destination width in points for the rendered content. If the specified with is less or equal 0, the destination width will be given by the available width in page
      height - the destination height in points for the rendered content. If the specified height is less or equal 0, the destination height will be auto determined so all the content can be rendered. Please note that the specified height is the effective height that will be rendered in the PDF document and does not include for example the empty spaces introduced by custom or automatic page breaks
      htmlStringToConvert - the HTML string to convert to PDF
      htmlStringBaseURL - the full URL of the page from where this String was taken used to resolve the images and CSS files referenced by a relative URL in the HTML String. This parameter is optional and the default value is NULL. When this parameter is NULL no base URL will be used
    • HtmlToPdfVariableElement

      public HtmlToPdfVariableElement(float x, float y, float width, String htmlStringToConvert, String htmlStringBaseURL, int htmlViewerWidth)
      Creates a HTML string to PDF converter element at the specified x and y coordinates with the specified width using a base URL to resolve the external resources and a document URL to resolve the internal links. The height in PDF is auto determined. The virtual browser width in pixels is specified by the htmlViewerWidth parameter
      Parameters:
      x - the x position in points where the rendered content will be placed
      y - the y position in points where the rendered content will be placed
      width - the destination width in points for the rendered content. If the specified with is less or equal 0, the destination width will be given by the available width in page
      htmlStringToConvert - the HTML string to convert to PDF
      htmlStringBaseURL - the full URL of the page from where this String was taken used to resolve the images and CSS files referenced by a relative URL in the HTML String. This parameter is optional and the default value is NULL. When this parameter is NULL no base URL will be used
      htmlViewerWidth - the virtual browser width in pixels. The default value is 1024 pixels. The effect of this parameter is similar with viewing the HTML page in a browser window with the specified width
    • HtmlToPdfVariableElement

      public HtmlToPdfVariableElement(float x, float y, float width, float height, String htmlStringToConvert, String htmlStringBaseURL, int htmlViewerWidth, int htmlViewerHeight)
      Creates a HTML string to PDF converter element at the specified x and y coordinates with the specified width and height using a base URL to resolve the external resources and a document URL to resolve the internal links. The virtual browser width and height in pixels is specified by the htmlViewerWidth and htmlViewerHeight parameters
      Parameters:
      x - the x position in points where the rendered content will be placed
      y - the y position in points where the rendered content will be placed
      width - the destination width in points for the rendered content. If the specified with is less or equal 0, the destination width will be given by the available width in page
      height - the destination height in points for the rendered content. If the specified height is less or equal 0, the destination height will be auto determined so all the content can be rendered. Please note that the specified height is the effective height that will be rendered in the PDF document and does not include for example the empty spaces introduced by custom or automatic page breaks
      htmlStringToConvert - the HTML string to convert to PDF
      htmlStringBaseURL - the full URL of the page from where this String was taken used to resolve the images and CSS files referenced by a relative URL in the HTML String. This parameter is optional and the default value is NULL. When this parameter is NULL no base URL will be used
      htmlViewerWidth - the virtual browser width in pixels. The default value is 1024 pixels. The effect of this parameter is similar with viewing the HTML page in a browser window with the specified width
      htmlViewerHeight - the virtual browser height in pixels. The default value is 0 which means the height will be auto-determined. The effect of this parameter is similar with viewing the HTML page in a browser window with the specified width and height. When this parameter is less or equal to 0, the converter will try to auto-determine the HTML page height from the HTML document content
  • Method Details

    • html

      public String html()
      Gets the variable HTML String to be converted to PDF
      Overrides:
      html in class HtmlToPdfElement
      Returns:
      the HTML string to be converted to PDF
    • setHtml

      public void setHtml(String html)
      Sets the variable HTML String to be converted to PDF
      Overrides:
      setHtml in class HtmlToPdfElement
      Parameters:
      html - the HTML string to be converted to PDF