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(true)
44  , enable_generate_footnotes_and_endnotes(false)
45  , enable_generate_page_rendered_break(false)
46  , max_blank_paragraphs_per_page_bottom(-1) { }
47 
67  PDF2WordSettingData(bool enable_retain_page_layout, bool enable_generate_headers_and_footers, bool enable_generate_footnotes_and_endnotes, bool enable_generate_page_rendered_break, int max_blank_paragraphs_per_page_bottom) {
68  this->enable_retain_page_layout = enable_retain_page_layout;
69  this->enable_generate_headers_and_footers = enable_generate_headers_and_footers;
70  this->enable_generate_footnotes_and_endnotes = enable_generate_footnotes_and_endnotes;
71  this->enable_generate_page_rendered_break = enable_generate_page_rendered_break;
72  this->max_blank_paragraphs_per_page_bottom = max_blank_paragraphs_per_page_bottom;
73  }
74 
82  PDF2WordSettingData & operator = (const PDF2WordSettingData & data) {
83  enable_retain_page_layout = data.enable_retain_page_layout;
84  enable_generate_headers_and_footers = data.enable_generate_headers_and_footers;
85  enable_generate_footnotes_and_endnotes = data.enable_generate_footnotes_and_endnotes;
86  enable_generate_page_rendered_break = data.enable_generate_page_rendered_break;
87  max_blank_paragraphs_per_page_bottom = data.max_blank_paragraphs_per_page_bottom;
88  return (*this);
89  }
90 
112  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) {
113  this->enable_retain_page_layout = enable_retain_page_layout;
114  this->enable_generate_headers_and_footers = enable_generate_headers_and_footers;
115  this->enable_generate_footnotes_and_endnotes = enable_generate_footnotes_and_endnotes;
116  this->enable_generate_page_rendered_break = enable_generate_page_rendered_break;
117  this->max_blank_paragraphs_per_page_bottom = max_blank_paragraphs_per_page_bottom;
118  }
119 
126  bool enable_retain_page_layout;
127 
135  bool enable_generate_headers_and_footers;
136 
144  bool enable_generate_footnotes_and_endnotes;
145 
156  bool enable_generate_page_rendered_break;
157 
166  int max_blank_paragraphs_per_page_bottom;
167 };
168 
170 class PDF2PowerPointSettingData FS_FINAL : public Object{
171  public:
173  PDF2PowerPointSettingData()
174  : enable_aggressively_split_sections(false)
175  , enable_adapt_to_largest_page(false) { }
176 
193  PDF2PowerPointSettingData(bool enable_aggressively_split_sections, bool enable_adapt_to_largest_page) {
194  this->enable_aggressively_split_sections = enable_aggressively_split_sections;
195  this->enable_adapt_to_largest_page = enable_adapt_to_largest_page;
196  }
197 
205  PDF2PowerPointSettingData & operator = (const PDF2PowerPointSettingData & data) {
206  enable_aggressively_split_sections = data.enable_aggressively_split_sections;
207  enable_adapt_to_largest_page = data.enable_adapt_to_largest_page;
208  return (*this);
209  }
210 
229  void Set(bool enable_aggressively_split_sections, bool enable_adapt_to_largest_page) {
230  this->enable_aggressively_split_sections = enable_aggressively_split_sections;
231  this->enable_adapt_to_largest_page = enable_adapt_to_largest_page;
232  }
233 
242  bool enable_aggressively_split_sections;
243 
254  bool enable_adapt_to_largest_page;
255 };
256 
258 class PDF2ExcelSettingData FS_FINAL : public Object{
259  public:
265  typedef enum _WorkbookSettings {
267  e_WorkbookSettingsDocument = 0,
269  e_WorkbookSettingsEachTable = 1,
271  e_WorkbookSettingsEachPage = 2
272  } WorkbookSettings;
273 
275  PDF2ExcelSettingData()
276  : decimal_symbol("")
277  , workbook_settings(PDF2ExcelSettingData::e_WorkbookSettingsEachPage)
278  , thousands_separator("")
279  , enable_aggressive_table_repair(true)
280  , include_watermarks(false) { }
281 
295  PDF2ExcelSettingData(String decimal_symbol, String thousands_separator, WorkbookSettings workbook_settings, bool enable_aggressive_table_repair, bool include_watermarks) {
296  this->decimal_symbol = decimal_symbol;
297  this->thousands_separator = thousands_separator;
298  this->workbook_settings = workbook_settings;
299  this->enable_aggressive_table_repair = enable_aggressive_table_repair;
300  this->include_watermarks = include_watermarks;
301  }
302 
310  PDF2ExcelSettingData & operator = (const PDF2ExcelSettingData & data) {
311  this->decimal_symbol = data.decimal_symbol;
312  this->thousands_separator = data.thousands_separator;
313  this->workbook_settings = data.workbook_settings;
314  this->enable_aggressive_table_repair = data.enable_aggressive_table_repair;
315  this->include_watermarks = data.include_watermarks;
316  return (*this);
317  }
318 
334  void Set(String decimal_symbol, String thousands_separator, WorkbookSettings workbook_settings, bool enable_aggressive_table_repair, bool include_watermarks) {
335  this->decimal_symbol = decimal_symbol;
336  this->thousands_separator = thousands_separator;
337  this->workbook_settings = workbook_settings;
338  this->enable_aggressive_table_repair = enable_aggressive_table_repair;
339  this->include_watermarks = include_watermarks;
340  }
341 
355  String decimal_symbol;
356 
371  String thousands_separator;
372 
379  WorkbookSettings workbook_settings;
389  bool enable_aggressive_table_repair;
390 
400  bool include_watermarks;
401 };
402 
404 class PDF2OfficeSettingData FS_FINAL : public Object {
405  public:
407  PDF2OfficeSettingData()
408  : enable_ml_recognition(false)
409  , include_pdf_comments(true)
410  , enable_trailing_space(true)
411  , include_images(true)
412  , timeout(0)
413  , enable_matching_system_fonts(false) { }
414 
453  PDF2OfficeSettingData(const wchar_t* metrics_data_folder_path, bool enable_ml_recognition, const common::Range& page_range, bool include_pdf_comments,
454  const PDF2WordSettingData& word_setting_data, const PDF2PowerPointSettingData& power_point_setting_data,
455  const PDF2ExcelSettingData& excel_setting_data, bool enable_trailing_space, bool include_images, int timeout,
456  bool enable_matching_system_fonts) {
457  this->metrics_data_folder_path = metrics_data_folder_path;
458  this->enable_ml_recognition = enable_ml_recognition;
459  this->page_range = page_range;
460  this->include_pdf_comments = include_pdf_comments;
461  this->word_setting_data = word_setting_data;
462  this->power_point_setting_data = power_point_setting_data;
463  this->excel_setting_data = excel_setting_data;
464  this->enable_trailing_space = enable_trailing_space;
465  this->include_images = include_images;
466  this->timeout = timeout;
467  this->enable_matching_system_fonts = enable_matching_system_fonts;
468  }
469 
477  PDF2OfficeSettingData &operator = (const PDF2OfficeSettingData& data) {
478  metrics_data_folder_path = data.metrics_data_folder_path;
479  enable_ml_recognition = data.enable_ml_recognition;
480  page_range = data.page_range;
481  include_pdf_comments = data.include_pdf_comments;
482  word_setting_data = data.word_setting_data;
483  power_point_setting_data = data.power_point_setting_data;
484  excel_setting_data = data.excel_setting_data;
485  enable_trailing_space = data.enable_trailing_space;
486  include_images = data.include_images;
487  timeout = data.timeout;
488  enable_matching_system_fonts = data.enable_matching_system_fonts;
489  return (*this);
490  }
491 
532  void Set(const wchar_t* metrics_data_folder_path, bool enable_ml_recognition, const common::Range &page_range, bool include_pdf_comments,
533  const PDF2WordSettingData& word_setting_data, const PDF2PowerPointSettingData& power_point_setting_data,
534  const PDF2ExcelSettingData& excel_setting_data, bool enable_trailing_space, bool include_images, int timeout,
535  bool enable_matching_system_fonts) {
536  this->metrics_data_folder_path = metrics_data_folder_path;
537  this->enable_ml_recognition = enable_ml_recognition;
538  this->page_range = page_range;
539  this->include_pdf_comments = include_pdf_comments;
540  this->word_setting_data = word_setting_data;
541  this->power_point_setting_data = power_point_setting_data;
542  this->excel_setting_data = excel_setting_data;
543  this->enable_trailing_space = enable_trailing_space;
544  this->include_images = include_images;
545  this->timeout = timeout;
546  this->enable_matching_system_fonts = enable_matching_system_fonts;
547  }
548 
557  WString metrics_data_folder_path;
558 
571  bool enable_ml_recognition;
572 
580  common::Range page_range;
581 
589  bool include_pdf_comments;
590 
597  PDF2WordSettingData word_setting_data;
598 
605  PDF2PowerPointSettingData power_point_setting_data;
606 
613  PDF2ExcelSettingData excel_setting_data;
614 
626  bool enable_trailing_space;
627 
637  bool include_images;
638 
650  int timeout;
651 
661  bool enable_matching_system_fonts;
662 };
663 
668 class ConvertCallback {
669  public:
675  virtual bool NeedToPause() = 0;
676 
685  virtual void ProgressNotify(int converted_count, int total_count) = 0;
686 };
687 
693 class ConvertCheckCallback {
694  public:
704  virtual bool CheckUserPermissions(uint32 user_permissions) = 0;
705 };
706 
715 class PDF2Office FS_FINAL : public Base {
716  public:
733  static void Initialize(const wchar_t* library_path, const wchar_t* fx_engine_path = L"");
734 
742  static void Release();
743 
751  static String GetVersion();
752 
769  static bool SetConvertCheckCallback(ConvertCheckCallback* convert_check_callback);
770 
796  static common::Progressive StartConvertToWord(const wchar_t* src_pdf_path, const wchar_t* src_pdf_password, const wchar_t* saved_word_file_path,
797  const PDF2OfficeSettingData& setting_data, ConvertCallback* convert_callback = NULL);
798 
825  static common::Progressive StartConvertToWord(common::file::ReaderCallback* src_pdf_reader, const wchar_t* src_pdf_password, common::file::StreamCallback* saved_word_file_stream,
826  const PDF2OfficeSettingData& setting_data, ConvertCallback* convert_callback = NULL);
827 
853  static common::Progressive StartConvertToExcel(const wchar_t* src_pdf_path, const wchar_t* src_pdf_password, const wchar_t* saved_excel_file_path,
854  const PDF2OfficeSettingData& setting_data, ConvertCallback* convert_callback = NULL);
855 
882  static common::Progressive StartConvertToExcel(common::file::ReaderCallback* src_pdf_reader, const wchar_t* src_pdf_password, common::file::StreamCallback* saved_excel_file_stream,
883  const PDF2OfficeSettingData& setting_data, ConvertCallback* convert_callback = NULL);
884 
910  static common::Progressive StartConvertToPowerPoint(const wchar_t* src_pdf_path, const wchar_t* src_pdf_password, const wchar_t* saved_ppt_file_path,
911  const PDF2OfficeSettingData& setting_data, ConvertCallback* convert_callback = NULL);
912 
939  static common::Progressive StartConvertToPowerPoint(common::file::ReaderCallback* src_pdf_reader, const wchar_t* src_pdf_password, common::file::StreamCallback* saved_ppt_file_stream,
940  const PDF2OfficeSettingData& setting_data, ConvertCallback* convert_callback = NULL);
941 
942 };
943 
944 } // namespace pdf2office
945 } // namespace conversion
946 } // namespace addon
947 } // namespace foxit
948 
949 #endif //defined(WIN32)
950 #endif
foxit::Object
CFX_Object Object
Object type.
Definition: fs_basictypes.h:220
fs_common.h
Header file for common definitions and classes.
foxit::WString
CFX_WideString WString
Wide string.
Definition: fs_basictypes.h:222
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:224
foxit::uint32
FX_UINT32 uint32
32-bit unsigned integer.
Definition: fs_basictypes.h:195