Show / Hide Table of Contents

# Class DocumentConversion

Encapsulates the conversion of a single document from one format to another.

##### Inheritance

object
DocumentConversion

##### Implements

IDisposable

##### Inherited Members

object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()

###### Namespace: pdftron.PDF

###### Assembly: PDFTronDotNet.dll

##### Syntax

    public class DocumentConversion : IDisposable

### Constructors

#### DocumentConversion(IntPtr)

##### Declaration

    public DocumentConversion(IntPtr impl_ptr)

##### Parameters

Type | Name | Description
--- | --- | ---
IntPtr | impl_ptr |

### Methods

#### CancelConversion()

Cancel the current conversion, forcing TryConvert or Convert to return.

##### Declaration

    public void CancelConversion()

#### Convert()

Perform the conversion. Will throw an exception on failure.

##### Declaration

    public void Convert()

#### ConvertNextPage()

Perform the conversion. Will throw an exception on failure. Does nothing if the conversion is already complete. Use GetConversionStatus() to check if there is remaining content to be converted.

##### Declaration

    public void ConvertNextPage()

#### CreateInternal(IntPtr)

##### Declaration

    public static DocumentConversion CreateInternal(IntPtr imp)

##### Parameters

Type | Name | Description
--- | --- | ---
IntPtr | imp |

##### Returns

Type | Description
--- | ---
DocumentConversion |

#### Destroy()

##### Declaration

    public void Destroy()

#### Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

##### Declaration

    public void Dispose()

#### Dispose(bool)

##### Declaration

    protected virtual void Dispose(bool disposing)

##### Parameters

Type | Name | Description
--- | --- | ---
bool | disposing |

#### ~DocumentConversion()

##### Declaration

    protected ~DocumentConversion()

#### GetConversionStatus()

Get the state of the conversion process. Pair this with ConvertNextPage().

##### Declaration

    public DocumentConversionResult GetConversionStatus()

##### Returns

Type | Description
--- | ---
DocumentConversionResult |

#### GetCurrentExcelSheetName()

Retrieve the name of the Excel sheet placed on the last converted page if any.

##### Declaration

    public string GetCurrentExcelSheetName()

##### Returns

Type | Description
--- | ---
string | The name of the Excel sheet

#### GetDoc()

Gets the PDFDoc from the conversion. Can be accessed at any time during or after conversion.

##### Declaration

    public PDFDoc GetDoc()

##### Returns

Type | Description
--- | ---
PDFDoc | The conversion's PDFDoc

#### GetErrorString()

If the conversion finsihed with some kind of error, this returns the value of the error description; otherwise returns an empty string.

##### Declaration

    public string GetErrorString()

##### Returns

Type | Description
--- | ---
string | The error description. Will be blank unless GetConversionStatus returns Failure

#### GetNextExcelSheetCellCount()

Retrieve the number of cells in the Excel sheet that will be converted next.

##### Declaration

    public int GetNextExcelSheetCellCount()

##### Returns

Type | Description
--- | ---
int | The number of cells

#### GetNumConvertedPages()

Returns the number of pages which have been added to the destination document. Will never decrease, and will not change after the conversion status becomes "complete".

##### Declaration

    public int GetNumConvertedPages()

##### Returns

Type | Description
--- | ---
int | The number of pages that have been converted

#### GetNumWarnings()

Return the number of warning strings generated during the conversion process. Warning: experimental interface; this method may be renamed or replaced with equivalent functionality in the future.

##### Declaration

    public int GetNumWarnings()

##### Returns

Type | Description
--- | ---
int | The number of stored warning strings

#### GetProgress()

Returns a number from 0.0 to 1.0, representing the best estimate of conversion progress. This number is only an indicator, and should not be used to dictate program logic (in particular, it is possible for this method to return 1.0 while there is still work to be done. Use GetConversionStatus() to find out when the conversion is fully complete).

##### Declaration

    public double GetProgress()

##### Returns

Type | Description
--- | ---
double | The conversion progress. Will never return a smaller number than a previous call

#### GetProgressLabel()

Returns the label for the current conversion stage. May return a blank string. Warning: experimental interface; this method may be renamed or replaced with equivalent functionality in the future.

##### Declaration

    public string GetProgressLabel()

##### Returns

Type | Description
--- | ---
string | The stage label

#### GetWarningString(int)

Retrieve warning strings that have been collected during the conversion process. Warning: experimental interface; this method may be renamed or replaced with equivalent functionality in the future.

##### Declaration

    public string GetWarningString(int index)

##### Parameters

Type | Name | Description
--- | --- | ---
int | index | the index of the string to be retrieved. Must be less than GetNumWarnings()

##### Returns

Type | Description
--- | ---
string | The value of the particular warning string

#### HasProgressTracking()

Determine whether this DocumentConversion has progress reporting capability.

##### Declaration

    public bool HasProgressTracking()

##### Returns

Type | Description
--- | ---
bool | True if GetProgress is expected to return usable values

#### IsCancelled()

Has the conversion been cancelled?.

##### Declaration

    public bool IsCancelled()

##### Returns

Type | Description
--- | ---
bool | Returns true if CancelConversion has been called previously

#### SkipNextExcelSheet()

Skip the next Excel sheet. The sheet will not be converted.

##### Declaration

    public void SkipNextExcelSheet()

#### TryConvert()

Perform the conversion. If the result of the conversion is failure, then GetErrorString will contain further information about the failure.

##### Declaration

    public DocumentConversionResult TryConvert()

##### Returns

Type | Description
--- | ---
DocumentConversionResult | Indicates that the conversion succeeded, failed, or was cancelled

### Implements

IDisposable