PTOCRModule

@interface PTOCRModule : NSObject

The class OCRModule. static interface to PDFTron SDKs OCR functionality

  • Find out whether the OCR module is available (and licensed).

    Declaration

    Objective-C

    + (BOOL)IsModuleAvailable;

    Swift

    class func isModuleAvailable() -> Bool

    Return Value

    returns true if OCR operations can be performed.

  • Convert an image to a PDF with searchable text.

    Declaration

    Objective-C

    + (void)ImageToPDF:(PTPDFDoc *)dst
                   src:(NSString *)src
               options:(PTOCROptions *)options;

    Swift

    class func image(toPDF dst: PTPDFDoc!, src: String!, options: PTOCROptions!)

    Parameters

    dst

    – The destination document.

    src

    – The path to the input image.

    options

    – OCR options (optional).

  • Add searchable and selectable text to raster images within a PDF.

    Declaration

    Objective-C

    + (void)ProcessPDF:(PTPDFDoc *)dst options:(PTOCROptions *)options;

    Swift

    class func processPDF(_ dst: PTPDFDoc!, options: PTOCROptions!)

    Parameters

    dst

    – The source and destination document.

    options

    – OCR options (optional).

  • Perform OCR on an image and return resulting JSON string. Side effect: source image is converted to PDF and stored in the destination document.

    Declaration

    Objective-C

    + (NSString *)GetOCRJsonFromImage:(PTPDFDoc *)dst
                                  src:(NSString *)src
                              options:(PTOCROptions *)options;

    Swift

    class func getOCRJson(fromImage dst: PTPDFDoc!, src: String!, options: PTOCROptions!) -> String!

    Parameters

    dst

    – The destination document.

    src

    – The path to the input image.

    options

    – OCR options (optional).

    Return Value

    JSON string represeting OCR results.

  • Perform OCR on raster images within a PDF and return resulting JSON string.

    Declaration

    Objective-C

    + (NSString *)GetOCRJsonFromPDF:(PTPDFDoc *)src options:(PTOCROptions *)options;

    Swift

    class func getOCRJson(fromPDF src: PTPDFDoc!, options: PTOCROptions!) -> String!

    Parameters

    src

    – The source document.

    options

    – OCR options (optional).

    Return Value

    JSON string represeting OCR results.

  • Add hidden text layer to a PDF consisting of raster image(s).

    Declaration

    Objective-C

    + (void)ApplyOCRJsonToPDF:(PTPDFDoc *)dst json:(NSString *)json;

    Swift

    class func applyOCRJson(toPDF dst: PTPDFDoc!, json: String!)

    Parameters

    dst

    – The source and destination document.

    json

    – JSON representing OCR results.

  • Perform OCR on an image and return resulting XML string. Side effect: source image is converted to PDF and stored in the destination document.

    Declaration

    Objective-C

    + (NSString *)GetOCRXmlFromImage:(PTPDFDoc *)dst
                                 src:(NSString *)src
                             options:(PTOCROptions *)options;

    Swift

    class func getOCRXml(fromImage dst: PTPDFDoc!, src: String!, options: PTOCROptions!) -> String!

    Parameters

    dst

    – The destination document.

    src

    – The path to the input image.

    options

    – OCR options (optional).

    Return Value

    XML string represeting OCR results.

  • Perform OCR on raster images within a PDF and return resulting XML string.

    Declaration

    Objective-C

    + (NSString *)GetOCRXmlFromPDF:(PTPDFDoc *)src options:(PTOCROptions *)options;

    Swift

    class func getOCRXml(fromPDF src: PTPDFDoc!, options: PTOCROptions!) -> String!

    Parameters

    src

    – The source document.

    options

    – OCR options (optional).

    Return Value

    XML string represeting OCR results.

  • Add hidden text layer to a PDF consisting of raster image(s).

    Declaration

    Objective-C

    + (void)ApplyOCRXmlToPDF:(PTPDFDoc *)dst xml:(NSString *)xml;

    Swift

    class func applyOCRXml(toPDF dst: PTPDFDoc!, xml: String!)

    Parameters

    dst

    – The source and destination document.

    xml

    – XML representing OCR results.

  • Undocumented

    Declaration

    Objective-C

    - (instancetype)init;

    Swift

    init!()