Skip to main content

ConversionOptions

Version: 2.0

cete.dynamicpdf.conversion.conversionoptions

ConversionOptions​

  • Namespace: ceTe.DynamicPDF.Conversion
  • Assemblies: DynamicPDF.Converter.NETFramework40.dll, DynamicPDF.Converter.NETStandard20.dll

Defines properties and methods for conversion options.

public class ConversionOptions : ISerializable
Public Class ConversionOptions
Implements ISerializable

Inheritance: Object → ConversionOptions

Implements: ISerializable

Derived: ExcelConversionOptions, HtmlConversionOptions, ImageConversionOptions, PowerPointConversionOptions, RtfConversionOptions, TextConversionOptions, TiffConversionOptions, WordConversionOptions

Examples​

This example shows how to add conversion options.

Imports ceTe.DynamicPDF.Conversion

Module Module1

Sub Main()

' Create a instance of ConversionOptions
Dim conversionOptions As ConversionOptions = New ConversionOptions(PageSize.Letter, PageOrientation.Portrait, 75)

' Call convert method to do conversion.
Converter.Convert("C:\MyDocument.doc", "C:\MyOutput.pdf", conversionOptions)

End Sub

End Module
using System;
using ceTe.DynamicPDF.Conversion;

class MyClass
{
static void Main()
{
// Create a instance of ConversionOptions class.
ConversionOptions option = new ConversionOptions(PageSize.Letter, PageOrientation.Portrait, 75f);

// Call convert method to do conversion.
Converter.Convert(@"C:\MyDocument.doc", @"C:\MyOutput.pdf", option);
}
}

Remarks​

This class is serialized.

Constructors​

ConversionOptions(Boolean)​

Initializes a new instance of the ConversionOptions class.

public ConversionOptions(bool appendToPdf)
Public Sub New (appendToPdf As Boolean)

Parameters​

Specify if append option to be enabled.

Examples​

This example shows how to add conversion options.

Imports ceTe.DynamicPDF.Conversion

Module Module1

Sub Main()

' Create a instance of ConversionOptions
Dim conversionOptions As ConversionOptions = New ConversionOptions(True)

' Call convert method to do conversion.
Converter.Convert("C:\MyDocument.doc", "C:\MyOutput.pdf", conversionOptions)

End Sub

End Module
using System;
using ceTe.DynamicPDF.Conversion;

class MyClass
{
static void Main()
{
// Create a instance of ConversionOptions class.
ConversionOptions option = new ConversionOptions(true);

// Call convert method to do conversion.
Converter.Convert(@"C:\MyDocument.doc", @"C:\MyOutput.pdf", option);
}
}

ConversionOptions(Double, Double, Double)​

Initializes a new instance of the ConversionOptions class.

public ConversionOptions(double width, double height, double margins)
Public Sub New (width As Double, height As Double, margins As Double)

Parameters​

The width of the page in points.

The height of the page in points.

The margins of the page in points.

Examples​

This example shows how to convert source file to PDF with custom page size.

Imports ceTe.DynamicPDF.Conversion

Module Module1

Sub Main()

' Create a instance of ConversionOptions
Dim conversionOptions As ConversionOptions = New ConversionOptions(600, 700, 50)

' Call convert method to do conversion.
Converter.Convert("C:\MyDocument.doc", "C:\MyOutput.pdf", conversionOptions)

End Sub

End Module
using System;
using ceTe.DynamicPDF.Conversion;

class MyClass
{
static void Main()
{
// Create a instance of ConversionOptions class.
ConversionOptions option = new ConversionOptions(600, 700, 50);

// Call convert method to do conversion.
Converter.Convert(@"C:\MyDocument.doc", @"C:\MyOutput.pdf", option);
}
}

ConversionOptions(Double, Double, Double, Boolean)​

Initializes a new instance of the ConversionOptions class.

public ConversionOptions(double width, double height, double margins, bool appendToPdf)
Public Sub New (width As Double, height As Double, margins As Double, appendToPdf As Boolean)

Parameters​

The width of the page in points.

The height of the page in points.

The margins of the page in points.

Specify if append option to be enabled.

Examples​

This example shows how to convert source file to PDF with custom page size and append to the existing PDF file.

using System;
using ceTe.DynamicPDF.Conversion;

class MyClass
{
static void Main()
{
// Create a instance of AsyncConverter
AsyncConverter converter = new AsyncConverter();

// Create a instance of ConversionOptions class.
ConversionOptions option = new ConversionOptions(550, 650, 75, true);

// Events to know if conversion completed successfully or not
converter.Converted += new ConvertedEventHandler(converter_Converted);
converter.ConversionError += new ConversionErrorEventHandler(converter_ConversionError);

// Call Convert method to start conversion asynchronously and Get the status of conversion
AsyncConversion asyncConversion = converter.Convert(@"C:\MyDocument.doc", @"C:\MyOutput.pdf", option);
}

private static void Converter_Converted(object sender, ConvertedEventArgs e)
{
Console.WriteLine(e.SourceFilePath + " was converted successfully.");
}

private static void Converter_ConversionError(object sender, ConversionErrorEventArgs e)
{
Console.WriteLine(e.SourceFilePath + " conversion failed for the following reason:");
Console.WriteLine("\"" + e.Exception.Message + "\"");
}
}

ConversionOptions(Double, Double, Double, Double)​

Initializes a new instance of the ConversionOptions class.

public ConversionOptions(double width, double height, double leftAndRightMargins, double topAndBottomMargins)
Public Sub New (width As Double, height As Double, leftAndRightMargins As Double, topAndBottomMargins As Double)

Parameters​

The width of the page in points.

The height of the page in points.

The left and right margins of the page in points.

The top and bottom margins of the page in points.

Examples​

This example shows how to convert source file to PDF with custom page size.

Imports ceTe.DynamicPDF.Conversion

Module Module1

Sub Main()

' Create a instance of ConversionOptions
Dim conversionOptions As ConversionOptions = New ConversionOptions(600, 700, 50, 40)

' Call convert method to do conversion.
Converter.Convert("C:\MyDocument.doc", "C:\MyOutput.pdf", conversionOptions)

End Sub

End Module
using System;
using ceTe.DynamicPDF.Conversion;

class MyClass
{
static void Main()
{
// Create a instance of ConversionOptions class.
ConversionOptions option = new ConversionOptions(600f,700f,50f,40f);

// Call convert method to do conversion.
Converter.Convert(@"C:\MyDocument.doc", @"C:\MyOutput.pdf", option);
}
}

ConversionOptions(Double, Double, Double, Double, Boolean)​

Initializes a new instance of the ConversionOptions class.

public ConversionOptions(double width, double height, double leftAndRightMargins, double topAndBottomMargins, bool appendToPdf)
Public Sub New (width As Double, height As Double, leftAndRightMargins As Double, topAndBottomMargins As Double, appendToPdf As Boolean)

Parameters​

The width of the page in points.

The height of the page in points.

The left and right margins of the page in points.

The top and bottom margins of the page in points.

Specify if append option to be enabled.

Examples​

This example shows how to convert source file to PDF with custom page size and append to the existing PDF file.

Imports ceTe.DynamicPDF.Conversion

Module Module1

Sub Main()

' Create a instance of ConversionOptions
Dim conversionOptions As ConversionOptions = New ConversionOptions(600, 700, 50, 40, True)

' Call convert method to do conversion.
Converter.Convert("C:\MyDocument.doc", "C:\MyOutput.pdf", conversionOptions)

End Sub

End Module
using System;
using ceTe.DynamicPDF.Conversion;

class MyClass
{
static void Main()
{
// Create a instance of ConversionOptions class.
ConversionOptions option = new ConversionOptions(600f, 700f, 50f, 40f, true);

// Call convert method to do conversion.
Converter.Convert(@"C:\MyDocument.doc", @"C:\MyOutput.pdf", option);
}
}

ConversionOptions(PageSize, PageOrientation, Double)​

Initializes a new instance of the ConversionOptions class.

public ConversionOptions(PageSize size, PageOrientation orientation, double margins)
Public Sub New (size As PageSize, orientation As PageOrientation, margins As Double)

Parameters​

The size of the page.

The orientation of the page.

The margins of the page in points.

Examples​

This example shows how to convert source file to PDF with predefined paper.

using System;
using System.IO;
using ceTe.DynamicPDF.Conversion;

class MyClass
{
static void Main()
{
// Create a instance of AsyncConverter
AsyncConverter converter = new AsyncConverter();

byte[] inputData = File.ReadAllBytes(@"C:\MyDocument.rtf");

// Create a instance of ConversionOptions class.
ConversionOptions option = new ConversionOptions(PageSize.A4, PageOrientation.Landscape, 75);

// Events to know if conversion completed successfully or not
converter.Converted += new ConvertedEventHandler(converter_Converted);
converter.ConversionError += new ConversionErrorEventHandler(converter_ConversionError);

// Call Convert method to start conversion asynchronously and Get the status of conversion
AsyncConversion asyncConversion = converter.Convert(inputData,@"MyDocument.rtf", @"C:\MyOutput.pdf",option);
}

private static void Converter_Converted(object sender, ConvertedEventArgs e)
{
Console.WriteLine(e.SourceFilePath + " was converted successfully.");
}

private static void Converter_ConversionError(object sender, ConversionErrorEventArgs e)
{
Console.WriteLine(e.SourceFilePath + " conversion failed for the following reason:");
Console.WriteLine("\"" + e.Exception.Message + "\"");
}
}

ConversionOptions(PageSize, PageOrientation, Double, Double, Boolean)​

Initializes a new instance of the ConversionOptions class.

public ConversionOptions(PageSize size, PageOrientation orientation, double leftAndRightMargins, double topAndBottomMargins, bool appendToPdf)
Public Sub New (size As PageSize, orientation As PageOrientation, leftAndRightMargins As Double, topAndBottomMargins As Double, appendToPdf As Boolean)

Parameters​

The size of the page.

The orientation of the page.

The left and right margins of the page in points.

The top and bottom margins of the page in points.

Specify if append option to be enabled.

Examples​

This example shows how to convert source file to PDF with predefined paper and append to the existing PDF file.

Imports ceTe.DynamicPDF.Conversion

Module Module1

Sub Main()

' Create a instance of ConversionOptions
Dim conversionOptions As ConversionOptions = New ConversionOptions(PageSize.Letter, PageOrientation.Portrait, 75, 75, True)

' Call convert method to do conversion.
Converter.Convert("C:\MyDocument.doc", "C:\MyOutput.pdf", conversionOptions)

End Sub

End Module
using System;
using ceTe.DynamicPDF.Conversion;

class MyClass
{
static void Main()
{
// Create a instance of ConversionOptions class.
ConversionOptions option = new ConversionOptions(PageSize.Letter, PageOrientation.Portrait, 75f, 75f, true);

// Call convert method to do conversion.
Converter.Convert(@"C:\MyDocument.doc", @"C:\MyOutput.pdf", option);
}
}

Properties​

AppendToPdf​

Gets or sets the boolean value to specify if append to pdf option to be enabled.

public bool AppendToPdf { get; set; }
Public Property AppendToPdf As Boolean

Property Value​

Boolean

Author​

Gets or sets the author meta data for the converted PDF.

public string Author { get; set; }
Public Property Author As String

Property Value​

String

BottomMargin​

Gets or sets the bottom margin of the page.

public double BottomMargin { get; set; }
Public Property BottomMargin As Double

Property Value​

Double

Creator​

Gets or sets the creator meta data for the converted PDF.

public string Creator { get; set; }
Public Property Creator As String

Property Value​

String

Height​

Gets or sets the height of the page in points.

public double Height { get; set; }
Public Property Height As Double

Property Value​

Double

Keywords​

Gets or sets the keywords meta data for the converted PDF.

public string Keywords { get; set; }
Public Property Keywords As String

Property Value​

String

LeftMargin​

Gets or sets the left margin of the page in points.

public double LeftMargin { get; set; }
Public Property LeftMargin As Double

Property Value​

Double

PaperKind​

Gets or sets paper kind for the pages properties.

public PaperKind PaperKind { get; set; }
Public Property PaperKind As PaperKind

Property Value​

PaperKind

Producer​

Gets or sets the producer meta data for the converted PDF.

public string Producer { get; set; }
Public Property Producer As String

Property Value​

String

RightMargin​

Gets or sets the right margin of the page in points.

public double RightMargin { get; set; }
Public Property RightMargin As Double

Property Value​

Double

Subject​

Gets or sets the subject meta data for the converted PDF.

public string Subject { get; set; }
Public Property Subject As String

Property Value​

String

Title​

Gets or sets the title meta data for the converted PDF.

public string Title { get; set; }
Public Property Title As String

Property Value​

String

TopMargin​

Gets or sets the top margin of the page in points.

public double TopMargin { get; set; }
Public Property TopMargin As Double

Property Value​

Double

Width​

Gets or sets the width of the page in points.

public double Width { get; set; }
Public Property Width As Double

Property Value​

Double

Methods​

Equals(Object)​

Determines whether the specified Object is equal to the current Object . (Inherited from Object)

public bool Equals(Object obj)
Function Equals(obj As Object) As Boolean

Parameters​

The Object to compare with the current Object .

Returns​

true if the specified Object is equal to the current Object ; otherwise, false.

GetHashCode()​

Serves as a hash function for a particular type. (Inherited from Object)

public int GetHashCode()
Function GetHashCode() As Integer

Returns​

A hash code for the current Object .

GetObjectData(SerializationInfo, StreamingContext)​

Used for serialization of the object.

public void GetObjectData(SerializationInfo info, StreamingContext context)
Sub GetObjectData(info As SerializationInfo, context As StreamingContext)

Parameters​

GetType()​

Gets the Type of the current instance. (Inherited from Object)

public Type GetType()
Function GetType() As Type

Returns​

The Type instance that represents the exact runtime type of the current instance.

ToString()​

Returns a String that represents the current Object . (Inherited from Object)

public string ToString()
Function ToString() As String

Returns​

A String that represents the current Object .

See Also​

ceTe.DynamicPDF.Conversion