File Specific Conversion Options

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

HtmlConversionOptions

This class specifies available settings for HTML to PDF conversion. Use this class with the HtmlConverter object or Converter.Convert static method which takes the options as a parameter.

HtmlConversionOptions htmlConversionOptions = new HtmlConversionOptions(480, 720, 36);
 
//Options with HtmlConverter class                     
HtmlConverter htmlConverter = new HtmlConverter(new Uri("http://www.dynamicpdf.com"),
  htmlConversionOptions);
htmlConverter.Convert(outPath);
                        
//OR
Converter.Convert(inPath, outPath, htmlConversionOptions);
Dim MyHtmlConversionOptions As HtmlConversionOptions = New HtmlConversionOptions(480,
  720, 36)
 
'Options with HtmlConverter class                      
Dim MyHtmlConverter As HtmlConverter = New HtmlConverter(New
  Uri("http://www.dynamicpdf.com"), MyHtmlConversionOptions)
MyHtmlConverter.Convert(outPath)
 
'Or
Converter.Convert(inPath, outPath, MyHtmlConversionOptions)

ImageConversionOptions & Tiffconversionoptions

Use these classes for image conversion and specific tiff image options such as PageRange. The sample code below demonstrates using ImageConversionOptions.

ImageConversionOptions imageConversionOptions = new ImageConversionOptions(PageSize.A4,  
    PageOrientation.Landscape, 36);
 imageConversionOptions.ImageSizeAsPageSize = true;

 ImageConverter imageConverter = new ImageConverter(inPath, imageConversionOptions);
 imageConverter.Convert(outPath);
                        
 //OR image options can also be used with Converter.Convert static method
 Converter.Convert(inPath,outPath, imageConversionOptions);
 Dim MyImageConversionOptions As ImageConversionOptions = New ImageConversionOptions(PageSize.A4, PageOrientation.Landscape, 36)
 MyImageConversionOptions.ImageSizeAsPageSize = True

 Dim MyImageConverter As ImageConverter = New ImageConverter(inPath, MyImageConversionOptions)
 MyImageConverter.Convert(outPath)
                        
 'OR, image options can also be used with Converter.Convert static method
 Converter.Convert(inPath, outPath, MyImageConversionOptions)

The following sample code demonstrates using TiffConversionOptions.

 TiffConversionOptions tiffConversionOptions = new TiffConversionOptions(500, 500, 12);
 tiffConversionOptions.PageRange.StartPageNumber = 2;
 tiffConversionOptions.PageRange.EndPageNumber = 5;
 
 ImageConverter imageConverter = new ImageConverter(inPath, tiffConversionOptions);
 imageConverter.Convert(outPath);
                        
 //OR image options can also be used with Converter.Convert static method
 Converter.Convert(inPath, outPath, tiffConversionOptions);
 Dim MyTiffConversionOptions As TiffConversionOptions = New TiffConversionOptions(500, 500, 12)
 MyTiffConversionOptions.PageRange.StartPageNumber = 2
 MyTiffConversionOptions.PageRange.EndPageNumber = 5

 Dim MyImageConverter As ImageConverter = New ImageConverter(inPath, MyTiffConversionOptions)
 MyImageConverter.Convert(outPath)

 'OR, image options can also be used with Converter.Convert static method
 Converter.Convert(inPath, outPath, MyTiffConversionOptions)

RtfConversionOptions

The following sample code demonstrates RTF to PDF Conversion with options.

 RtfConversionOptions rtfConversionOptions = new RtfConversionOptions(PageSize.Letter, PageOrientation.Portrait, 36);
 rtfConversionOptions.Title = "RTF Document";

 RtfConverter rtfConverter = new RtfConverter(inPath, rtfConversionOptions);
 rtfConverter.Convert(outPath);
 
 //OR
 Converter.Convert(inPath, outPath, rtfConversionOptions);
 Dim MyRtfConversionOptions As RtfConversionOptions = New RtfConversionOptions(PageSize.Letter, PageOrientation.Portrait, 36)
 MyRtfConversionOptions.Title = "RTF Document"

 Dim RtfConverter As RtfConverter = New RtfConverter(inPath, MyRtfConversionOptions)
 RtfConverter.Convert(outPath)

 'Or
 Converter.Convert(inPath, outPath, MyRtfConversionOptions)

TextConversionOptions

The code below demonstrates Text to PDF Conversion with options.

 TextConversionOptions textConversionOptions = new TextConversionOptions(PageSize.Legal, PageOrientation.Portrait, 72);
 
 TextConverter textConverter = new TextConverter(inPath, textConversionOptions);
 textConverter.Convert(outPath);
                        
 //OR
 Converter.Convert(inPath, outPath, textConversionOptions);
 Dim MyTextConversionOptions As TextConversionOptions = New TextConversionOptions(PageSize.Legal, PageOrientation.Portrait, 72)
 
 Dim TextConverter As TextConverter = New TextConverter(inPath, MyTextConversionOptions)
 TextConverter.Convert(outPath)

 'Or
 Converter.Convert(inPath, outPath, MyTextConversionOptions)

WordConversionOptions

The following code demonstrates Word to PDF Conversion with options.

 WordConversionOptions wordConversionOptions = new WordConversionOptions(PageSize.Letter, PageOrientation.Portrait, 36);
 
 WordConverter wordConverter = new WordConverter(inPath, wordConversionOptions); 
 wordConverter.Convert(outPath);
                        
 //OR
 Converter.Convert(inPath, outPath, wordConversionOptions);
 Dim MyWordConversionOptions As WordConversionOptions = New WordConversionOptions(PageSize.Letter, PageOrientation.Portrait, 36)
 
 Dim WordConverter As WordConverter = New WordConverter(inPath, MyWordConversionOptions)
 WordConverter.Convert(outPath)
                        
 'Or
 Converter.Convert(inPath, outPath, MyWordConversionOptions)

In this topic