Table of Contents

Class PdfDocumentOptions

Namespace
EvoPdf
Assembly
evohtmltopdf.dll

This class encapsulates the options to control the PDF document redering process. The HtmlToPdfConverter class define a reference to an object of this type.

[ClassInterface(ClassInterfaceType.AutoDual)]
public class PdfDocumentOptions
Inheritance
PdfDocumentOptions
Inherited Members

Constructors

PdfDocumentOptions()

public PdfDocumentOptions()

Properties

AutoCloseExternalDocs

This flag indicates if the external documents added by the AddStartDocument() and AddEndDocument() are automatically closed after the final document was generated. By default the external documents are closed

public bool AutoCloseExternalDocs { get; set; }

Property Value

bool

AutoSizePdfPage

When the property AutoSizePdfPage property is true the HTML to PDF converter will automatically calculate the PDF page size such that all the HTML content will be visible in the resulted PDF document. This property has effect only when the FitWidth and FitHeight properties are false. When the FitWidth property is false (the HTML content is rendered at real size) and the AutoSizePdfPage is false the rendered HTML content could be cut off at the right of the generated PDF document if the PDF page is not wide enough to display the whole content. This property is true by default

public bool AutoSizePdfPage { get; set; }

Property Value

bool

AvoidHtmlElementsBreakSelectors

Gets or sets the CSS selectors of the HTML elements to not be broken between PDF pages if possible

public string[] AvoidHtmlElementsBreakSelectors { get; set; }

Property Value

string[]

AvoidImageBreak

When true this property instructs the HTML to PDF converter to try to avoid cutting off the images between PDF pages. By default this property is false

public bool AvoidImageBreak { get; set; }

Property Value

bool

AvoidTextBreak

When true this property instructs the HTML to PDF converter to try to avoid cutting off the text between PDF pages. By default this property is true.

public bool AvoidTextBreak { get; set; }

Property Value

bool

BackColor

The PDF pages background color

public Color BackColor { get; set; }

Property Value

Color

BottomMargin

The rendered PDF document bottom margin in points. 1 point is 1/72 inch. By default the left margin is 0.

public float BottomMargin { get; set; }

Property Value

float

BottomSpacing

A space in points to introduce at the bottom of PDF pages where the HTML is rendered. 1 point is 1/72 inch. By default the bottom spacing is 0.

public float BottomSpacing { get; set; }

Property Value

float

ColorProfile

Gets or sets the color profile of the PDF document generated by the HTML to PDF converter.

public ColorProfile ColorProfile { get; set; }

Property Value

ColorProfile

ColorSpace

Gets or sets the color space of the PDF document generated by the HTML to PDF converter. The possible values are RGB, CMYK or Gray Scale. The default color space is RGB.

public ColorSpace ColorSpace { get; set; }

Property Value

ColorSpace

CompressCrossReference

Set this property on true to store the cross-reference table and the trailer of the PDF document generated by the HTML to PDF converter in compressed cross-reference streams and to reduce the PDF file size. The default value is false

public bool CompressCrossReference { get; set; }

Property Value

bool

DocumentObject

A reference to the internal Document object initialized by converter during conversion

public Document DocumentObject { get; }

Property Value

Document

EmbedFonts

When true this option instructs the HTML to PDF converter to embed all the true type fonts in the PDF document generated by the HTML to PDF converter. The default value of this property is true

public bool EmbedFonts { get; set; }

Property Value

bool

EnhancedGraphicsQuality

A flag indicating the PDF graphics are rendered at the best quality in the PDF document generated by the HTML to PDF converter. The default property value is true

public bool EnhancedGraphicsQuality { get; set; }

Property Value

bool

FitHeight

When this property is true the HTML content will be resized if necessary to fit the available height in PDF page of the PDF document generated by the HTML to PDF converter. By default this property is false.

public bool FitHeight { get; set; }

Property Value

bool

FitWidth

When this property is true the HTML content will be resized if necessary to fit the available width in PDF page of the PDF document generated by the HTML to PDF converter. By default this property is true and the content will be resized if necessary to fit the available width in PDF page. When this property is false the HTML content is not resized (is rendered at the real size) and therefore it could be cut off at the right size if the PDF page is not enough wide to display the whole HTML content. In this case the AutoSizePdfPage property can be set on true to automatically resize the PDF page width to display the whole content.

public bool FitWidth { get; set; }

Property Value

bool

Height

The height in points of the destination rectangle in PDF page where the HTML content is rendered. By default the destination height is automatically calculated to render the whole HTML content

public float Height { get; set; }

Property Value

float

ImagesScalingEnabled

A flag indicating if the images scaling is allowed in the PDF document generated by the HTML to PDF converter. The default property value is false

public bool ImagesScalingEnabled { get; set; }

Property Value

bool

InteractiveHiddenElements

A flag indicating if the interactive features are enabled for hidden HTML elements. This property is false by default

public bool InteractiveHiddenElements { get; set; }

Property Value

bool

InternalLinksEnabled

When true this option instructs the HTML to PDF converter to convert the internal HTML links (links with anchors) to internal PDF links in the PDF document generated by the HTML to PDF converter. The default value is true.

public bool InternalLinksEnabled { get; set; }

Property Value

bool

JpegCompressionEnabled

Gets or sets a flag indicating if the JPEG compression is enabled or not for the images in the PDF document created by the HTML to PDF converter. By default the JPEG compression is enabled to reduce the size of the generated PDF. When the JPEG compression is enabled the quality of the images in the generated PDF is lower than the quality of the original images in the HTML document, function of the JpegCompressionLevel parameter. When the JpegCompressionLevel is increased, the quality of the images in PDF decreases.

public bool JpegCompressionEnabled { get; set; }

Property Value

bool

JpegCompressionLevel

Gets or sets the compression level of images in the PDF document generated by the HTML to PDF converter as an integer value between 0 and 100. This property has effect only when the JpegCompressionEnabled is true. When the JpegCompressionLevel is 0, the compression rate is the lowest and the quality of the images is the best. When the JpegCompressionLevel is 100, the compression rate is the highest and quality of the images in PDF is the worst. The default JPEG compression level is 10, which should offer a good balance between the compression rate and the quality of the images in PDF.

public int JpegCompressionLevel { get; set; }

Property Value

int

LeftMargin

The rendered PDF document left margin in points. 1 point is 1/72 inch. By default the left margin is 0.

public float LeftMargin { get; set; }

Property Value

float

LiveUrlsEnabled

When true this option instructs the HTML to PDF converter to convert the external links from HTML to PDF links in the PDF document generated by the HTML to PDF converter. The default value is true.

public bool LiveUrlsEnabled { get; set; }

Property Value

bool

NoSizeElementsEnabled

A flag indicating if the hidden elements are rendered in the PDF document generated by the HTML to PDF converter. The default property value is false

public bool NoSizeElementsEnabled { get; set; }

Property Value

bool

PageBreakAfterHtmlElementsSelectors

Gets or sets the CSS selectors of the HTML elements after which to force a page break in PDF document

public string[] PageBreakAfterHtmlElementsSelectors { get; set; }

Property Value

string[]

PageBreakBeforeHtmlElementsSelectors

Gets or sets the CSS selectors of the HTML elements before which to force a page break in PDF document

public string[] PageBreakBeforeHtmlElementsSelectors { get; set; }

Property Value

string[]

PdfCompressionLevel

This property controls the compression level of the PDF document created by the HTML to PDF converter.

public PdfCompressionLevel PdfCompressionLevel { get; set; }

Property Value

PdfCompressionLevel

PdfPageOrientation

This property controls the page orientation of the pages of the PDF document generated by the HTML to PDF converter. The default orientation is Portrait.

public PdfPageOrientation PdfPageOrientation { get; set; }

Property Value

PdfPageOrientation

PdfPageSize

This property controls the page size of the PDF document generated by the HTML to PDF converter. The default size of the PDF document page is A4

public PdfPageSize PdfPageSize { get; set; }

Property Value

PdfPageSize

PdfStandardSubset

Defines the PDF subset used by the PDF document generated by the HTML to PDF converter. The default value is Full. This property can be used to instruct the converter to generate PDF/A or PDF/X compliant documents.

public PdfStandardSubset PdfStandardSubset { get; set; }

Property Value

PdfStandardSubset

RightMargin

The rendered PDF document right margin in points. 1 point is 1/72 inch. By default the right margin is 0.

public float RightMargin { get; set; }

Property Value

float

ShowFooter

This property controls the whether the footer appears or not in the PDF document generated by the HTML to PDF converter. The footer properties can be further customized by setting the properties of object exposed by the PdfFooterOptions property of the HtmlToPdfConverter class. The default value of this property is false.

public bool ShowFooter { get; set; }

Property Value

bool

ShowHeader

This property controls the whether the header appears or not in the PDF document generated by the HTML to PDF converter. The header properties can be further customized by setting the properties of object exposed by the PdfHeaderOptions property of the HtmlToPdfConverter class. The default value of this property is false.

public bool ShowHeader { get; set; }

Property Value

bool

SinglePage

When this property is true the HTML to PDF converter will generate a single PDF page with a custom size calculated to display the whole HTML content and any specified header and footer. If the FitWidth property is true the specified PDF page width will be preserved, otherwise the PDF page width is automatically calculated by the converter to display the whole HTML content at real size.

public bool SinglePage { get; set; }

Property Value

bool

StackRepeatedTableFooters

Gets or sets a flag indicating if the repeated HTML table footers are stacked at the bottom of the PDF page when multiple HTML tables have repeated footers on that PDF page. Default value is true

public bool StackRepeatedTableFooters { get; set; }

Property Value

bool

StackRepeatedTableHeaders

Gets or sets a flag indicating if the repeated HTML table headers are stacked at the top of the PDF page when multiple HTML tables have repeated headers on that PDF page. Default value is true

public bool StackRepeatedTableHeaders { get; set; }

Property Value

bool

StretchToFit

This property has effect in HTML to PDF converter only when FitWidth property is true. When FitWidth is true and this property is true the HTML content will be stretched if necessary to fit the available width in PDF page. By default this property is false and the content will not be stretched to fit the available width in PDF page.

public bool StretchToFit { get; set; }

Property Value

bool

TableFooterRepeatEnabled

Gets or sets a flag indicating if the repeating of the HTML table footer in PDF pages is enabled in the PDF document generated by the HTML to PDF converter. Default value is true

public bool TableFooterRepeatEnabled { get; set; }

Property Value

bool

TableHeaderRepeatEnabled

Gets or sets a flag indicating if the repeating of the HTML table header in PDF pages is enabled in the PDF document generated by the HTML to PDF converter. Default value is true

public bool TableHeaderRepeatEnabled { get; set; }

Property Value

bool

TiledRenderingEnabled

A flag indicating if rendering of HTML document is tiled in the PDF document generated by the HTML to PDF converter. This property is true by default

public bool TiledRenderingEnabled { get; set; }

Property Value

bool

TopMargin

The rendered PDF document top margin in points. 1 point is 1/72 inch. By default the top margin is 0.

public float TopMargin { get; set; }

Property Value

float

TopSpacing

A space in points to introduce at the top of PDF pages where the HTML is rendered. 1 point is 1/72 inch. By default the top spacing is 0.

public float TopSpacing { get; set; }

Property Value

float

TransparencyEnabled

Gets or sets a flag indicating if the transparency is enabled in the PDF document generated by the HTML to PDF converter. Default value is true. This property can be set to false to eliminate the additional flattening time when the document is sent to the printer from Adobe Reader viewer.

public bool TransparencyEnabled { get; set; }

Property Value

bool

TransparentImagesEnabled

A flag indicating if the converter uses transparency information of the images in the PDF document generated by the HTML to PDF converter. The default property value is true

public bool TransparentImagesEnabled { get; set; }

Property Value

bool

Width

The width in points of the destination rectangle in PDF page where the HTML content is rendered. By default the destination width is the available width in PDF page

public float Width { get; set; }

Property Value

float

X

The X coordinate in points where to start HTML rendering in first page. By default the left location is 0

public float X { get; set; }

Property Value

float

Y

The Y coordinate in points where to start HTML rendering in first page. By default the top location is 0

public float Y { get; set; }

Property Value

float

Methods

AddEndDocument(Document)

Adds a PDF document object after the result of HTML to PDF conversion. If the AutoCloseExternalDocs property is true the added document will be automatically closed when the final document is closed or saved. The header and footer are not applied to the PDF documents added by this method. If you want to enable the header and footer in the added PDF document use the AddEndDocument(Document, bool, bool, bool)

public void AddEndDocument(Document pdfDocument)

Parameters

pdfDocument Document

The document to be inserted after conversion result

AddEndDocument(Document, bool, bool, bool)

Adds a PDF document object after the result of HTML to PDF conversion. If the AutoCloseExternalDocs property is true the added document will be automatically closed when the final document is closed or saved

public void AddEndDocument(Document pdfDocument, bool enableHeaderAndFooter, bool drawHeaderOnFirstPage, bool drawFooterOnFirstPage)

Parameters

pdfDocument Document

The document to be inserted after conversion result

enableHeaderAndFooter bool

A flag indicating if the header and footer can be applied to the added document when the document was created from an external file or stream. If this parameter is true then the interactive features like links and bookmarks are disabled in the added PDF document

drawHeaderOnFirstPage bool

A flag indicating if the header is drawn on first page of the appended document

drawFooterOnFirstPage bool

A flag indicating if the footer is drawn in first page of the appended document

AddEndDocument(Stream)

Adds a PDF document from the given stream after the result of HTML to PDF conversion. If the AutoCloseExternalDocs property is true the added document will be automatically closed when the final document is closed or saved. The header and footer are not applied to the PDF documents added by this method. If you want to enable the header and footer in the added PDF document use the AddEndDocument(Stream, bool, bool, bool)

public void AddEndDocument(Stream pdfStream)

Parameters

pdfStream Stream

The stream from where to read the PDF document to be inserted after conversion result

AddEndDocument(Stream, bool, bool, bool)

Adds a PDF document from the given stream after the result of HTML to PDF conversion. If the AutoCloseExternalDocs property is true the added document will be automatically closed when the final document is closed or saved

public void AddEndDocument(Stream pdfStream, bool enableHeaderAndFooter, bool drawHeaderOnFirstPage, bool drawFooterOnFirstPage)

Parameters

pdfStream Stream

The stream from where to read the PDF document to be inserted after conversion result

enableHeaderAndFooter bool

A flag indicating if the header and footer can be applied to the added document. If this parameter is true then the interactive features like links and bookmarks are disabled in the added PDF document

drawHeaderOnFirstPage bool

A flag indicating if the header is drawn on first page of the appended document

drawFooterOnFirstPage bool

A flag indicating if the footer is drawn in first page of the appended document

AddEndDocument(string)

Adds a PDF document from the given file after the result of HTML to PDF conversion. If the AutoCloseExternalDocs property is true the added document will be automatically closed when the final document is closed or saved. The header and footer are not applied to the PDF documents added by this method. If you want to enable the header and footer in the added PDF document use the AddEndDocument(string, bool, bool, bool)

public void AddEndDocument(string pdfFile)

Parameters

pdfFile string

The full path of the PDF file to be inserted after conversion result

AddEndDocument(string, bool, bool, bool)

Adds a PDF document from the given file after the result of HTML to PDF conversion. If the AutoCloseExternalDocs property is true the added document will be automatically closed when the final document is closed or saved

public void AddEndDocument(string pdfFile, bool enableHeaderAndFooter, bool drawHeaderOnFirstPage, bool drawFooterOnFirstPage)

Parameters

pdfFile string

The full path of the PDF file to be inserted after conversion result

enableHeaderAndFooter bool

A flag indicating if the header and footer can be applied to the added document. If this parameter is true then the interactive features like links and bookmarks are disabled in the added PDF document

drawHeaderOnFirstPage bool

A flag indicating if the header is drawn on first page of the appended document

drawFooterOnFirstPage bool

A flag indicating if the footer is drawn in first page of the appended document

AddStartDocument(Document)

Adds a PDF document object before the result of HTML to PDF conversion. If the AutoCloseExternalDocs property is true the added document will be automatically closed when the final document is closed or saved. The header and footer are not applied to the PDF documents added by this method. If you want to enable the header and footer in the added PDF document use the AddStartDocument(Document, bool, bool, bool)

public void AddStartDocument(Document pdfDocument)

Parameters

pdfDocument Document

The document to be inserted before conversion result

AddStartDocument(Document, bool, bool, bool)

Adds a PDF document object before the result of HTML to PDF conversion. If the AutoCloseExternalDocs property is true the added document will be automatically closed when the final document is closed or saved.

public void AddStartDocument(Document pdfDocument, bool enableHeaderAndFooter, bool drawHeaderOnFirstPage, bool drawFooterOnFirstPage)

Parameters

pdfDocument Document

The document to be inserted before conversion result

enableHeaderAndFooter bool

A flag indicating if the header and footer can be applied to the added document when the document was created from an external file or stream. If this parameter is true then the interactive features like links and bookmarks are disabled in the added PDF document

drawHeaderOnFirstPage bool

A flag indicating if the header is drawn on first page of the appended document

drawFooterOnFirstPage bool

A flag indicating if the footer is drawn in first page of the appended document

AddStartDocument(Stream)

Adds a PDF document from the given stream before the result of HTML to PDF conversion. If the AutoCloseExternalDocs property is true the added document will be automatically closed when the final document is closed or saved. The header and footer are not applied to the PDF documents added by this method. If you want to enable the header and footer in the added PDF document use the AddStartDocument(Stream, bool, bool, bool)

public void AddStartDocument(Stream pdfStream)

Parameters

pdfStream Stream

The stream from where to read the PDF document to be inserted before conversion result

AddStartDocument(Stream, bool, bool, bool)

Adds a PDF document from the given stream before the result of HTML to PDF conversion. If the AutoCloseExternalDocs property is true the added document will be automatically closed when the final document is closed or saved

public void AddStartDocument(Stream pdfStream, bool enableHeaderAndFooter, bool drawHeaderOnFirstPage, bool drawFooterOnFirstPage)

Parameters

pdfStream Stream

The stream from where to read the PDF document to be inserted before conversion result

enableHeaderAndFooter bool

A flag indicating if the header and footer can be applied to the added document. If this parameter is true then the interactive features like links and bookmarks are disabled in the added PDF document

drawHeaderOnFirstPage bool

A flag indicating if the header is drawn on first page of the appended document

drawFooterOnFirstPage bool

A flag indicating if the footer is drawn in first page of the appended document

AddStartDocument(string)

Adds a PDF document from the given file before the result of HTML to PDF conversion. If the AutoCloseExternalDocs property is true the added document will be automatically closed when the final document is closed or saved. The header and footer are not applied to the PDF documents added by this method. If you want to enable the header and footer in the added PDF document use the AddStartDocument(string, bool, bool, bool)

public void AddStartDocument(string pdfFile)

Parameters

pdfFile string

The full path of the PDF file to be inserted before conversion result

AddStartDocument(string, bool, bool, bool)

Adds a PDF document from the given file before the result of HTML to PDF conversion. If the AutoCloseExternalDocs property is true the added document will be automatically closed when the final document is closed or saved

public void AddStartDocument(string pdfFile, bool enableHeaderAndFooter, bool drawHeaderOnFirstPage, bool drawFooterOnFirstPage)

Parameters

pdfFile string

The full path of the PDF file to be inserted before conversion result

enableHeaderAndFooter bool

A flag indicating if the header and footer can be applied to the added document. If this parameter is true then the interactive features like links and bookmarks are disabled in the added PDF document

drawHeaderOnFirstPage bool

A flag indicating if the header is drawn on first page of the appended document

drawFooterOnFirstPage bool

A flag indicating if the footer is drawn in first page of the appended document