Class HtmlStamper

java.lang.Object
com.ironsoftware.ironpdf.stamp.Stamper
com.ironsoftware.ironpdf.stamp.HtmlStamper

public class HtmlStamper extends Stamper
Defines an HTML stamper allowing developers to edit a PdfDocument by adding new content designed in HTML, CSS and JavaScript.

An implementation of Stamper.

See: PdfDocument.applyStamp(Stamper)

  • Constructor Details

    • HtmlStamper

      public HtmlStamper(String html)
      Initializes a new instance of the HtmlStamper class.
      Parameters:
      html - The HTML string.
    • HtmlStamper

      public HtmlStamper(String html, String baseUrlString)
      Initializes a new instance of the HtmlStamper class.
      Parameters:
      html - The HTML string.
      baseUrlString - The HTML base URL for which references to external CSS, Javascript and Image files will be relative.
    • HtmlStamper

      public HtmlStamper(String html, Path baseUrl)
      Initializes a new instance of the HtmlStamper class.
      Parameters:
      html - The HTML string.
      baseUrl - The HTML base URL for which references to external CSS, Javascript and Image files will be relative.
    • HtmlStamper

      public HtmlStamper()
      Initializes a new instance of the HtmlStamper class.
  • Method Details

    • getHtmlBaseUrl

      public final String getHtmlBaseUrl()
      Gets the HTML base URL for which references to external CSS, Javascript and Image files will be relative.
      Returns:
      the html base url
    • setHtmlBaseUrl

      public final void setHtmlBaseUrl(String value)
      Sets the HTML base URL for which references to external CSS, Javascript and Image files will be relative.
      Parameters:
      value - the value
    • getRenderDelay

      @Deprecated public final int getRenderDelay()
      Deprecated.
    • setRenderDelay

      @Deprecated public final void setRenderDelay(int value)
    • getTimeout

      public final int getTimeout()
      Gets timeout. Render timeout in seconds

      Default value is 60.

      Returns:
      the timeout
    • setTimeout

      public final void setTimeout(int value)
      Sets timeout. Render timeout in seconds

      Default value is 60.

      Parameters:
      value - the value
    • getCssMediaType

      public final CssMediaType getCssMediaType()
      Gets css media type. Enables Media="screen" CSS Styles and StyleSheets

      Note: By setting CssMediaType=PRINT, IronPdf renders Stamp from HTML using CSS for media="print" as if printing a web page in a browser print dialog. It renders exactly as per Google Chrome.

      Default value is CssMediaType.SCREEN.

      Returns:
      the css media type
    • setCssMediaType

      public final void setCssMediaType(CssMediaType value)
      Sets css media type. Enables Media="screen" CSS Styles and StyleSheets

      Note: By setting CssMediaType=PRINT, IronPdf renders Stamp from HTML using CSS for media="print" as if printing a web page in a browser print dialog. It renders exactly as per Google Chrome.

      Default value is CssMediaType.SCREEN.

      Parameters:
      value - the value