Foxit PDF Conversion SDK
foxit::conversion::md2pdf::Md2PDFSettingData Class Reference

Inherits Object.

Public Member Functions

 Md2PDFSettingData ()
 Constructor.
 
 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)
 Constructor, with parameters. More...
 
Md2PDFSettingData & operator= (const Md2PDFSettingData &data)
 Assign operator. More...
 
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)
 Set value. More...
 

Public Attributes

float base_font_size
 Base font size in points for body text. Default value: 10. More...
 
WString custom_font_path
 Path to a TrueType font file for CJK or custom font support. More...
 
bool is_embed_font
 Whether to embed font data in the output PDF. Default value: false.
 
float margin_bottom
 Bottom margin in points. Default value: 72. The value must be greater than or equal to 0. The sum of top and bottom margins must be less than page height.
 
float margin_left
 Left margin in points. Default value: 72. The value must be greater than or equal to 0. The sum of left and right margins must be less than page width.
 
float margin_right
 Right margin in points. Default value: 72. The value must be greater than or equal to 0. The sum of left and right margins must be less than page width.
 
float margin_top
 Top margin in points. The value must be greater than or equal to 0. The sum of top and bottom margins must be less than page height.\ Default value: 72.
 
float page_height
 Page height in points. The value must be greater than 0. Default value: 792.
 
float page_width
 Page width in points. The value must be greater than 0. Default value: 612.
 
WString style_config_path
 Path to a JSON style configuration file. More...
 

Detailed Description

This class represents setting data used for converting Markdown format files to PDF format files.

Constructor & Destructor Documentation

◆ Md2PDFSettingData()

foxit::conversion::md2pdf::Md2PDFSettingData::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 
)
inline

Constructor, with parameters.

Parameters
[in]page_widthPage width in points. The value must be greater than 0. Default value: 612.
[in]page_heightPage height in points. The value must be greater than 0. Default value: 792.
[in]margin_topTop margin in points. The value must be greater than or equal to 0. The sum of top and bottom margins must be less than page height.\ Default value: 72.
[in]margin_bottomBottom margin in points. Default value: 72. The value must be greater than or equal to 0. The sum of top and bottom margins must be less than page height.
[in]margin_leftLeft margin in points. Default value: 72. The value must be greater than or equal to 0. The sum of left and right margins must be less than page width.
[in]margin_rightRight margin in points. Default value: 72. The value must be greater than or equal to 0. The sum of left and right margins must be less than page width.
[in]base_font_sizeBase font size in points for body text. Default value: 10.
[in]custom_font_pathPath to a TrueType font file for CJK or custom font support. Empty string means use standard PDF fonts.
[in]style_config_pathPath to a JSON style configuration file.
[in]is_embed_fontWhether to embed font data in the output PDF. Default value: false.

Member Function Documentation

◆ operator=()

Md2PDFSettingData& foxit::conversion::md2pdf::Md2PDFSettingData::operator= ( const Md2PDFSettingData &  data)
inline

Assign operator.

Parameters
[in]dataAnother Md2PDF setting data object, whose value would be assigned to current object.
Returns
Reference to current object itself.

◆ Set()

void foxit::conversion::md2pdf::Md2PDFSettingData::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 
)
inline

Set value.

Parameters
[in]page_widthPage width in points. The value must be greater than 0. Default value: 612.
[in]page_heightPage height in points. The value must be greater than 0. Default value: 792.
[in]margin_topTop margin in points. The value must be greater than or equal to 0. The sum of top and bottom margins must be less than page height.\ Default value: 72.
[in]margin_bottomBottom margin in points. Default value: 72. The value must be greater than or equal to 0. The sum of top and bottom margins must be less than page height.
[in]margin_leftLeft margin in points. Default value: 72. The value must be greater than or equal to 0. The sum of left and right margins must be less than page width.
[in]margin_rightRight margin in points. Default value: 72. The value must be greater than or equal to 0. The sum of left and right margins must be less than page width.
[in]base_font_sizeBase font size in points for body text.
[in]custom_font_pathPath to a TrueType font file for CJK or custom font support.
[in]style_config_pathPath to a JSON style configuration file.
[in]is_embed_fontWhether to embed font data in the output PDF.
Returns
None.

Member Data Documentation

◆ base_font_size

float foxit::conversion::md2pdf::Md2PDFSettingData::base_font_size

Base font size in points for body text. Default value: 10.

Heading sizes are calculated as multiples of this value.

◆ custom_font_path

WString foxit::conversion::md2pdf::Md2PDFSettingData::custom_font_path

Path to a TrueType font file for CJK or custom font support.

When not empty, the specified font will be used for text rendering. Default value: empty string.

◆ style_config_path

WString foxit::conversion::md2pdf::Md2PDFSettingData::style_config_path

Path to a JSON style configuration file.

When not empty, per-element font/size/color/bold/italic/line_spacing settings are loaded from the specified JSON file. Default value: empty string (built-in defaults apply).

Supported JSON keys per element object (h1-h6, paragraph, code_block, block_quote, list_item, table_cell):

  • "font_size" : float, point size (e.g. 14.0)
  • "bold" : bool
  • "italic" : bool
  • "color_r/g/b" : float 0.0-1.0, RGB components
  • "line_spacing" : float 0.5-5.0, line-height multiplier
  • "space_before" : float 0.0-10.0, spacing before the block as a multiple of font_size. Only effective for heading elements (h1-h6); ignored for other element types.
  • "space_after" : float 0.0-10.0, spacing after the block as a multiple of font_size.

Example JSON file content:

{
"h1": {
"font_size": 28.0, "bold": true,
"space_before": 2.0, "space_after": 0.8
},
"h2": {
"font_size": 22.0, "bold": true,
"space_before": 1.5, "space_after": 0.6
},
"h3": {
"font_size": 18.0,
"space_before": 1.2, "space_after": 0.5
},
"paragraph": {
"font_size": 11.0, "line_spacing": 1.5,
"space_after": 1.0
},
"code_block": {
"font_size": 10.0,
"color_r": 0.1, "color_g": 0.4, "color_b": 0.1,
"space_after": 1.2
}
}