Foxit PDF SDK

Public Member Functions | Static Public Attributes | List of all members
FSDK.OCR Class Reference

## Public Member Functions
| constructor ()
| Constructor.
| GetOCRSuspectsInfo (ocred_pdf_doc)
| Get OCR suspicious information. More...
| IsEmpty ()
| Check whether current object is empty or not. More...
| OCRConvertTo (format, src_pdf_path, password, saved_file_path, page_range, is_retain_flowing_text, callback)
| OCR the PDF document and convert it to a specified format document. More...
| OCRConvertTo (format, src_pdf_path, password, saved_file_path, page_range, is_retain_flowing_text, config, callback)
| OCR the PDF document and convert it to a specified format document. More...
| OCRPDFDocument (pdf_doc, is_editable, callback)
| OCR each page of a PDF document. More...
| OCRPDFDocument (pdf_doc, is_editable, config, callback)
| OCR each page of a PDF document. More...
| OCRPDFDocuments (settingdata_array, callback)
| OCR multiple pages of multiple PDF documents. More...
| OCRPDFPage (pdf_page, is_editable, callback)
| OCR a PDF page. More...
| OCRPDFPage (pdf_page, is_editable, config, callback)
| OCR a PDF page. More...

## Static Public Attributes
static | e_OCRConvertFormatDOC
| OCR convert format: DOC.
static | e_OCRConvertFormatDOCX
| Enumeration for format used for OCR converting. More...
static | e_OCRConvertFormatHTML
| OCR convert format: HTML.
static | e_OCRConvertFormatPPTX
| OCR convert format: PPTX.
static | e_OCRConvertFormatRTF
| OCR convert format: RTF.
static | e_OCRConvertFormatXLS
| OCR convert format: XLS.
static | e_OCRConvertFormatXLSX
| OCR convert format: XLSX.

## Detailed Description

This class is used to do OCR for a PDF page or a PDF document. Please ensure OCR engine has been initialized before using this class.

See also
  FSDK.OCREngine

## Member Function Documentation

## ◆ GetOCRSuspectsInfo()

FSDK.OCR.GetOCRSuspectsInfo | ( | ocred_pdf_doc |  | ) |

Get OCR suspicious information.

The parameter ocred_pdf_doc is a valid PDF document that should have been ocred.

Parameters

  [in] | ocred_pdf_doc | A valid PDF document object.

Returns
  An array of FSDK.OCRSuspectInfo objects, If its value is empty, that means the document OCR has no suspicious information.

## ◆ IsEmpty()

FSDK.OCR.IsEmpty | ( |  | ) |

Check whether current object is empty or not.

When the current object is empty, that means current object is useless.

Returns
  true means current object is empty, while false means not.

## ◆ OCRConvertTo() [1/2]

FSDK.OCR.OCRConvertTo | ( | format | ,
|  | src_pdf_path | ,
|  | password | ,
|  | saved_file_path | ,
|  | page_range | ,
|  | is_retain_flowing_text | ,
|  | callback |
| ) |  |

OCR the PDF document and convert it to a specified format document.

Parameters

  [in] | format | The format of the document to convert. Please refer to values starting from FSDK.OCR.e_OCRConvertFormatDOCX and this should be one of these values.
  [in] | src_pdf_path | The source PDF file path.This should not be an empty string.
  [in] | password | The password of the source PDF file. If the PDF file is not encrypted, this should be an empty string.
  [in] | saved_file_path | The path of the file to save. This should not be an empty string.
  [in] | page_range | The range of pages that need to be converted. If this is an empty range, that means to convert each page of the PDF document.
  [in] | is_retain_flowing_text | true means the generated document will retain flowing text, the text may be reformatted and page breaks cannot be guaranteed to be retained. false means the generated document will retain original page layout. This parameter is only useful for the following format types: FSDK.OCR.e_OCRConvertFormatRTF, FSDK.OCR.e_OCRConvertFormatDOC, FSDK.OCR.e_OCRConvertFormatDOCX. Default value: true.
  [in] | callback | A customized progress callback which is implemented based on callback class FSDK.OCRProgressCallback. NULL means not to receive progress notification.

Returns
  None.

## ◆ OCRConvertTo() [2/2]

FSDK.OCR.OCRConvertTo | ( | format | ,
|  | src_pdf_path | ,
|  | password | ,
|  | saved_file_path | ,
|  | page_range | ,
|  | is_retain_flowing_text | ,
|  | config | ,
|  | callback |
| ) |  |

OCR the PDF document and convert it to a specified format document.

Parameters

  [in] | format | The format of the document to convert. Please refer to values starting from FSDK.OCR.e_OCRConvertFormatDOCX and this should be one of these values.
  [in] | src_pdf_path | The source PDF file path.This should not be an empty string.
  [in] | password | The password of the source PDF file. If the PDF file is not encrypted, this should be an empty string.
  [in] | saved_file_path | The path of the file to save. This should not be an empty string.
  [in] | page_range | The range of pages that need to be converted. If this is an empty range, that means to convert each page of the PDF document.
  [in] | is_retain_flowing_text | true means the generated document will retain flowing text, the text may be reformatted and page breaks cannot be guaranteed to be retained. false means the generated document will retain original page layout. This parameter is only useful for the following format types: FSDK.OCR.e_OCRConvertFormatRTF, FSDK.OCR.e_OCRConvertFormatDOC, FSDK.OCR.e_OCRConvertFormatDOCX. Default value: true.
  [in] | config | The FSDK.OCRConfig object.
  [in] | callback | A customized progress callback which is implemented based on callback class FSDK.OCRProgressCallback. NULL means not to receive progress notification.

Returns
  None.

## ◆ OCRPDFDocument() [1/2]

FSDK.OCR.OCRPDFDocument | ( | pdf_doc | ,
|  | is_editable | ,
|  | callback |
| ) |  |

OCR each page of a PDF document.

After this function succeeds, the PDF page content may be changed. It is better to parse or re-parse PDF pages in the input PDF document before using these pages.

Parameters

  [in] | pdf_doc | A valid PDF document object.
  [in] | is_editable | true means the OCR result is editable. false means the OCR result can only be searched but not be edited.
  [in] | callback | A customized progress callback which is implemented based on callback class FSDK.OCRProgressCallback. NULL means not to receive progress notification.

Returns
  None.

## ◆ OCRPDFDocument() [2/2]

FSDK.OCR.OCRPDFDocument | ( | pdf_doc | ,
|  | is_editable | ,
|  | config | ,
|  | callback |
| ) |  |

OCR each page of a PDF document.

After this function succeeds, the PDF page content may be changed. It is better to parse or re-parse PDF pages in the input PDF document before using these pages.

Parameters

  [in] | pdf_doc | A valid PDF document object.
  [in] | is_editable | true means the OCR result is editable. false means the OCR result can only be searched but not be edited.
  [in] | config | The FSDK.OCRConfig.
  [in] | callback | A customized progress callback which is implemented based on callback class FSDK.OCRProgressCallback. NULL means not to receive progress notification.

Returns
  None.

## ◆ OCRPDFDocuments()

FSDK.OCR.OCRPDFDocuments | ( | settingdata_array | ,
|  | callback |
| ) |  |

OCR multiple pages of multiple PDF documents.

This function can be used to batch process multiple documents or pages. Users can set documents and page ranges via FSDK.OCRSettingDataArray. The time performance of this function will be better than calling FSDK.OCRPDFDocument or FSDK.OCR.OCRPDFPage multiple times when dealing with a large number of documents or pages. After successful execution, the page content may be changed, it is better to parse or re-parse the PDF pages before using these pages.Currently, this function can only be used for Windows.

Parameters

  [in] | settingdata_array | An array of FSDK.OCRSettingData objects, if the parameter page_range of FSDK.OCRSettingData object is empty, that means OCR each page of the PDF document.
  [in] | callback | A customized progress callback which is implemented based on callback class FSDK.OCRProgressCallback. NULL means not to receive progress notification.

Returns
  None.

## ◆ OCRPDFPage() [1/2]

FSDK.OCR.OCRPDFPage | ( | pdf_page | ,
|  | is_editable | ,
|  | callback |
| ) |  |

OCR a PDF page.

After this function succeeds, the PDF page content may be changed and the input PDF page is recommended to be re-parsed.

Parameters

  [in] | pdf_page | A valid PDF page object. This PDF page should have been parsed.
  [in] | is_editable | true means the OCR result is editable. false means the OCR result can only be searched but not be edit.
  [in] | callback | A customized progress callback which is implemented based on callback class FSDK.OCRProgressCallback. NULL means not to receive progress notification.

Returns
  None.

## ◆ OCRPDFPage() [2/2]

FSDK.OCR.OCRPDFPage | ( | pdf_page | ,
|  | is_editable | ,
|  | config | ,
|  | callback |
| ) |  |

OCR a PDF page.

After this function succeeds, the PDF page content may be changed and the input PDF page is recommended to be re-parsed.

Parameters

  [in] | pdf_page | A vaild PDF page object. This PDF page should have been parsed.
  [in] | is_editable | true means the OCR result is editable. false means the OCR result can only be searched but not be edited.
  [in] | config | The FSDK.OCRConfig.
  [in] | callback | A customized progress callback which is implemented based on callback class FSDK.OCRProgressCallback. NULL means not to receive progress notification.

Returns
  None.

## Member Data Documentation

## ◆ e_OCRConvertFormatDOCX

FSDK.OCR.e_OCRConvertFormatDOCX
| static

Enumeration for format used for OCR converting.

Values of this enumeration should be used alone.OCR convert format: DOCX.