Summary: Constants | Ctors | Methods | Inherited Methods | [Expand All]
public class

# DocumentConversion

extends Object
implements AutoCloseable

java.lang.Object
↳ | com.pdftron.pdf.DocumentConversion

## Class Overview

The class DocumentConversion. Encapsulates the conversion of a single document from one format to another. DocumentConversion instances are created through methods belonging to the Convert class. See Convert.WordToPDFConversion for an example.

## Summary

Constants
int | e_failure |
int | e_incomplete |
int | e_success |

Public Constructors
| DocumentConversion(long impl_ptr)

Public Methods
static DocumentConversion | __Create(long impl)
long | __GetHandle()
void | cancelConversion() Cancel the current conversion, forcing TryConvert or Convert to return.
void | close() Frees the native memory of the object.
void | convert() Perform the conversion.
void | convertNextPage() Perform the conversion.
void | destroy() Frees the native memory of the object.
int | getConversionStatus() Get the state of the conversion process.
String | getCurrentExcelSheetName() Retrieve the name of the Excel sheet placed on the last converted page if any.
PDFDoc | getDoc() Gets the PDFDoc from the conversion.
String | getErrorString() If the conversion finsihed with some kind of error, this returns the value of the error description; otherwise returns an empty string.
int | getNextExcelSheetCellCount() Retrieve the number of cells in the Excel sheet that will be converted next.
int | getNumConvertedPages() Returns the number of pages which have been added to the destination document.
int | getNumWarnings() Return the number of warning strings generated during the conversion process.
double | getProgress() Returns a number from 0.0 to 1.0, representing the best estimate of conversion progress.
String | getProgressLabel() Returns the label for the current conversion stage.
String | getWarningString(int index) Retrieve warning strings that have been collected during the conversion process.
boolean | hasProgressTracking() Determine whether this DocumentConversion has progress reporting capability.
boolean | isCancelled() Has the conversion been cancelled?.
void | skipNextExcelSheet() Skip the next Excel sheet.
int | tryConvert() Perform the conversion.

[Expand] Inherited Methods
From class java.lang.Object
boolean | equals(Object arg0)
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)
final void | wait()
From interface java.lang.AutoCloseable
abstract void | close()

## Constants

#### public static final int e_failure

Constant Value: 2 (0x00000002)

#### public static final int e_incomplete

Constant Value: 1 (0x00000001)

#### public static final int e_success

Constant Value: 0 (0x00000000)

## Public Constructors

#### public DocumentConversion (long impl_ptr)

## Public Methods

#### public static DocumentConversion __Create (long impl)

#### public long __GetHandle ()

#### public void cancelConversion ()

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

##### Throws

PDFNetException |

#### public void close ()

Frees the native memory of the object. This can be explicity called to control the deallocation of native memory and avoid situations where the garbage collector does not free the object in a timely manner.

##### Throws

PDFNetException |

#### public void convert ()

Perform the conversion. Will throw an exception on failure.

##### Throws

PDFNetException |

#### public void 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.

##### Throws

PDFNetException |

#### public void destroy ()

Frees the native memory of the object. This can be explicitly called to control the deallocation of native memory and avoid situations where the garbage collector does not free the object in a timely manner.

##### Throws

PDFNetException |

#### public int getConversionStatus ()

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

##### Throws

PDFNetException |

#### public String getCurrentExcelSheetName ()

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

##### Returns

- The name of the Excel sheet

##### Throws

PDFNetException |

#### public PDFDoc getDoc ()

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

##### Returns

- The conversion's PDFDoc

##### Throws

PDFNetException |

#### public String getErrorString ()

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

##### Returns

- The error description. Will be blank unless GetConversionStatus returns Failure

##### Throws

PDFNetException |

#### public int getNextExcelSheetCellCount ()

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

##### Returns

- The number of cells

##### Throws

PDFNetException |

#### public int 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".

##### Returns

- The number of pages that have been converted

##### Throws

PDFNetException |

#### public int 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.

##### Returns

- The number of stored warning strings

##### Throws

PDFNetException |

#### public double 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).

##### Returns

- The conversion progress. Will never return a smaller number than a previous call

##### Throws

PDFNetException |

#### public String 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.

##### Returns

- The stage label

##### Throws

PDFNetException |

#### public String getWarningString (int index)

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.

##### Parameters

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

##### Returns

- The value of the particular warning string

##### Throws

PDFNetException |

#### public boolean hasProgressTracking ()

Determine whether this DocumentConversion has progress reporting capability.

##### Returns

- True if GetProgress is expected to return usable values

##### Throws

PDFNetException |

#### public boolean isCancelled ()

Has the conversion been cancelled?.

##### Returns

- Returns true if CancelConversion has been called previously

##### Throws

PDFNetException |

#### public void skipNextExcelSheet ()

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

##### Throws

PDFNetException |

#### public int tryConvert ()

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

##### Returns

- Indicates that the conversion succeeded, failed, or was cancelled

##### Throws

PDFNetException |