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.
-
Find out whether the IRIS OCR module is available.
Declaration
Objective-C
+ (BOOL)IsIRISModuleAvailable;
Swift
class func isIRISModuleAvailable() -> Bool
Return Value
returns true if the IRIS ocr module has been located.
-
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 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. The box is a summary for a text fragment bounding box (leftmost x, bottommost y, width, height) The box coordinates are in units of points (1/72 of an inch), with the origin at the top left, and larger x and y coordinates representing further right and down, respectively
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 representing OCR results.
-
Perform OCR on a PDF and return resulting JSON string. The box is a summary for a text fragment bounding box (leftmost x, bottommost y, width, height) The box coordinates are in units of points (1/72 of an inch), with the origin at the top left, and larger x and y coordinates representing further right and down, respectively
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 representing 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. The box is a summary for a text fragment bounding box (leftmost x, bottommost y, width, height) The box coordinates are in units of points (1/72 of an inch), with the origin at the top left, and larger x and y coordinates representing further right and down, respectively
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 representing OCR results.
-
Perform OCR on a PDF and return resulting XML string. The box is a summary for a text fragment bounding box (leftmost x, bottommost y, width, height) The box coordinates are in units of points (1/72 of an inch), with the origin at the top left, and larger x and y coordinates representing further right and down, respectively
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 representing 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!()