ConversionOptions

DynamicPDF HTML Converter supports formatting PDF output using the ConversionOptions class. Features include, adding PDF metadata and formatting the PDF document. For more details, refer to the ConversionOptions API documentation. The following example illustrates some of the formatting you can apply to document.

string outputDocumentPath = "./tale-two-cities--document.pdf";
string taleOfTwoCities = "https://www.gutenberg.org/files/98/98-h/98-h.htm";
Uri resolvePath = new Uri(taleOfTwoCities);
double leftRightMarginsPts = 36;
double topBottomMarginsPts = 144;

ConversionOptions conversionOptions = new ConversionOptions(PageSize.Letter, 
  PageOrientation.Portrait, leftRightMarginsPts, topBottomMarginsPts);
conversionOptions.Author = "Charles Dickens";
conversionOptions.Creator = "James B";
conversionOptions.Title = "A Tale of Two Cities";
conversionOptions.Subject = "Guttenberg press version of Charles Dickens\'s"
  + "A Tale of Two Cities.";
conversionOptions.Header = "<div style = 'text-align:center;width:100%"
  + ";font-size:15em;'>A Tale of Two Cities</div>";
Converter.Convert(resolvePath, outputDocumentPath, conversionOptions);
Dim outputDocumentPath As String = "./tale-two-cities--document.pdf"
Dim taleOfTwoCities As String = "https://www.gutenberg.org/files/98/98-h/98-h.htm"
Dim resolvePath As Uri = New Uri(taleOfTwoCities)
Dim leftRightMarginsPts As Double = 36
Dim topBottomMarginsPts As Double = 144

Dim conversionOptions As ConversionOptions = New ConversionOptions(PageSize.Letter,
  PageOrientation.Portrait, leftRightMarginsPts, topBottomMarginsPts)
conversionOptions.Author = "Charles Dickens"
conversionOptions.Creator = "James B"
conversionOptions.Title = "A Tale of Two Cities"
conversionOptions.Subject = "Guttenberg press version of Charles Dickens\'s" &
  "A Tale of Two Cities."
conversionOptions.Header = "<div style = 'text-align:center;width:100%" & 
  ";font-size:15em;'>A Tale of Two Cities</div>"
Converter.Convert(resolvePath, outputDocumentPath, conversionOptions)

ConversionOptions supports the following properties.

Properties
Author Gets or sets the Author for metadata in converted PDF.
BottomMargin Gets or sets the bottom margin of the page in points.
Creator Gets or sets the Creator for metadata in converted PDF.
Footer Gets or sets Footer
Header Gets or sets Header
Height Gets or sets the width of the page in points.
IncludeBackground Gets or sets the include back ground in bool.
Keywords Gets or sets the Keywords for metadata in converted PDF.
LeftMargin Gets or sets the left margin of the page in points.
OverrideCssPageSize Gets or sets the override css page size in bool.
Producer Gets or sets the Producer for metadata in converted PDF.
RightMargin Gets or sets the right margin of the page in points.
Subject Gets or sets the Subject for metadata in converted PDF.
Title Gets or sets the Title for metadata in converted PDF.
TopMargin Gets or sets the top margin of the page in points.
Width Gets or sets the width of the page in points.
Zoom Determines the magnification level for the HTML. [0.1 to 2.0]

In this topic