PdfDocumentControl Class

This class controls the properties of the PDF document generated by the HTML to PDF Converter. A reference to an object of this class is exposed by the Document property of the HtmlToPdf class

Definition

Namespace: HiQPdf.Chromium
Assembly: HiQPdf.Chromium (in HiQPdf.Chromium.dll) Version: 17.0.0
C#
public class PdfDocumentControl
Inheritance
Object    PdfDocumentControl

Properties

AutoResizePdfPageWidth Controls if the PDF page width is automatically resized to match the BrowserWidth at 96 DPI resolution. The PDF page height is given by the PageSize property. The default value is true
DigitalSignature The digital signature to apply to generated PDF document
DisplayHeaderFooter Indicates whether internal browser capabilities will be used to generate the header and footer based on the HeaderTemplate and FooterTemplate properties. This provides basic support for adding HTML with page numbering in the header and footer. For more advanced options, use the PdfHtmlHeader and PdfHtmlFooter properties instead. The default value is false.
FooterTemplate The HTML template used for the PDF document footer. It should be valid HTML markup and may include the following CSS classes to inject dynamic values: date (formatted print date), title (document title), url (document location), pageNumber (current page number), and totalPages (total number of pages). For example, <span class="title"></span> will render a span containing the document title. This template is used only if the DisplayHeaderFooter property is true. For advanced scenarios, use the PdfHtmlFooter property. If null or empty, a default template will be applied.
GenerateDocumentOutline Controls if the generated PDF document will have an outline with bookmarks create from HTML heading tags. The default is false
GenerateTableOfContents Controls if a table of contents is automatically created in the PDF document from HTML heading tags. The default is false
GenerateTaggedPdf Controls if the generated PDF document will be tagged for accessibility. The default is false
HeaderTemplate The HTML template used for the PDF document header. It should be valid HTML markup and may include the following CSS classes to inject dynamic values: date (formatted print date), title (document title), url (document location), pageNumber (current page number), and totalPages (total number of pages). For example, <span class="title"></span> will render a span containing the document title. This template is used only if the DisplayHeaderFooter property is true. For advanced scenarios, use the PdfHtmlHeader property. If null or empty, a default template will be applied.
Margins The PDF document margins. By default all the margins are 0
MaxPageCount The maximum number of PDF pages to create. The default value is 0 to convert the entire HTML document to PDF
PageOrientation The PDF document pages orientation. The default orientation is potrait
PageSize The PDF document page size. The default value is A4
PdfHtmlFooter The generated PDF document footer based on a HTML template given by Html and HtmlBaseUrl properties or by the HtmlSourceUrl property
PdfHtmlHeader The generated PDF document header based on a HTML template given by Html and HtmlBaseUrl properties or by the HtmlSourceUrl property
PreferCssPageSize A flag indicating if to prefer page size as defined by css. The default value is false and the HTML content will be scaled to fit the page size specified by PdfPageSize property
PrintBackgrounds Controls if background graphics are printted by HTML to PDF converter. The default is true.
Properties Controls the title, subject, keywords, author and the creation date of the PDF document
RepeatTableHeaderFooter Enables automatic repetition of HTML table header (thead) and footer (tfoot) sections on each page when converting the HTML to PDF. It is useful for long tables that span multiple pages, ensuring headers and footers remain visible throughout. Styling rules intended for print layout will be applied when rendering the repeated sections. The default value is false.
Security The object exposed by this property can be used to password protect the PDF document, disable printing, copying or editing of the PDF document
TableOfContents Controls the table of the contents automatically created in the PDF document from HTML heading tags
UseBrowserOutlineMode Controls if the document outline is created in browser mode. The default is false
Viewer Controls the PDF viewer preferences

Methods

AddEndPdf(Byte) Add a PDF to the list of documents to be included after the converted HTML content in the final PDF
AddEndPdf(String) Add a PDF from a file to the list of documents to be included after the converted HTML content in the final PDF
AddHtmlTemplate(Int32, Int32, Int32, String) Creates a HTML Template object based on the HTML string and an optional base URL. The height of template is auto-resized. To create a template with fixed height use the method with height parameter
AddHtmlTemplate(Int32, Int32, Int32, Int32, String) Creates a HTML Template object based on URL from which the HTML content should be retrieved. The height of template is fixed. If AutoResizeHeight is true, the HTML content may be scaled down to fit the specified height
AddHtmlTemplate(Int32, Int32, Int32, String, String) Creates a HTML Template object to be rendered in PDF pages based on the HTML string and an optional base URL. The height of template is auto-resized. To create a template with fixed height use the method with height parameter
AddHtmlTemplate(Int32, Int32, Int32, PdfTemplateHorizontalAlign, PdfTemplateVerticalAlign, String) Creates a HTML Template object based on the HTML string and an optional base URL. Specifies the horizontal and the vertical alignment of the template on the PDF page. The alignment takes precedence over the X and Y coordinates when set to a value other than None. The height of template is auto-resized. To create a template with fixed height use the method with height parameter
AddHtmlTemplate(Int32, Int32, Int32, Int32, String, String) Creates a HTML Template object to be rendered in PDF pages based on the HTML string and an optional base URL. The height of template is fixed. If AutoResizeHeight is true, the HTML content may be scaled down to fit the specified height
AddHtmlTemplate(Int32, Int32, Int32, PdfTemplateHorizontalAlign, PdfTemplateVerticalAlign, String, String) Creates a HTML Template object to be rendered in PDF pages based on the HTML string and an optional base URL. Specifies the horizontal and the vertical alignment of the template on the PDF page. The alignment takes precedence over the X and Y coordinates when set to a value other than None. The height of template is auto-resized. To create a template with fixed height use the method with height parameter
AddHtmlTemplate(Int32, Int32, Int32, Int32, PdfTemplateHorizontalAlign, PdfTemplateVerticalAlign, String) Creates a HTML Template object based on URL from which the HTML content should be retrieved. Specifies the horizontal and the vertical alignment of the template on the PDF page. The alignment takes precedence over the X and Y coordinates when set to a value other than None. The height of template is fixed. If AutoResizeHeight is true, the HTML content may be scaled down to fit the specified height
AddHtmlTemplate(Int32, Int32, Int32, Int32, PdfTemplateHorizontalAlign, PdfTemplateVerticalAlign, String, String) Creates a HTML Template object to be rendered in PDF pages based on the HTML string and an optional base URL. Specifies the horizontal and the vertical alignment of the template on the PDF page. The alignment takes precedence over the X and Y coordinates when set to a value other than None. The height of template is fixed. If AutoResizeHeight is true, the HTML content may be scaled down to fit the specified height.
AddStartPdf(Byte) Add a PDF from a memory buffer to the list of documents to be included before the converted HTML content in the final PDF
AddStartPdf(String) Add a PDF from a file to the list of documents to be included before the converted HTML content in the final PDF
Equals
(Inherited from Object)
Finalize
(Inherited from Object)
GetHashCode
(Inherited from Object)
GetType
(Inherited from Object)
MemberwiseClone
(Inherited from Object)
ToString
(Inherited from Object)

See Also