Foxit PDF SDK
fs_md2pdf.h
浏览该文件的文档.
1 
14 #ifndef FS_MD2PDF_H_
15 #define FS_MD2PDF_H_
16 #if defined(_WIN32) || defined(_WIN64) || (defined(__linux__) && !defined(__ANDROID__))
17 #include "common/fs_common.h"
18 
19 namespace foxit {
20 namespace addon {
21 namespace conversion {
22 namespace md2pdf {
24 class Md2PDFSettingData FS_FINAL : public Object {
25  public:
28  : page_width(612.0f)
29  , page_height(792.0f)
30  , margin_top(72.0f)
31  , margin_bottom(72.0f)
32  , margin_left(72.0f)
33  , margin_right(72.0f)
34  , base_font_size(10.0f)
35  , is_embed_font(false) {}
36 
54  float margin_top, float margin_bottom,
55  float margin_left, float margin_right,
56  float base_font_size,
57  const wchar_t* custom_font_path, const wchar_t* style_config_path,
58  bool is_embed_font) {
59  this->page_width = page_width;
60  this->page_height = page_height;
61  this->margin_top = margin_top;
62  this->margin_bottom = margin_bottom;
63  this->margin_left = margin_left;
64  this->margin_right = margin_right;
65  this->base_font_size = base_font_size;
66  this->custom_font_path = custom_font_path;
67  this->style_config_path = style_config_path;
68  this->is_embed_font = is_embed_font;
69  }
70 
79  page_width = data.page_width;
80  page_height = data.page_height;
81  margin_top = data.margin_top;
83  margin_left = data.margin_left;
89  return *this;
90  }
91 
108  void Set(float page_width, float page_height,
109  float margin_top, float margin_bottom,
110  float margin_left, float margin_right,
111  float base_font_size,
112  const wchar_t* custom_font_path,
113  const wchar_t* style_config_path,
114  bool is_embed_font) {
115  this->page_width = page_width;
116  this->page_height = page_height;
117  this->margin_top = margin_top;
118  this->margin_bottom = margin_bottom;
119  this->margin_left = margin_left;
120  this->margin_right = margin_right;
121  this->base_font_size = base_font_size;
122  this->custom_font_path = custom_font_path;
123  this->style_config_path = style_config_path;
124  this->is_embed_font = is_embed_font;
125  }
126 
128  float page_width;
129 
131  float page_height;
132 
134  float margin_top;
135 
138 
140  float margin_left;
141 
144 
166 };
167 
174 class Md2PDF FS_FINAL : public Object {
175  public:
190  static void Initialize(const wchar_t* library_path);
191 
200  static void Release();
201 
209  static String GetVersion();
210 
224  static bool ConvertFromMarkdown(const wchar_t* src_markdown_file_path, const wchar_t* src_file_password,
225  const wchar_t* saved_pdf_path,
226  const Md2PDFSettingData& setting_data = Md2PDFSettingData());
227 };
228 
229 } // namespace md2pdf
230 } // namespace conversion
231 } // namespace addon
232 } // namespace foxit
233 
234 #endif // #if defined(_WIN32) || defined(_WIN64) || (defined(__linux__) && !defined(__ANDROID__))
235 #endif // FS_MD2PDF_H_
float base_font_size
正文基础字体大小(点数)。默认值:10。
Definition: fs_md2pdf.h:150
static String GetVersion()
获取Foxit PDF Conversion SDK的版本号。
CFX_Object Object
对象类型。
Definition: fs_basictypes.h:220
float margin_left
左边距,单位:点。默认值:72。必须大于或等于 0,且左、右边距之和必须小于页面宽度。
Definition: fs_md2pdf.h:140
WString custom_font_path
用于CJK或自定义字体支持的TrueType字体文件路径。
Definition: fs_md2pdf.h:156
WString style_config_path
JSON样式配置文件路径。
Definition: fs_md2pdf.h:163
float margin_top
上边距,单位:点。默认值:72。必须大于或等于 0,且上、下边距之和必须小于页面高度。
Definition: fs_md2pdf.h:134
宽字符串类
Definition: fx_string.h:1457
static void Initialize(const wchar_t *library_path)
通过加载Foxit PDF Conversion SDK库来初始化Md2PDF模块。
Md2PDFSettingData()
构造函数。
Definition: fs_md2pdf.h:27
float margin_bottom
下边距,单位:点。默认值:72。必须大于或等于 0,且上、下边距之和必须小于页面高度。
Definition: fs_md2pdf.h:137
float page_height
页面高度,单位:点。默认值:792。必须大于 0。
Definition: fs_md2pdf.h:131
Md2PDFSettingData(float page_width, float page_height, float margin_top, float margin_bottom, float margin_left, float margin_right, float base_font_size, const wchar_t *custom_font_path, const wchar_t *style_config_path, bool is_embed_font)
带参数的构造函数。
Definition: fs_md2pdf.h:53
static void Release()
释放Md2PDF模块并卸载Foxit PDF Conversion SDK库。
void Set(float page_width, float page_height, float margin_top, float margin_bottom, float margin_left, float margin_right, float base_font_size, const wchar_t *custom_font_path, const wchar_t *style_config_path, bool is_embed_font)
设置值。
Definition: fs_md2pdf.h:108
float page_width
页面宽度,单位:点。默认值:612。必须大于 0。
Definition: fs_md2pdf.h:128
static bool ConvertFromMarkdown(const wchar_t *src_markdown_file_path, const wchar_t *src_file_password, const wchar_t *saved_pdf_path, const Md2PDFSettingData &setting_data=Md2PDFSettingData())
将Markdown格式文件转换为PDF文件。
Md2PDFSettingData & operator=(const Md2PDFSettingData &data)
赋值操作符。
Definition: fs_md2pdf.h:78
bool is_embed_font
是否在输出PDF中嵌入字体数据。默认值:false。
Definition: fs_md2pdf.h:165
通用定义和类的头文件。
float margin_right
右边距,单位:点。默认值:72。必须大于或等于 0,且左、右边距之和必须小于页面宽度。
Definition: fs_md2pdf.h:143
Definition: fs_md2pdf.h:174
Foxit 命名空间。
Definition: fs_accessibility.h:28
字节字符串类
Definition: fx_string.h:317