Foxit PDF Conversion SDK
fs_pdf2office.h
浏览该文件的文档.
1 
15 #ifndef FS_CONVERT_H_
16 #define FS_CONVERT_H_
17 
18 #include "common/fs_common.h"
19 
25 namespace foxit {
26 using namespace common;
30 namespace conversion {
34 namespace pdf2office {
36 class PDF2WordSettingData FS_FINAL : public Object{
37  public:
40  : enable_retain_page_layout(false)
41  , enable_generate_headers_and_footers(true)
42  , enable_generate_footnotes_and_endnotes(false)
43  , enable_generate_page_rendered_break(false)
44  , max_blank_paragraphs_per_page_bottom(0){ }
45 
63  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) {
64  this->enable_retain_page_layout = enable_retain_page_layout;
65  this->enable_generate_headers_and_footers = enable_generate_headers_and_footers;
66  this->enable_generate_footnotes_and_endnotes = enable_generate_footnotes_and_endnotes;
67  this->enable_generate_page_rendered_break = enable_generate_page_rendered_break;
68  this->max_blank_paragraphs_per_page_bottom = max_blank_paragraphs_per_page_bottom;
69  }
70 
78  PDF2WordSettingData & operator = (const PDF2WordSettingData & data) {
79  enable_retain_page_layout = data.enable_retain_page_layout;
80  enable_generate_headers_and_footers = data.enable_generate_headers_and_footers;
81  enable_generate_footnotes_and_endnotes = data.enable_generate_footnotes_and_endnotes;
82  enable_generate_page_rendered_break = data.enable_generate_page_rendered_break;
83  max_blank_paragraphs_per_page_bottom = data.max_blank_paragraphs_per_page_bottom;
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, int max_blank_paragraphs_per_page_bottom) {
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  this->max_blank_paragraphs_per_page_bottom = max_blank_paragraphs_per_page_bottom;
112  }
113 
121 
132 
141 
152 
162 };
163 
165 class PDF2PowerPointSettingData FS_FINAL : public Object{
166  public:
169  : enable_aggressively_split_sections(false)
170  , enable_adapt_to_largest_page(false) { }
171 
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 
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 
224  void Set(bool enable_aggressively_split_sections, bool enable_adapt_to_largest_page) {
225  this->enable_aggressively_split_sections = enable_aggressively_split_sections;
226  this->enable_adapt_to_largest_page = enable_adapt_to_largest_page;
227  }
228 
238 
250 };
251 
253 class PDF2ExcelSettingData FS_FINAL : public Object {
254  public:
260  typedef enum _WorkbookSettings {
262  e_WorkbookSettingsDocument = 0,
264  e_WorkbookSettingsEachTable = 1,
266  e_WorkbookSettingsEachPage = 2
267  } WorkbookSettings;
268 
271  : decimal_symbol("")
272  , thousands_separator("")
273  , workbook_settings(PDF2ExcelSettingData::e_WorkbookSettingsEachPage)
274  , enable_aggressive_table_repair(true)
275  , include_watermarks(false){ }
276 
290  PDF2ExcelSettingData(String decimal_symbol, String thousands_separator, WorkbookSettings workbook_settings, bool enable_aggressive_table_repair, bool include_watermarks) {
291  this->decimal_symbol = decimal_symbol;
292  this->thousands_separator = thousands_separator;
293  this->workbook_settings = workbook_settings;
294  this->enable_aggressive_table_repair = enable_aggressive_table_repair;
295  this->include_watermarks = include_watermarks;
296  }
297 
305  PDF2ExcelSettingData& operator = (const PDF2ExcelSettingData& data) {
306  this->decimal_symbol = data.decimal_symbol;
307  this->thousands_separator = data.thousands_separator;
308  this->workbook_settings = data.workbook_settings;
309  this->enable_aggressive_table_repair = data.enable_aggressive_table_repair;
310  this->include_watermarks = data.include_watermarks;
311  return (*this);
312  }
313 
329  void Set(String decimal_symbol, String thousands_separator, WorkbookSettings workbook_settings, bool enable_aggressive_table_repair, bool include_watermarks) {
330  this->decimal_symbol = decimal_symbol;
331  this->thousands_separator = thousands_separator;
332  this->workbook_settings = workbook_settings;
333  this->enable_aggressive_table_repair = enable_aggressive_table_repair;
334  this->include_watermarks = include_watermarks;
335  }
336 
351 
367 
375 
385 
395 };
396 
398 class PDF2OfficeSettingData FS_FINAL : public Object {
399  public:
402  : enable_ml_recognition(false)
403  , include_pdf_comments(true)
404  , enable_trailing_space(true)
405  , include_images(true)
406  , enable_matching_system_fonts(false) { }
407 
442  PDF2OfficeSettingData(const wchar_t* metrics_data_folder_path, bool enable_ml_recognition, const Range& page_range, bool include_pdf_comments,
443  const PDF2WordSettingData& word_setting_data, const PDF2PowerPointSettingData& power_point_setting_data,
444  const PDF2ExcelSettingData& excel_setting_data, bool enable_trailing_space, bool include_images, bool enable_matching_system_fonts) {
445  this->metrics_data_folder_path = metrics_data_folder_path;
446  this->enable_ml_recognition = enable_ml_recognition;
447  this->page_range = page_range;
448  this->include_pdf_comments = include_pdf_comments;
449  this->word_setting_data = word_setting_data;
450  this->power_point_setting_data = power_point_setting_data;
451  this->excel_setting_data = excel_setting_data;
452  this->enable_trailing_space = enable_trailing_space;
453  this->include_images = include_images;
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  enable_matching_system_fonts = data.enable_matching_system_fonts;
475  return (*this);
476  }
477 
514  void Set(const wchar_t* metrics_data_folder_path, bool enable_ml_recognition, const Range &page_range, bool include_pdf_comments,
515  const PDF2WordSettingData& word_setting_data, const PDF2PowerPointSettingData& power_point_setting_data,
516  const PDF2ExcelSettingData& excel_setting_data, bool enable_trailing_space, bool include_images, bool enable_matching_system_fonts) {
517  this->metrics_data_folder_path = metrics_data_folder_path;
518  this->enable_ml_recognition = enable_ml_recognition;
519  this->page_range = page_range;
520  this->include_pdf_comments = include_pdf_comments;
521  this->word_setting_data = word_setting_data;
522  this->power_point_setting_data = power_point_setting_data;
523  this->excel_setting_data = excel_setting_data;
524  this->enable_trailing_space = enable_trailing_space;
525  this->include_images = include_images;
526  this->enable_matching_system_fonts = enable_matching_system_fonts;
527  }
528 
538 
552 
561 
570 
578 
586 
594 
605 
615 
625 };
626 
632  public:
638  virtual bool NeedToPause() = 0;
639 
648  virtual void ProgressNotify(int converted_count, int total_count) = 0;
649 };
650 
659 class PDF2Office FS_FINAL : public Base {
660  public:
688  static Progressive StartConvertToWord(const wchar_t* src_pdf_path, const wchar_t* src_pdf_password, const wchar_t* saved_word_file_path,
689  const PDF2OfficeSettingData& setting_data, ConvertCallback* convert_callback = NULL);
690 
719  static Progressive StartConvertToWord(file::ReaderCallback* src_pdf_reader, const wchar_t* src_pdf_password, file::StreamCallback* saved_word_file_stream,
720  const PDF2OfficeSettingData& setting_data, ConvertCallback* convert_callback = NULL);
721 
748  static Progressive StartConvertToExcel(const wchar_t* src_pdf_path, const wchar_t* src_pdf_password, const wchar_t* saved_excel_file_path,
749  const PDF2OfficeSettingData& setting_data, ConvertCallback* convert_callback = NULL);
750 
778  static Progressive StartConvertToExcel(file::ReaderCallback* src_pdf_reader, const wchar_t* src_pdf_password, file::StreamCallback* saved_excel_file_stream,
779  const PDF2OfficeSettingData& setting_data, ConvertCallback* convert_callback = NULL);
780 
807  static Progressive StartConvertToPowerPoint(const wchar_t* src_pdf_path, const wchar_t* src_pdf_password, const wchar_t* saved_ppt_file_path,
808  const PDF2OfficeSettingData& setting_data, ConvertCallback* convert_callback = NULL);
809 
837  static Progressive StartConvertToPowerPoint(file::ReaderCallback* src_pdf_reader, const wchar_t* src_pdf_password, file::StreamCallback* saved_ppt_file_stream,
838  const PDF2OfficeSettingData& setting_data, ConvertCallback* convert_callback = NULL);
839 };
840 } // namespace pdf2office
841 } // namespace conversion
842 } // namespace foxit
843 
844 #endif
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)
带参数的构造函数。
Definition: fs_pdf2office.h:63
PDF2PowerPointSettingData()
构造函数。
Definition: fs_pdf2office.h:168
Definition: fs_common.h:269
CFX_Object Object
对象类型。
Definition: fs_basictypes.h:145
int max_blank_paragraphs_per_page_bottom
指定将PDF文件转换为Word文档时,每个页面底部可以放置的最大空白段落数。
Definition: fs_pdf2office.h:161
文件读取接口。
Definition: fx_stream.h:587
bool enable_trailing_space
一个布尔值,指示在将PDF文档转换为Office格式文档时 是否从段落中的行添加尾随空格。默认值:true。
Definition: fs_pdf2office.h:604
宽字符串类
Definition: fx_string.h:1457
PDF2WordSettingData word_setting_data
用于将PDF文档转换为Word格式文档的设置数据对象。
Definition: fs_pdf2office.h:577
bool enable_aggressively_split_sections
一个布尔值,指示在将PDF文档转换为PowerPoint格式文档时是否积极拆分节。默认值:false。
Definition: fs_pdf2office.h:237
bool enable_generate_headers_and_footers
一个布尔值,指示在将PDF文档转换为Word格式文档过程中,是否将PDF文档中识别出的页眉和页脚 转换为Word格式文档的页眉和页脚。默认值:true。
Definition: fs_pdf2office.h:131
PDF2ExcelSettingData(String decimal_symbol, String thousands_separator, WorkbookSettings workbook_settings, bool enable_aggressive_table_repair, bool include_watermarks)
带参数的构造函数。
Definition: fs_pdf2office.h:290
PDF2OfficeSettingData(const wchar_t *metrics_data_folder_path, bool enable_ml_recognition, const Range &page_range, bool include_pdf_comments, const PDF2WordSettingData &word_setting_data, const PDF2PowerPointSettingData &power_point_setting_data, const PDF2ExcelSettingData &excel_setting_data, bool enable_trailing_space, bool include_images, bool enable_matching_system_fonts)
带参数的构造函数。
Definition: fs_pdf2office.h:442
String thousands_separator
一个字符串值,指示在将PDF文档转换为Excel格式文档时被识别为千位分隔符。
Definition: fs_pdf2office.h:366
bool enable_generate_page_rendered_break
一个布尔值,指示在将PDF文档转换为Word格式文档过程中,是否在Word格式文档中 生成"lastRenderedPageBreak"标记。默认值:false。
Definition: fs_pdf2office.h:151
PDF2ExcelSettingData excel_setting_data
用于将PDF文档转换为Excel格式文档的设置数据对象。
Definition: fs_pdf2office.h:593
WString metrics_data_folder_path
包含度量数据文件的文件夹的有效路径。此参数不应为空字符串。
Definition: fs_pdf2office.h:537
void Set(bool enable_aggressively_split_sections, bool enable_adapt_to_largest_page)
设置值。
Definition: fs_pdf2office.h:224
文件流接口,用于读取和写入。
Definition: fx_stream.h:692
bool enable_adapt_to_largest_page
一个布尔值,指示在将PDF文档转换为PowerPoint格式过程中,是否将较小页面的内容适应为最大页面尺寸。默认值:false。
Definition: fs_pdf2office.h:249
PDF2PowerPointSettingData power_point_setting_data
用于将PDF文档转换为PowerPoint格式文档的设置数据对象。
Definition: fs_pdf2office.h:585
bool enable_aggressive_table_repair
一个布尔值,指示在将PDF文档转换为Excel格式文档时是否启用强化表格修复。默认值:true。
Definition: fs_pdf2office.h:384
Definition: fs_common.h:206
WorkbookSettings
Excel工作簿设置的枚举。
Definition: fs_pdf2office.h:260
通用定义和类的头文件。
void Set(const wchar_t *metrics_data_folder_path, bool enable_ml_recognition, const Range &page_range, bool include_pdf_comments, const PDF2WordSettingData &word_setting_data, const PDF2PowerPointSettingData &power_point_setting_data, const PDF2ExcelSettingData &excel_setting_data, bool enable_trailing_space, bool include_images, bool enable_matching_system_fonts)
设置值。
Definition: fs_pdf2office.h:514
PDF2WordSettingData()
构造函数。
Definition: fs_pdf2office.h:39
bool enable_retain_page_layout
一个布尔值,指示在将PDF文档转换为Word格式文档时是否保留页面布局。默认值:false。
Definition: fs_pdf2office.h:120
String decimal_symbol
一个字符串值,指示在将PDF文档转换为Excel格式文档时被识别为小数点。
Definition: fs_pdf2office.h:350
bool include_images
一个布尔值,指示在将PDF文档转换为Office格式文档时 是否包含PDF文档中的图像。默认值:true。
Definition: fs_pdf2office.h:614
Definition: fs_basictypes.h:232
PDF2ExcelSettingData()
构造函数。
Definition: fs_pdf2office.h:270
Foxit 命名空间。
Definition: fs_basictypes.h:124
WorkbookSettings workbook_settings
一个枚举值,指示将PDF文档转换为Excel格式文档时工作簿的设置。
Definition: fs_pdf2office.h:374
Definition: fs_pdf2office.h:659
void Set(String decimal_symbol, String thousands_separator, WorkbookSettings workbook_settings, bool enable_aggressive_table_repair, bool include_watermarks)
设置值。
Definition: fs_pdf2office.h:329
bool include_watermarks
一个布尔值,指示在将PDF文档转换为Excel格式文档时是否包含水印。默认值:false。
Definition: fs_pdf2office.h:394
字节字符串类
Definition: fx_string.h:317
bool include_pdf_comments
一个布尔值,指示在将PDF文档转换为Office格式文档时 是否包含PDF文档注释。默认值:true。
Definition: fs_pdf2office.h:569
Definition: fs_pdf2office.h:631
bool enable_generate_footnotes_and_endnotes
一个布尔值,指示在将PDF文档转换为Word格式文档过程中,是否将PDF文档中识别出的脚注和尾注 转换为Word格式文档的脚注和尾注。默认值:false。
Definition: fs_pdf2office.h:140
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, int max_blank_paragraphs_per_page_bottom)
设置值。
Definition: fs_pdf2office.h:106
#define NULL
空指针值。
Definition: fx_system.h:792
PDF2OfficeSettingData()
构造函数。
Definition: fs_pdf2office.h:401
bool enable_matching_system_fonts
一个布尔值,指示在将PDF文档转换为Office格式文档时 是否准确匹配系统字体。默认值:false。
Definition: fs_pdf2office.h:624
Range page_range
指定某些页面的范围对象。这些页面将用于将PDF文档转换为Office格式文档。
Definition: fs_pdf2office.h:560
bool enable_ml_recognition
一个布尔值,指示是否启用基于机器学习的识别功能。默认值:false。
Definition: fs_pdf2office.h:551
PDF2PowerPointSettingData(bool enable_aggressively_split_sections, bool enable_adapt_to_largest_page)
带参数的构造函数。
Definition: fs_pdf2office.h:188