Foxit PDF SDK
fs_convert.h
Go to the documentation of this file.
1 
15 #ifndef FS_CONVERT_H_
16 #define FS_CONVERT_H_
17 
18 #include "common/fs_common.h"
19 #include "pdf/fs_pdfdoc.h"
20 #include "pdf/fs_pdfpage.h"
21 
27 namespace foxit {
31 namespace addon {
35 namespace conversion {
37 class HTML2PDFSettingData FS_FINAL : public Object{
38  public:
44  typedef enum _HTML2PDFPageMode {
50 
53  : page_width(0)
54  , page_height(0)
55  , is_to_page_scale(false)
56  , page_margin(0.0f, 0.0f, 0.0f, 0.0f)
57  , rotate_degrees(common::e_Rotation0)
58  , is_convert_link(false)
59  , is_generate_tag(false)
61  {}
62 
82  this->page_width = page_width;
83  this->page_height = page_height;
84  this->is_to_page_scale = is_to_page_scale;
85  this->page_margin = page_margin;
86  this->is_convert_link = is_convert_link;
87  this->rotate_degrees = rotate_degrees;
88  this->is_generate_tag = is_generate_tag;
89  this->page_mode = page_mode;
90  }
91 
100  page_width = data.page_width;
101  page_height = data.page_height;
103  page_margin = data.page_margin;
107  page_mode = data.page_mode;
108  return (*this);
109  }
110 
130  this->page_width = page_width;
131  this->page_height = page_height;
132  this->is_to_page_scale = is_to_page_scale;
133  this->page_margin = page_margin;
134  this->is_convert_link = is_convert_link;
135  this->rotate_degrees = rotate_degrees;
136  this->is_generate_tag = is_generate_tag;
137  this->page_mode = page_mode;
138  }
139 
141  float page_width;
142 
148  float page_height;
149 
152 
160 
166 
169 
172 
178 };
179 
180 #if (defined(_WIN32) || defined(_WIN64))
181 
183 class Word2PDFSettingData FS_FINAL : public Object{
184  public:
191  typedef enum _ConvertOptimizeOption {
193  e_ConvertOptimizeOptionForPrint = 0,
195  e_ConvertOptimizeOptionForOnScreen = 1
196  } ConvertOptimizeOption;
197 
204  typedef enum _ConvertContentOption {
206  e_ConvertContentOptionOnlyContent = 0,
208  e_ConvertContentOptionWithMarkup = 1
209  } ConvertContentOption;
210 
216  typedef enum _ConvertBookmarkOption {
218  e_ConvertBookmarkOptionNone = 0,
224  e_ConvertBookmarkOptionUseHeadings = 1,
229  e_ConvertBookmarkOptionUseWordBookmark = 2
230  } ConvertBookmarkOption;
231 
232 
234  Word2PDFSettingData()
235  : include_doc_props(false)
236  , convert_to_pdfa(false)
237  , optimize_option(Word2PDFSettingData::e_ConvertOptimizeOptionForPrint)
238  , content_option(Word2PDFSettingData::e_ConvertContentOptionOnlyContent)
239  , bookmark_option(Word2PDFSettingData::e_ConvertBookmarkOptionNone)
240  {}
241 
265  Word2PDFSettingData(bool include_doc_props, bool convert_to_pdfa, ConvertOptimizeOption optimize_option,
266  ConvertContentOption content_option, ConvertBookmarkOption bookmark_option) {
267  this->include_doc_props = include_doc_props;
268  this->convert_to_pdfa = convert_to_pdfa;
269  this->optimize_option = optimize_option;
270  this->content_option = content_option;
271  this->bookmark_option = bookmark_option;
272  }
273 
281  Word2PDFSettingData &operator = (const Word2PDFSettingData& data) {
282  include_doc_props = data.include_doc_props;
283  convert_to_pdfa = data.convert_to_pdfa;
284  optimize_option = data.optimize_option;
285  content_option = data.content_option;
286  bookmark_option = data.bookmark_option;
287  return (*this);
288  }
289 
315  void Set(bool include_doc_props, bool convert_to_pdfa, ConvertOptimizeOption optimize_option,
316  ConvertContentOption content_option, ConvertBookmarkOption bookmark_option) {
317  this->include_doc_props = include_doc_props;
318  this->convert_to_pdfa = convert_to_pdfa;
319  this->optimize_option = optimize_option;
320  this->content_option = content_option;
321  this->bookmark_option = bookmark_option;
322  }
323 
331  bool include_doc_props;
332 
340  bool convert_to_pdfa;
341 
348  ConvertOptimizeOption optimize_option;
349 
356  ConvertContentOption content_option;
357 
364  ConvertBookmarkOption bookmark_option;
365 };
366 
368 class Excel2PDFSettingData FS_FINAL : public Object{
369  public:
375  typedef enum _ConvertQuality {
377  e_ConvertQualityStandard = 0,
379  e_ConvertQualityMinimum = 1
380  } ConvertQuality;
381 
387  typedef enum _ScaleType {
389  e_ScaleTypeNone = 0,
391  e_ScaleTypeFitAllColumns = 1,
393  e_ScaleTypeFitAllRows = 2,
395  e_ScaleTypeFitSheet = 3
396  } ScaleType;
397 
398 
400  Excel2PDFSettingData()
401  : include_doc_props(false)
402  , convert_to_pdfa(false)
403  , quality(Excel2PDFSettingData::e_ConvertQualityStandard)
404  , ignore_print_area(true)
405  , scale_type(Excel2PDFSettingData::e_ScaleTypeNone)
406  {}
407 
425  Excel2PDFSettingData(bool include_doc_props, bool convert_to_pdfa, ConvertQuality quality,
426  bool ignore_print_area, ScaleType scale_type) {
427  this->include_doc_props = include_doc_props;
428  this->convert_to_pdfa = convert_to_pdfa;
429  this->quality = quality;
430  this->ignore_print_area = ignore_print_area;
431  this->scale_type = scale_type;
432  }
433 
441  Excel2PDFSettingData &operator = (const Excel2PDFSettingData& data) {
442  include_doc_props = data.include_doc_props;
443  convert_to_pdfa = data.convert_to_pdfa;
444  quality = data.quality;
445  ignore_print_area = data.ignore_print_area;
446  scale_type = data.scale_type;
447  return (*this);
448  }
449 
469  void Set(bool include_doc_props, bool convert_to_pdfa, ConvertQuality quality,
470  bool ignore_print_area, ScaleType scale_type) {
471  this->include_doc_props = include_doc_props;
472  this->convert_to_pdfa = convert_to_pdfa;
473  this->quality = quality;
474  this->ignore_print_area = ignore_print_area;
475  this->scale_type = scale_type;
476  }
477 
485  bool include_doc_props;
486 
494  bool convert_to_pdfa;
495 
501  ConvertQuality quality;
502 
510  bool ignore_print_area;
511 
517  ScaleType scale_type;
518 };
519 #endif // #if (defined(_WIN32) || defined(_WIN64))
520 
529 class Convert FS_FINAL : public Base {
530  public:
547  static void FromHTML(const wchar_t* src_html, const wchar_t* engine_path, const wchar_t* cookies_path, const HTML2PDFSettingData& setting_data, const wchar_t* saved_pdf_path, int32 timeout);
548 
549 #if (defined(_WIN32) || defined(_WIN64))
550 
563  static void FromWord(const wchar_t* src_word_file_path, const wchar_t* src_file_password, const wchar_t* saved_pdf_path, const Word2PDFSettingData& setting_data);
564 
578  static void FromExcel(const wchar_t* src_excel_file_path, const wchar_t* src_file_password, const wchar_t* saved_pdf_path, const Excel2PDFSettingData& setting_data);
579 #endif // #if (defined(_WIN32) || defined(_WIN64))
580 
581 };
582 }
583 }
584 }
585 #endif
CFX_Object Object
Object type.
Definition: fs_basictypes.h:219
No rotation.
Definition: fs_common.h:346
bool is_convert_link
Used to decide whether the web link should be coverted or not.
Definition: fs_convert.h:168
float page_width
The page width used for the coverted PDF document.
Definition: fs_convert.h:141
Header file for common definitions and classes.
bool is_to_page_scale
Used to decide whether to scale the coverted PDF page or not.
Definition: fs_convert.h:151
RectF page_margin
The page margin used for coverted PDF document.
Definition: fs_convert.h:159
common::Rotation rotate_degrees
The rotation degree used for the coverted PDF page.Please refer to values starting from common::e_Rot...
Definition: fs_convert.h:165
HTML2PDFSettingData(float page_width, float page_height, bool is_to_page_scale, RectF page_margin, bool is_convert_link, common::Rotation rotate_degrees, bool is_generate_tag, HTML2PDFPageMode page_mode)
Constructor, with parameters.
Definition: fs_convert.h:80
HTML2PDFPageMode
Enumeration for page mode used for converting HTML to PDF.
Definition: fs_convert.h:44
HTML2PDFSettingData()
Constructor.
Definition: fs_convert.h:52
static void FromHTML(const wchar_t *src_html, const wchar_t *engine_path, const wchar_t *cookies_path, const HTML2PDFSettingData &setting_data, const wchar_t *saved_pdf_path, int32 timeout)
Convert a HTML format file or a url of a Web page to a PDF file.
Rotation
Enumeration for rotation.
Definition: fs_common.h:344
Header file for PDF page related definitions and classes.
Foxit namespace.
Definition: fs_compare.h:27
Multiple page mode.
Definition: fs_convert.h:48
HTML2PDFPageMode page_mode
The page mode used for the converting. Please refer to values starting from HTML2PDFSettingData::e_Pa...
Definition: fs_convert.h:177
Header file for PDF document related definitions and classes.
Definition: fx_coordinates.h:771
HTML2PDFSettingData & operator=(const HTML2PDFSettingData &data)
Assign operator.
Definition: fs_convert.h:99
FX_INT32 int32
32-bit signed integer.
Definition: fs_basictypes.h:196
void Set(float page_width, float page_height, bool is_to_page_scale, RectF page_margin, bool is_convert_link, common::Rotation rotate_degrees, bool is_generate_tag, HTML2PDFPageMode page_mode)
Set value.
Definition: fs_convert.h:128
bool is_generate_tag
Used to decide whether the tag should be generated or not.
Definition: fs_convert.h:171
float page_height
The page height used for the coverted PDF document.
Definition: fs_convert.h:148
Definition: fs_basictypes.h:399
Definition: fs_convert.h:529