public class

DocumentConversion

extends Object
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 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.
PDFDoc getDoc()
Get a reference to the output pdf.
String getErrorString()
If the conversion finsihed with some kind of error, this returns the value of the the error description ()otherwise returns an empty string.
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?.
int tryConvert()
Perform the conversion.
[Expand]
Inherited Methods
From class java.lang.Object

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.

public void convert ()

Perform the conversion. Will throw an exception on failure.

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.

public void destroy ()

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.

public int getConversionStatus ()

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

Returns
  • .

public PDFDoc getDoc ()

Get a reference to the output pdf.

Returns
  • .

public String getErrorString ()

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

Returns
  • The error description. Will be blank unless GetConversionStatus returns Failure.

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.

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.

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.

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.

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.

public boolean hasProgressTracking ()

Determine whether this DocumentConversion has progress reporting capability.

Returns
  • True if GetProgress is expected to return usable values.

public boolean isCancelled ()

Has the conversion been cancelled?.

Returns
  • Returns true if CancelConversion has been called previously.

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.