Foxit PDF SDK
FoxitPDFSDKPython3.OCR Class Reference
Inheritance diagram for FoxitPDFSDKPython3.OCR:
FoxitPDFSDKPython3.Base

Public Member Functions

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

Static Public Attributes

 e_OCRConvertFormatDOC = _fsdk.OCR_e_OCRConvertFormatDOC
 OCR convert format: DOC.
 
 e_OCRConvertFormatDOCX = _fsdk.OCR_e_OCRConvertFormatDOCX
 OCR convert format: DOCX.
 
 e_OCRConvertFormatHTML = _fsdk.OCR_e_OCRConvertFormatHTML
 OCR convert format: HTML.
 
 e_OCRConvertFormatPPTX = _fsdk.OCR_e_OCRConvertFormatPPTX
 OCR convert format: PPTX.
 
 e_OCRConvertFormatRTF = _fsdk.OCR_e_OCRConvertFormatRTF
 OCR convert format: RTF.
 
 e_OCRConvertFormatXLS = _fsdk.OCR_e_OCRConvertFormatXLS
 OCR convert format: XLS.
 
 e_OCRConvertFormatXLSX = _fsdk.OCR_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
OCREngine

Constructor & Destructor Documentation

◆ OCR()

def FoxitPDFSDKPython3.OCR.OCR ( )

Constructor.

Constructor, with another ocr object.

Parameters
[in]otherAnother ocr object.

Member Function Documentation

◆ GetOCRSuspectsInfo()

def FoxitPDFSDKPython3.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_docA valid PDF document object.
Returns
An array of OCRSuspectInfo objects, If its value is empty, that means the document OCR has no suspicious information.

◆ IsEmpty()

def FoxitPDFSDKPython3.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]

def FoxitPDFSDKPython3.OCR.OCRConvertTo (   format,
  src_pdf_path,
  password,
  saved_file_path,
  page_range,
  is_retain_flowing_text 
)

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

Parameters
[in]formatThe format of the document to convert. Please refer to values starting from FoxitPDFSDKPython3.OCR.e_OCRConvertFormatDOCX and this should be one of these values.
[in]src_pdf_pathThe source PDF file path.This should not be an empty string.
[in]passwordThe password of the source PDF file. If the PDF file is not encrypted, this should be an empty string.
[in]saved_file_pathThe path of the file to save. This should not be an empty string.
[in]page_rangeThe 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_texttrue 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:
FoxitPDFSDKPython3.OCR.e_OCRConvertFormatRTF , FoxitPDFSDKPython3.OCR.e_OCRConvertFormatDOC , FoxitPDFSDKPython3.OCR.e_OCRConvertFormatDOCX .
Default value: true.
Returns
None.

◆ OCRConvertTo() [2/2]

def FoxitPDFSDKPython3.OCR.OCRConvertTo (   format,
  src_pdf_path,
  password,
  saved_file_path,
  page_range,
  is_retain_flowing_text,
  config 
)

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

Parameters
[in]formatThe format of the document to convert. Please refer to values starting from FoxitPDFSDKPython3.OCR.e_OCRConvertFormatDOCX and this should be one of these values.
[in]src_pdf_pathThe source PDF file path.This should not be an empty string.
[in]passwordThe password of the source PDF file. If the PDF file is not encrypted, this should be an empty string.
[in]saved_file_pathThe path of the file to save. This should not be an empty string.
[in]page_rangeThe 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_texttrue 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:
FoxitPDFSDKPython3.OCR.e_OCRConvertFormatRTF , FoxitPDFSDKPython3.OCR.e_OCRConvertFormatDOC , FoxitPDFSDKPython3.OCR.e_OCRConvertFormatDOCX .
Default value: true.
[in]configThe OCRConfig object.
Returns
None.

◆ OCRPDFDocument() [1/2]

def FoxitPDFSDKPython3.OCR.OCRPDFDocument (   pdf_doc,
  is_editable 
)

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_docA valid PDF document object.
[in]is_editabletrue means the OCR result is editable. false means the OCR result can only be searched but not be edited.
Returns
None.

◆ OCRPDFDocument() [2/2]

def FoxitPDFSDKPython3.OCR.OCRPDFDocument (   pdf_doc,
  is_editable,
  config 
)

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_docA valid PDF document object.
[in]is_editabletrue means the OCR result is editable. false means the OCR result can only be searched but not be edited.
[in]configThe OCRConfig .
Returns
None.

◆ OCRPDFDocuments()

def FoxitPDFSDKPython3.OCR.OCRPDFDocuments (   settingdata_array)

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 OCRSettingDataArray . The time performance of this function will be better than calling FoxitPDFSDKPython3.OCR.OCRPDFDocument or FoxitPDFSDKPython3.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.

Parameters
[in]settingdata_arrayAn array of OCRSettingData objects, if the parameter page_range of OCRSettingData object is empty, that means OCR each page of the PDF document.
Returns
None.

◆ OCRPDFPage() [1/2]

def FoxitPDFSDKPython3.OCR.OCRPDFPage (   pdf_page,
  is_editable 
)

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_pageA valid PDF page object. This PDF page should have been parsed.
[in]is_editabletrue means the OCR result is editable. false means the OCR result can only be searched but not be edit.
Returns
None.

◆ OCRPDFPage() [2/2]

def FoxitPDFSDKPython3.OCR.OCRPDFPage (   pdf_page,
  is_editable,
  config 
)

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_pageA vaild PDF page object. This PDF page should have been parsed.
[in]is_editabletrue means the OCR result is editable. false means the OCR result can only be searched but not be edited.
[in]configThe OCRConfig .
Returns
None.