PTDocumentConversion

@interface PTDocumentConversion : NSObject

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.

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

    Declaration

    Objective-C

    - (PTResult)TryConvert;

    Swift

    func tryConvert() -> PTResult

    Return Value

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

  • Perform the conversion. Will throw an exception on failure.

    Declaration

    Objective-C

    - (void)Convert;

    Swift

    func convert()
  • 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

    Objective-C

    - (void)ConvertNextPage;

    Swift

    func convertNextPage()
  • Get a reference to the output pdf.

    Declaration

    Objective-C

    - (PTPDFDoc *)GetDoc;

    Swift

    func getDoc() -> PTPDFDoc!

    Return Value

    .

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

    Declaration

    Objective-C

    - (PTResult)GetConversionStatus;

    Swift

    func getStatus() -> PTResult

    Return Value

    .

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

    Declaration

    Objective-C

    - (void)CancelConversion;

    Swift

    func cancel()
  • Has the conversion been cancelled?.

    Declaration

    Objective-C

    - (BOOL)IsCancelled;

    Swift

    func isCancelled() -> Bool

    Return Value

    Returns true if CancelConversion has been called previously.

  • Determine whether this DocumentConversion has progress reporting capability.

    Declaration

    Objective-C

    - (BOOL)HasProgressTracking;

    Swift

    func hasProgressTracking() -> Bool

    Return Value

    True if GetProgress is expected to return usable values.

  • 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

    Objective-C

    - (double)GetProgress;

    Swift

    func getProgress() -> Double

    Return Value

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

  • 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

    Objective-C

    - (NSString *)GetProgressLabel;

    Swift

    func getProgressLabel() -> String!

    Return Value

    The stage label.

  • 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

    Objective-C

    - (unsigned int)GetNumConvertedPages;

    Swift

    func getNumConvertedPages() -> UInt32

    Return Value

    The number of pages that have been converted.

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

    Declaration

    Objective-C

    - (NSString *)GetErrorString;

    Swift

    func getErrorString() -> String!

    Return Value

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

  • 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

    Objective-C

    - (unsigned int)GetNumWarnings;

    Swift

    func getNumWarnings() -> UInt32

    Return Value

    The number of stored warning strings.

  • 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

    Objective-C

    - (NSString *)GetWarningString:(unsigned int)index;

    Swift

    func getWarningString(_ index: UInt32) -> String!

    Parameters

    index

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

    Return Value

    The value of the particular warning string.

  • Undocumented

    Declaration

    Objective-C

    + (PTDocumentConversion*)CreateInternal: (unsigned long long)impl;

    Swift

    class func createInternal(_ impl: UInt64) -> PTDocumentConversion!
  • Undocumented

    Declaration

    Objective-C

    - (unsigned long long)GetHandleInternal;

    Swift

    func getHandleInternal() -> UInt64
  • Undocumented

    Declaration

    Objective-C

    - (instancetype)init;

    Swift

    init!()