Foxit PDF SDK
fs_pdf2office.h
浏览该文件的文档.
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 
66  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) {
67  this->enable_retain_page_layout = enable_retain_page_layout;
68  this->enable_generate_headers_and_footers = enable_generate_headers_and_footers;
69  this->enable_generate_footnotes_and_endnotes = enable_generate_footnotes_and_endnotes;
70  this->enable_generate_page_rendered_break = enable_generate_page_rendered_break;
71  this->max_blank_paragraphs_per_page_bottom = max_blank_paragraphs_per_page_bottom;
72  }
73 
81  PDF2WordSettingData & operator = (const PDF2WordSettingData & data) {
82  enable_retain_page_layout = data.enable_retain_page_layout;
83  enable_generate_headers_and_footers = data.enable_generate_headers_and_footers;
84  enable_generate_footnotes_and_endnotes = data.enable_generate_footnotes_and_endnotes;
85  enable_generate_page_rendered_break = data.enable_generate_page_rendered_break;
86  max_blank_paragraphs_per_page_bottom = data.max_blank_paragraphs_per_page_bottom;
87  return (*this);
88  }
89 
111  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) {
112  this->enable_retain_page_layout = enable_retain_page_layout;
113  this->enable_generate_headers_and_footers = enable_generate_headers_and_footers;
114  this->enable_generate_footnotes_and_endnotes = enable_generate_footnotes_and_endnotes;
115  this->enable_generate_page_rendered_break = enable_generate_page_rendered_break;
116  this->max_blank_paragraphs_per_page_bottom = max_blank_paragraphs_per_page_bottom;
117  }
118 
125  bool enable_retain_page_layout;
126 
134  bool enable_generate_headers_and_footers;
135 
143  bool enable_generate_footnotes_and_endnotes;
144 
154  bool enable_generate_page_rendered_break;
155 
163  int max_blank_paragraphs_per_page_bottom;
164 };
165 
167 class PDF2PowerPointSettingData FS_FINAL : public Object{
168  public:
170  PDF2PowerPointSettingData()
171  : enable_aggressively_split_sections(false) {}
172 
188  PDF2PowerPointSettingData(bool enable_aggressively_split_sections, bool enable_adapt_to_largest_page) {
189  this->enable_aggressively_split_sections = enable_aggressively_split_sections;
190  this->enable_adapt_to_largest_page = enable_adapt_to_largest_page;
191  }
192 
200  PDF2PowerPointSettingData & operator = (const PDF2PowerPointSettingData & data) {
201  enable_aggressively_split_sections = data.enable_aggressively_split_sections;
202  enable_adapt_to_largest_page = data.enable_adapt_to_largest_page;
203  return (*this);
204  }
205 
223  void Set(bool enable_aggressively_split_sections, bool enable_adapt_to_largest_page) {
224  this->enable_aggressively_split_sections = enable_aggressively_split_sections;
225  this->enable_adapt_to_largest_page = enable_adapt_to_largest_page;
226  }
227 
236  bool enable_aggressively_split_sections;
237 
247  bool enable_adapt_to_largest_page;
248 };
249 
251 class PDF2ExcelSettingData FS_FINAL : public Object{
252  public:
258  typedef enum _WorkbookSettings {
260  e_WorkbookSettingsDocument = 0,
262  e_WorkbookSettingsEachTable = 1,
264  e_WorkbookSettingsEachPage = 2
265  } WorkbookSettings;
266 
268  PDF2ExcelSettingData()
269  : decimal_symbol("")
270  , workbook_settings(PDF2ExcelSettingData::e_WorkbookSettingsEachPage)
271  , thousands_separator("")
272  ,enable_aggressive_table_repair(true)
273  ,include_watermarks(false) { }
274 
288  PDF2ExcelSettingData(String decimal_symbol, String thousands_separator, WorkbookSettings workbook_settings, bool enable_aggressive_table_repair, bool include_watermarks) {
289  this->decimal_symbol = decimal_symbol;
290  this->thousands_separator = thousands_separator;
291  this->workbook_settings = workbook_settings;
292  this->enable_aggressive_table_repair = enable_aggressive_table_repair;
293  this->include_watermarks = include_watermarks;
294  }
295 
303  PDF2ExcelSettingData & operator = (const PDF2ExcelSettingData & data) {
304  this->decimal_symbol = data.decimal_symbol;
305  this->thousands_separator = data.thousands_separator;
306  this->workbook_settings = data.workbook_settings;
307  this->enable_aggressive_table_repair = data.enable_aggressive_table_repair;
308  this->include_watermarks = data.include_watermarks;
309  return (*this);
310  }
311 
327  void Set(String decimal_symbol, String thousands_separator, WorkbookSettings workbook_settings, bool enable_aggressive_table_repair, bool include_watermarks) {
328  this->decimal_symbol = decimal_symbol;
329  this->thousands_separator = thousands_separator;
330  this->workbook_settings = workbook_settings;
331  this->enable_aggressive_table_repair = enable_aggressive_table_repair;
332  this->include_watermarks = include_watermarks;
333  }
334 
347  String decimal_symbol;
348 
362  String thousands_separator;
363 
370  WorkbookSettings workbook_settings;
371 
380  bool enable_aggressive_table_repair;
381 
390  bool include_watermarks;
391 };
392 
394 class PDF2OfficeSettingData FS_FINAL : public Object {
395  public:
397  PDF2OfficeSettingData()
398  : enable_ml_recognition(false)
399  , include_pdf_comments(true)
400  , enable_trailing_space(true)
401  , include_images(true)
402  , timeout(0)
403  , enable_matching_system_fonts(false) { }
404 
440  PDF2OfficeSettingData(const wchar_t* metrics_data_folder_path, bool enable_ml_recognition, const common::Range& page_range, bool include_pdf_comments,
441  const PDF2WordSettingData& word_setting_data, const PDF2PowerPointSettingData& power_point_setting_data,
442  const PDF2ExcelSettingData& excel_setting_data, bool enable_trailing_space, bool include_images, int timeout,
443  bool enable_matching_system_fonts) {
444  this->metrics_data_folder_path = metrics_data_folder_path;
445  this->enable_ml_recognition = enable_ml_recognition;
446  this->page_range = page_range;
447  this->include_pdf_comments = include_pdf_comments;
448  this->word_setting_data = word_setting_data;
449  this->power_point_setting_data = power_point_setting_data;
450  this->excel_setting_data = excel_setting_data;
451  this->enable_trailing_space = enable_trailing_space;
452  this->include_images = include_images;
453  this->timeout = timeout;
454  this->enable_matching_system_fonts = enable_matching_system_fonts;
455  }
456 
464  PDF2OfficeSettingData &operator = (const PDF2OfficeSettingData& data) {
465  metrics_data_folder_path = data.metrics_data_folder_path;
466  enable_ml_recognition = data.enable_ml_recognition;
467  page_range = data.page_range;
468  include_pdf_comments = data.include_pdf_comments;
469  word_setting_data = data.word_setting_data;
470  power_point_setting_data = data.power_point_setting_data;
471  excel_setting_data = data.excel_setting_data;
472  enable_trailing_space = data.enable_trailing_space;
473  include_images = data.include_images;
474  timeout = data.timeout;
475  enable_matching_system_fonts = data.enable_matching_system_fonts;
476  return (*this);
477  }
478 
518  void Set(const wchar_t* metrics_data_folder_path, bool enable_ml_recognition, const common::Range &page_range, bool include_pdf_comments,
519  const PDF2WordSettingData& word_setting_data, const PDF2PowerPointSettingData& power_point_setting_data,
520  const PDF2ExcelSettingData& excel_setting_data, bool enable_trailing_space, bool include_images, int timeout,
521  bool enable_matching_system_fonts) {
522  this->metrics_data_folder_path = metrics_data_folder_path;
523  this->enable_ml_recognition = enable_ml_recognition;
524  this->page_range = page_range;
525  this->include_pdf_comments = include_pdf_comments;
526  this->word_setting_data = word_setting_data;
527  this->power_point_setting_data = power_point_setting_data;
528  this->excel_setting_data = excel_setting_data;
529  this->enable_trailing_space = enable_trailing_space;
530  this->include_images = include_images;
531  this->timeout = timeout;
532  this->enable_matching_system_fonts = enable_matching_system_fonts;
533  }
534 
543  WString metrics_data_folder_path;
544 
557  bool enable_ml_recognition;
558 
566  common::Range page_range;
567 
575  bool include_pdf_comments;
576 
583  PDF2WordSettingData word_setting_data;
584 
591  PDF2PowerPointSettingData power_point_setting_data;
592 
599  PDF2ExcelSettingData excel_setting_data;
600 
611  bool enable_trailing_space;
612 
621  bool include_images;
622 
634  int timeout;
635 
643  bool enable_matching_system_fonts;
644 };
645 
650 class ConvertCallback {
651  public:
657  virtual bool NeedToPause() = 0;
658 
667  virtual void ProgressNotify(int converted_count, int total_count) = 0;
668 };
669 
675 class ConvertCheckCallback {
676  public:
686  virtual bool CheckUserPermissions(uint32 user_permissions) = 0;
687 };
688 
697 class PDF2Office FS_FINAL : public Base {
698  public:
715  static void Initialize(const wchar_t* library_path, const wchar_t* fx_engine_path = L"");
716 
724  static void Release();
725 
733  static String GetVersion();
734 
749  static bool SetConvertCheckCallback(ConvertCheckCallback* convert_check_callback);
750 
773  static common::Progressive StartConvertToWord(const wchar_t* src_pdf_path, const wchar_t* src_pdf_password, const wchar_t* saved_word_file_path,
774  const PDF2OfficeSettingData& setting_data, ConvertCallback* convert_callback = NULL);
775 
799  static common::Progressive StartConvertToWord(common::file::ReaderCallback* src_pdf_reader, const wchar_t* src_pdf_password, common::file::StreamCallback* saved_word_file_stream,
800  const PDF2OfficeSettingData& setting_data, ConvertCallback* convert_callback = NULL);
801 
825  static common::Progressive StartConvertToExcel(const wchar_t* src_pdf_path, const wchar_t* src_pdf_password, const wchar_t* saved_excel_file_path,
826  const PDF2OfficeSettingData& setting_data, ConvertCallback* convert_callback = NULL);
827 
851  static common::Progressive StartConvertToExcel(common::file::ReaderCallback* src_pdf_reader, const wchar_t* src_pdf_password, common::file::StreamCallback* saved_excel_file_stream,
852  const PDF2OfficeSettingData& setting_data, ConvertCallback* convert_callback = NULL);
853 
876  static common::Progressive StartConvertToPowerPoint(const wchar_t* src_pdf_path, const wchar_t* src_pdf_password, const wchar_t* saved_ppt_file_path,
877  const PDF2OfficeSettingData& setting_data, ConvertCallback* convert_callback = NULL);
878 
902  static common::Progressive StartConvertToPowerPoint(common::file::ReaderCallback* src_pdf_reader, const wchar_t* src_pdf_password, common::file::StreamCallback* saved_ppt_file_stream,
903  const PDF2OfficeSettingData& setting_data, ConvertCallback* convert_callback = NULL);
904 
905 };
906 
907 } // namespace pdf2office
908 } // namespace conversion
909 } // namespace addon
910 } // namespace foxit
911 
912 #endif //defined(WIN32)
913 #endif
foxit::Object
CFX_Object Object
对象类型。
Definition: fs_basictypes.h:221
fs_common.h
通用定义和类的头文件。
foxit::WString
CFX_WideString WString
宽字符串。
Definition: fs_basictypes.h:223
foxit
Foxit命名空间。
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
空指针值。
Definition: fx_system.h:792
foxit::String
CFX_ByteString String
字节字符串。
Definition: fs_basictypes.h:225
foxit::uint32
FX_UINT32 uint32
无符号 32 位整数。
Definition: fs_basictypes.h:196