new DocumentConversion()
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.
Extends
Members
-
<static> Result
-
Type:
- number
Properties:
Name Type Description e_Success
number e_Incomplete
number e_Failure
number
Methods
-
cancelConversion()
-
Cancel the current conversion, forcing TryConvert or Convert to return.
Returns:
- Type
- Promise.<void>
-
convert()
-
Perform the conversion. Will throw an exception on failure.
Returns:
- Type
- Promise.<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.
Returns:
- Type
- Promise.<void>
-
destroy()
-
Destructor
- Inherited From:
Returns:
- Type
- Promise.<void>
-
getConversionStatus()
-
Get the state of the conversion process. Pair this with ConvertNextPage().
Returns:
A promise that resolves to .- Type
- Promise.<number>
Example
Return value enum: <pre> PDFNet.DocumentConversion.Result = { e_Success : 0 e_Incomplete : 1 e_Failure : 2 } </pre>
-
getCurrentExcelSheetName()
-
Retrieve the name of the Excel sheet placed on the last converted page if any.
Returns:
A promise that resolves to the name of the Excel sheet.- Type
- Promise.<string>
-
getDoc()
-
Gets the PDFDoc from the conversion. Can be accessed at any time during or after conversion.
Returns:
A promise that resolves to the conversion's PDFDoc.- Type
- Promise.<PDFNet.PDFDoc>
-
getErrorString()
-
If the conversion finsihed with some kind of error, this returns the value of the error description; otherwise returns an empty string.
Returns:
A promise that resolves to the error description. Will be blank unless GetConversionStatus returns Failure.- Type
- Promise.<string>
-
getNextExcelSheetCellCount()
-
Retrieve the number of cells in the Excel sheet that will be converted next.
Returns:
A promise that resolves to the number of cells.- Type
- Promise.<number>
-
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:
A promise that resolves to the number of pages that have been converted.- Type
- Promise.<number>
-
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:
A promise that resolves to the number of stored warning strings.- Type
- Promise.<number>
-
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:
A promise that resolves to the conversion progress. Will never return a smaller number than a previous call.- Type
- Promise.<number>
-
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:
A promise that resolves to the stage label.- Type
- Promise.<string>
-
getWarningString(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:
Name Type Description index
number - the index of the string to be retrieved. Must be less than GetNumWarnings(). Returns:
A promise that resolves to the value of the particular warning string.- Type
- Promise.<string>
-
hasProgressTracking()
-
Determine whether this DocumentConversion has progress reporting capability.
Returns:
A promise that resolves to true if GetProgress is expected to return usable values.- Type
- Promise.<boolean>
-
isCancelled()
-
Has the conversion been cancelled?.
Returns:
A promise that resolves to returns true if CancelConversion has been called previously.- Type
- Promise.<boolean>
-
skipNextExcelSheet()
-
Skip the next Excel sheet. The sheet will not be converted.
Returns:
- Type
- Promise.<void>
-
takeOwnership()
-
Take the ownership of this object, so that PDFNet.runWithCleanup won't destroy this object.
- Inherited From:
Returns:
- Type
- void
-
tryConvert()
-
Perform the conversion. If the result of the conversion is failure, then GetErrorString will contain further information about the failure.
Returns:
A promise that resolves to indicates that the conversion succeeded, failed, or was cancelled.- Type
- Promise.<number>
Example
Return value enum: <pre> PDFNet.DocumentConversion.Result = { e_Success : 0 e_Incomplete : 1 e_Failure : 2 } </pre>