Conversion Options
Use the ConversionOptions class to set conversion options when using the Converter or one of it's child classes.
Properties
The ConversionOptions class has the following properties:
- AppendToPdf,
- Author,
- BottomMargin,
- CancelToken,
- Creator,
- Height,
- Keywords,
- LeftMargin,
- Logging,
- PaperKind,
- Producer,
- RightMargin,
- Subject,
- TemporaryDirectory,
- Title,
- TopMargin, and
- Width.
Refer to the Converter Logging documentation topic for more information on logging.
Example
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)
Child Classes
The ConversionOptions
class is the parent class for the following specific conversion options classes.
ExcelConversionOptions
,HtmlConversionOptions
,ImageConversionOptions
,PowerPointConversionOptions
,RtfConversionOptions
,TextConversionOptions
,TiffConversionOptions
,VisioConversionOptions
, andWordConversionOptions
.
If you do not need any file-specific conversion options, then you can use the ConversionOptions
parent class.
The Converter.Convert
method can also use specific file conversion options if necessary. The following example illustrates using an ImageConversionOptions
instance with the static Converter.Convert
method.
ImageConversionOptions options = new ImageConversionOptions(PageSize.Legal, PageOrientation.Portrait, 50);
options.ExpandToFit = true;
Converter.Convert(@"large-logo.png"), outputPdf, options);
Dim options As New ImageConversionOptions(PageSize.Legal, PageOrientation.Portrait, 50)
Converter.Convert("large-logo.png", outputPdf, options)