Foxit PDF SDK
fs_ocr.h
Go to the documentation of this file.
1 #if (defined(_WIN32) || defined(_WIN64))
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 {
47 class OCREngine FS_FINAL : public Object {
48  public:
68  static ErrorCode Initialize(const wchar_t* ocr_resource_path);
69 
78  static void Release();
79 
91  static void SetLogFile(const char* log_file_path);
92 
104  static void SetLogFile(const wchar_t* log_file_path);
105 
125  static void SetLanguages(const wchar_t* languages);
126 };
127 
129 class OCRSettingData FS_FINAL : public Object {
130  public:
135 
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 
214 class OCR FS_FINAL : public Base {
215  public:
219  OCR();
220 
226  OCR(const OCR& other);
227 
228  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
229  explicit OCR(FS_HANDLE handle);
231  ~OCR();
232 
240  OCR& operator = (const OCR& other);
248  bool operator == (const OCR& other) const;
256  bool operator != (const OCR& other) const;
257 
265  bool IsEmpty() const;
266 
279  void OCRPDFPage(pdf::PDFPage pdf_page, bool is_editable);
280 
293  void OCRPDFDocument(pdf::PDFDoc pdf_doc, bool is_editable);
294 
309  void OCRPDFDocuments(const ocr::OCRSettingDataArray& settingdata_array);
310 };
311 
312 } // namespace ocr
313 } // namespace addon
314 } // namespace foxit
315 
316 #endif // FS_OCR_H_
317 
318 #endif // #if (defined(_WIN32) || defined(_WIN64))
Definition: fs_common.h:1179
CFX_Object Object
Object type.
Definition: fs_basictypes.h:217
bool is_editable
Whether the OCR result is editable. true means the OCR result is editable. false means the OCR result...
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.
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:508
static ErrorCode Initialize(const wchar_t *ocr_resource_path)
Initialize OCR engine.
OCRSettingData()
Constructor.
Definition: fs_ocr.h:134
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:47
Definition: fs_ocr.h:214
ErrorCode
Enumeration for error code.
Definition: fs_basictypes.h:233
pdf::PDFDoc pdf_doc
A PDFDoc object 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
Header file for common definitions and classes.
bool operator!=(const OCRSettingData &data)
Assign operator.
Definition: fs_ocr.h:188
Definition: fs_basictypes.h:407
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:129
common::Range page_range
The range of pages that need to be OCR.
Definition: fs_ocr.h:198
static void Release()
Release OCR engine.