Foxit PDF SDK
fs_pdf2office.h
Go to the documentation of this file.
1 
14 #ifndef FS_PDF2OFFICE_H_
15 #define FS_PDF2OFFICE_H_
16 #if defined(_WIN32) || defined(_WIN64) || (defined(__linux__) && !defined(__ANDROID__))
17 #include "common/fs_common.h"
18 
24 namespace foxit {
28 namespace addon {
32 namespace conversion {
36 namespace pdf2office {
38 class PDF2WordSettingData FS_FINAL : public Object{
39  public:
41  PDF2WordSettingData()
42  : enable_retain_page_layout(false)
43  , enable_generate_headers_and_footers(false)
44  , enable_generate_footnotes_and_endnotes(false)
45  , enable_generate_page_rendered_break(false) { }
46 
65  PDF2WordSettingData(bool enable_retain_page_layout, bool enable_generate_headers_and_footers, bool enable_generate_footnotes_and_endnotes, bool enable_generate_page_rendered_break) {
66  this->enable_retain_page_layout = enable_retain_page_layout;
67  this->enable_generate_headers_and_footers = enable_generate_headers_and_footers;
68  this->enable_generate_footnotes_and_endnotes = enable_generate_footnotes_and_endnotes;
69  this->enable_generate_page_rendered_break = enable_generate_page_rendered_break;
70  }
71 
79  PDF2WordSettingData & operator = (const PDF2WordSettingData & data) {
80  enable_retain_page_layout = data.enable_retain_page_layout;
81  enable_generate_headers_and_footers = data.enable_generate_headers_and_footers;
82  enable_generate_footnotes_and_endnotes = data.enable_generate_footnotes_and_endnotes;
83  enable_generate_page_rendered_break = data.enable_generate_page_rendered_break;
84  return (*this);
85  }
86 
106  void Set(bool enable_retain_page_layout, bool enable_generate_headers_and_footers, bool enable_generate_footnotes_and_endnotes, bool enable_generate_page_rendered_break) {
107  this->enable_retain_page_layout = enable_retain_page_layout;
108  this->enable_generate_headers_and_footers = enable_generate_headers_and_footers;
109  this->enable_generate_footnotes_and_endnotes = enable_generate_footnotes_and_endnotes;
110  this->enable_generate_page_rendered_break = enable_generate_page_rendered_break;
111  }
112 
119  bool enable_retain_page_layout;
120 
128  bool enable_generate_headers_and_footers;
129 
137  bool enable_generate_footnotes_and_endnotes;
138 
149  bool enable_generate_page_rendered_break;
150 };
151 
153 class PDF2PowerPointSettingData FS_FINAL : public Object{
154  public:
156  PDF2PowerPointSettingData()
157  : enable_aggressively_split_sections(false) {}
158 
168  PDF2PowerPointSettingData(bool enable_aggressively_split_sections) {
169  this->enable_aggressively_split_sections = enable_aggressively_split_sections;
170  }
171 
179  PDF2PowerPointSettingData & operator = (const PDF2PowerPointSettingData & data) {
180  enable_aggressively_split_sections = data.enable_aggressively_split_sections;
181  return (*this);
182  }
183 
195  void Set(bool enable_aggressively_split_sections) {
196  this->enable_aggressively_split_sections = enable_aggressively_split_sections;
197  }
198 
207  bool enable_aggressively_split_sections;
208 };
209 
211 class PDF2ExcelSettingData FS_FINAL : public Object{
212  public:
218  typedef enum _WorkbookSettings {
220  e_WorkbookSettingsDocument = 0,
222  e_WorkbookSettingsEachTable = 1,
224  e_WorkbookSettingsEachPage = 2
225  } WorkbookSettings;
226 
228  PDF2ExcelSettingData()
229  : decimal_symbol("")
230  , workbook_settings(PDF2ExcelSettingData::e_WorkbookSettingsEachPage)
231  , thousands_separator("") { }
232 
240  PDF2ExcelSettingData(String decimal_symbol, String thousands_separator, WorkbookSettings workbook_settings) {
241  this->decimal_symbol = decimal_symbol;
242  this->thousands_separator = thousands_separator;
243  this->workbook_settings = workbook_settings;
244  }
245 
253  PDF2ExcelSettingData & operator = (const PDF2ExcelSettingData & data) {
254  this->decimal_symbol = data.decimal_symbol;
255  this->thousands_separator = data.thousands_separator;
256  this->workbook_settings = data.workbook_settings;
257  return (*this);
258  }
259 
269  void Set(String decimal_symbol, String thousands_separator, WorkbookSettings workbook_settings) {
270  this->decimal_symbol = decimal_symbol;
271  this->thousands_separator = thousands_separator;
272  this->workbook_settings = workbook_settings;
273  }
274 
288  String decimal_symbol;
289 
304  String thousands_separator;
305 
312  WorkbookSettings workbook_settings;
313 };
314 
316 class PDF2OfficeSettingData FS_FINAL : public Object {
317  public:
319  PDF2OfficeSettingData()
320  : enable_ml_recognition(false)
321  , include_pdf_comments(true)
322  , enable_trailing_space(true)
323  , include_images(true)
324  , timeout(0) { }
325 
361  PDF2OfficeSettingData(const wchar_t* metrics_data_folder_path, bool enable_ml_recognition, const common::Range& page_range, bool include_pdf_comments,
362  const PDF2WordSettingData& word_setting_data, const PDF2PowerPointSettingData& power_point_setting_data,
363  const PDF2ExcelSettingData& excel_setting_data, bool enable_trailing_space, bool include_images, int timeout) {
364  this->metrics_data_folder_path = metrics_data_folder_path;
365  this->enable_ml_recognition = enable_ml_recognition;
366  this->page_range = page_range;
367  this->include_pdf_comments = include_pdf_comments;
368  this->word_setting_data = word_setting_data;
369  this->power_point_setting_data = power_point_setting_data;
370  this->excel_setting_data = excel_setting_data;
371  this->enable_trailing_space = enable_trailing_space;
372  this->include_images = include_images;
373  this->timeout = timeout;
374  }
375 
383  PDF2OfficeSettingData &operator = (const PDF2OfficeSettingData& data) {
384  metrics_data_folder_path = data.metrics_data_folder_path;
385  enable_ml_recognition = data.enable_ml_recognition;
386  page_range = data.page_range;
387  include_pdf_comments = data.include_pdf_comments;
388  word_setting_data = data.word_setting_data;
389  power_point_setting_data = data.power_point_setting_data;
390  excel_setting_data = data.excel_setting_data;
391  enable_trailing_space = data.enable_trailing_space;
392  include_images = data.include_images;
393  timeout = data.timeout;
394  return (*this);
395  }
396 
434  void Set(const wchar_t* metrics_data_folder_path, bool enable_ml_recognition, const common::Range &page_range, bool include_pdf_comments,
435  const PDF2WordSettingData& word_setting_data, const PDF2PowerPointSettingData& power_point_setting_data,
436  const PDF2ExcelSettingData& excel_setting_data, bool enable_trailing_space, bool include_images, int timeout) {
437  this->metrics_data_folder_path = metrics_data_folder_path;
438  this->enable_ml_recognition = enable_ml_recognition;
439  this->page_range = page_range;
440  this->include_pdf_comments = include_pdf_comments;
441  this->word_setting_data = word_setting_data;
442  this->power_point_setting_data = power_point_setting_data;
443  this->excel_setting_data = excel_setting_data;
444  this->enable_trailing_space = enable_trailing_space;
445  this->include_images = include_images;
446  this->timeout = timeout;
447  }
448 
457  WString metrics_data_folder_path;
458 
471  bool enable_ml_recognition;
472 
480  common::Range page_range;
481 
489  bool include_pdf_comments;
490 
497  PDF2WordSettingData word_setting_data;
498 
505  PDF2PowerPointSettingData power_point_setting_data;
506 
513  PDF2ExcelSettingData excel_setting_data;
514 
526  bool enable_trailing_space;
527 
537  bool include_images;
538 
550  int timeout;
551 };
552 
557 class ConvertCallback {
558  public:
564  virtual bool NeedToPause() = 0;
565 
574  virtual void ProgressNotify(int converted_count, int total_count) = 0;
575 };
576 
582 class ConvertCheckCallback {
583  public:
593  virtual bool CheckUserPermissions(uint32 user_permissions) = 0;
594 };
595 
604 class PDF2Office FS_FINAL : public Base {
605  public:
622  static void Initialize(const wchar_t* library_path, const wchar_t* fx_engine_path = L"");
623 
631  static void Release();
632 
649  static bool SetConvertCheckCallback(ConvertCheckCallback* convert_check_callback);
650 
676  static common::Progressive StartConvertToWord(const wchar_t* src_pdf_path, const wchar_t* src_pdf_password, const wchar_t* saved_word_file_path,
677  const PDF2OfficeSettingData& setting_data, ConvertCallback* convert_callback = NULL);
678 
705  static common::Progressive StartConvertToWord(common::file::ReaderCallback* src_pdf_reader, const wchar_t* src_pdf_password, common::file::StreamCallback* saved_word_file_stream,
706  const PDF2OfficeSettingData& setting_data, ConvertCallback* convert_callback = NULL);
707 
733  static common::Progressive StartConvertToExcel(const wchar_t* src_pdf_path, const wchar_t* src_pdf_password, const wchar_t* saved_excel_file_path,
734  const PDF2OfficeSettingData& setting_data, ConvertCallback* convert_callback = NULL);
735 
762  static common::Progressive StartConvertToExcel(common::file::ReaderCallback* src_pdf_reader, const wchar_t* src_pdf_password, common::file::StreamCallback* saved_excel_file_stream,
763  const PDF2OfficeSettingData& setting_data, ConvertCallback* convert_callback = NULL);
764 
790  static common::Progressive StartConvertToPowerPoint(const wchar_t* src_pdf_path, const wchar_t* src_pdf_password, const wchar_t* saved_ppt_file_path,
791  const PDF2OfficeSettingData& setting_data, ConvertCallback* convert_callback = NULL);
792 
819  static common::Progressive StartConvertToPowerPoint(common::file::ReaderCallback* src_pdf_reader, const wchar_t* src_pdf_password, common::file::StreamCallback* saved_ppt_file_stream,
820  const PDF2OfficeSettingData& setting_data, ConvertCallback* convert_callback = NULL);
821 
822 };
823 
824 } // namespace pdf2office
825 } // namespace conversion
826 } // namespace addon
827 } // namespace foxit
828 
829 #endif //defined(WIN32)
830 #endif
foxit::Object
CFX_Object Object
Object type.
Definition: fs_basictypes.h:221
fs_common.h
Header file for common definitions and classes.
foxit::WString
CFX_WideString WString
Wide string.
Definition: fs_basictypes.h:223
foxit
Foxit namespace.
Definition: fs_taggedpdf.h:27
foxit::common::file::StreamCallback
IFX_FileStream StreamCallback
Definition: fs_file.h:54
foxit::common::file::ReaderCallback
IFX_FileRead ReaderCallback
Definition: fs_file.h:40
NULL
#define NULL
The null-pointer value.
Definition: fx_system.h:792
foxit::String
CFX_ByteString String
Byte string.
Definition: fs_basictypes.h:225
foxit::uint32
FX_UINT32 uint32
32-bit unsigned integer.
Definition: fs_basictypes.h:196