Foxit PDF SDK
fs_ocr.h
Go to the documentation of this file.
1 #if (defined(_WIN32) || defined(_WIN64)) || defined(__linux__)
2 
16 #ifndef FS_OCR_H_
17 #define FS_OCR_H_
18 
19 #include "common/fs_common.h"
20 #include "pdf/fs_pdfdoc.h"
21 #include "pdf/fs_pdfpage.h"
22 
28 namespace foxit {
32 namespace addon {
36 namespace ocr {
48 class OCREngine FS_FINAL : public Object {
49  public:
69  static ErrorCode Initialize(const wchar_t* ocr_resource_path);
70 
79  static void Release();
80 
92  static void SetLogFile(const char* log_file_path);
93 
105  static void SetLogFile(const wchar_t* log_file_path);
106 
126  static void SetLanguages(const wchar_t* languages);
127 };
128 
130 class OCRSettingData FS_FINAL : public Object {
131  public:
136 
146  this->pdf_doc = pdf_doc;
147  this->page_range = page_range;
148  this->is_editable = is_editable;
149  }
150 
162  this->pdf_doc = pdf_doc;
163  this->page_range = page_range;
164  this->is_editable = is_editable;
165  }
166 
175  pdf_doc = data.pdf_doc;
176  page_range = data.page_range;
177  is_editable = data.is_editable;
178  return (*this);
179  }
180 
188  bool operator!=(const OCRSettingData& data) {
189  if (pdf_doc != data.pdf_doc || page_range != data.page_range || is_editable != data.is_editable)
190  return true;
191  return false;
192  }
193 
196 
199 
203 };
204 
207 
208 
213 class OCRSuspectInfo FS_FINAL : public Object {
214  public:
217 
220 
223 };
224 
227 
228 
234 class OCR FS_FINAL : public Base {
235  public:
239  OCR();
240 
246  OCR(const OCR& other);
247 
248  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
249  explicit OCR(FS_HANDLE handle);
251  ~OCR();
252 
260  OCR& operator = (const OCR& other);
268  bool operator == (const OCR& other) const;
276  bool operator != (const OCR& other) const;
277 
285  bool IsEmpty() const;
286 
299  void OCRPDFPage(pdf::PDFPage pdf_page, bool is_editable);
300 
313  void OCRPDFDocument(pdf::PDFDoc pdf_doc, bool is_editable);
314 #if defined(_WIN32) || defined(_WIN64)
315 
331  void OCRPDFDocuments(const ocr::OCRSettingDataArray& settingdata_array);
332 #endif
333 
343  OCRSuspectInfoArray GetOCRSuspectsInfo(pdf::PDFDoc ocred_pdf_doc);
344 };
345 
346 } // namespace ocr
347 } // namespace addon
348 } // namespace foxit
349 
350 #endif // FS_OCR_H_
351 
352 #if (defined(_WIN32) || defined(_WIN64)) || defined(__linux__)
Definition: fs_common.h:1189
CFX_Object Object
Object type.
Definition: fs_basictypes.h:217
bool is_editable
Decide whether the OCR result is editable. true means the OCR result is editable. false means the OCR...
Definition: fs_ocr.h:202
Header file for PDF document related definitions and classes.
static void SetLogFile(const char *log_file_path)
Set log file for OCR engine.
WIDE STRING CLASS.
Definition: fx_string.h:1452
OCRSettingData(pdf::PDFDoc pdf_doc, const common::Range &page_range, bool is_editable)
Constructor, with parameters.
Definition: fs_ocr.h:145
Definition: fs_pdfdoc.h:613
static ErrorCode Initialize(const wchar_t *ocr_resource_path)
Initialize OCR engine.
OCRSettingData()
Constructor.
Definition: fs_ocr.h:135
WString suspect_words
Suspicious words after OCR recognition.
Definition: fs_ocr.h:222
bool operator==(const char *str1, const CFX_ByteString &str2)
Check if two byte strings are equal.
Definition: fs_basictypes.h:128
OCRSettingData & operator=(const OCRSettingData &data)
Assign operator.
Definition: fs_ocr.h:174
Definition: fs_ocr.h:48
Definition: fs_ocr.h:234
ErrorCode
Enumeration for error code.
Definition: fs_basictypes.h:233
foxit::RectF words_rect
The box rectangle, in PDF coordinate system for suspicious words.
Definition: fs_ocr.h:219
pdf::PDFDoc pdf_doc
A valid PDF document that need to be OCR.
Definition: fs_ocr.h:195
Definition: fs_pdfpage.h:411
void * FS_HANDLE
Handle type.
Definition: fs_basictypes.h:214
int page_index
The index of page.
Definition: fs_ocr.h:216
Header file for common definitions and classes.
bool operator!=(const OCRSettingData &data)
Assign operator.
Definition: fs_ocr.h:188
Definition: fs_ocr.h:213
Definition: fs_basictypes.h:419
Header file for PDF page related definitions and classes.
static void SetLanguages(const wchar_t *languages)
Set the name of languages which would be included in the language database for doing OCR.
Foxit namespace.
Definition: fs_taggedpdf.h:27
void Set(pdf::PDFDoc pdf_doc, const common::Range &page_range, bool is_editable)
Set value.
Definition: fs_ocr.h:161
Definition: fs_ocr.h:130
common::Range page_range
The range of pages that need to be OCR.
Definition: fs_ocr.h:198
static void Release()
Release OCR engine.
Definition: fx_coordinates.h:771