Conversion Options

Use the ConversionOptions class to set conversion options when using the Converter or one of it's child classes. Typically, you would create one of the specific ConversionOptions subclasses, depending upon the Converter subclass used.

Converter

DynamicPDF Converter offers multiple conversion options depending on the file type being converted. The different option classes available are each discussed below for the following converters.

ConversionOptions

The ConversionOptions class is parent to the following classes:

Refer to File Specific Conversion Options for more information on the ConversionOptions child classes.

Properties

The ConversionOptions class has the following properties:

Refer to the ConversionOptions API documentation for more details.

Example

The following example demonstrates using the ConversionOptions class. The ConversionOptions class is the class used to specify available options for a specific conversion. Options such as the output page orientation, page size, margins, unit type, and whether to append to a current document are all handled using the ConversionOptions class.

Use the HtmlConversionOption object when calling the ConvertHtmlString method.

The following example illustrates setting a specific page size and margins for the output PDF. It then applies the conversion options to the Converter.Convert constructor as parameters which then convert the document.

ConversionOptions options = new ConversionOptions(720, 720, 72, true);
Converter.Convert(docxFilePath, pdfFilePath, options);
Dim options As ConversionOptions = New ConversionOptions(720, 720, 72, True)
Converter.Convert(docxFilePath, pdfFilePath, options)

Specific Converter Options

Depending upon the converter document type, you can also use the following conversion options classes. The following lists the specific converters and conversion options available.

Converter Class Name Corresponding Options
ExcelConverter ExcelConversionOptions
HtmlConverter HtmlConversionOptions
ImageConverter ImageConversionOptions
TiffConversionOptions
PowerPointConverter PowerPointConversionOptions
RtfConverter RtfConversionOptions
TextConverter TextConversionOptions
WordConverter WordConversionOptions

Refer to File Specific Conversion Options for more information.

GitHub Project

Refer to the converter-dotnet-core example project on GitHub for examples using C# and Visual Basic. Each converter class has an example that also demonstrates using the class's conversion options.

C# Visual Basic
HtmlFileConversion.cs HtmlFileConversion.vb
JpegImageConversion.cs JpegImageConversion.vb
JpgImageConversion.cs JpgImageConversion.vb
GifImageConversion.cs GifImageConversion.vb
PngImageConversion.cs PngImageConversion.vb
TiffImageConversion.cs TiffImageConversion.vb
TextFileConversion.cs TextFileConversion.vb
DocFileConversion.cs DocFileConversion.vb

In this topic