PTOCRProcessor


@interface PTOCRProcessor : NSObject

The PTOCRProcessor class performs Optical Character Recognition (OCR) on the content of a PDF and applies the recognized text results to each page.

  • Initializes a PTOCRProcessor instance.

    Declaration

    Objective-C

    - (nonnull instancetype)init;

    Swift

    init()

    Return Value

    An initialized PTOCRProcessor instance.

  • Performs OCR and applies the results to the specified PDF document.

    Declaration

    Objective-C

    - (void)processDocument:(nonnull PTPDFDoc *)pdfDoc
        withCompletionHandler:
            (nonnull void (^)(BOOL, NSError *_Nullable))completionHandler;

    Swift

    func processDocument(_ pdfDoc: PTPDFDoc) async throws -> Bool

    Parameters

    pdfDoc

    The PDF document to be processed.

    completionHandler

    The completion handler to be called when processing is finished. If the document was processed successfully then the success parameter is YES, otherwise the error parameter contains more information about the failure.

  • Performs OCR and applies the results to the specified page in the PDF document.

    Declaration

    Objective-C

    - (void)processPageNumber:(int)pageNumber
                   inDocument:(nonnull PTPDFDoc *)pdfDoc
        withCompletionHandler:
            (nonnull void (^)(BOOL, NSError *_Nullable))completionHandler;

    Swift

    func processPageNumber(_ pageNumber: Int32, inDocument pdfDoc: PTPDFDoc) async throws -> Bool

    Parameters

    pageNumber

    The number of the PDF page to be processed.

    pdfDoc

    The PDF document to be processed.

    completionHandler

    The completion handler to be called when processing is finished. If the document was processed successfully then the success parameter is YES, otherwise the error parameter contains more information about the failure.