Foxit PDF SDK
foxit::addon::vectorgraphics::VectorGraphics类 参考

用于将矢量图形(SVG、WMF/EMF)插入 PDF 文件的类。 更多...

类 foxit::addon::vectorgraphics::VectorGraphics 继承关系图:
foxit::Base

静态 Public 成员函数

static void Initialize (const wchar_t *library_path)
 通过加载 fxvectorgraphics 共享库来初始化矢量图形模块。 更多...
 
static void InsertSVGToPage (const wchar_t *pdf_path, const wchar_t *svg_path, const wchar_t *out_pdf_path, int page_index, float x, float y, float width, float height, int dpi)
 将 SVG 文件插入已有 PDF 页面的指定矩形区域。 更多...
 
static void InsertSVGToPage (const char *pdf_path, const char *svg_path, const char *out_pdf_path, int page_index, float x, float y, float width, float height, int dpi)
 将 SVG 文件插入已有 PDF 页面的指定矩形区域。 更多...
 
static void InsertSVGToPDF (const wchar_t *pdf_path, const wchar_t *svg_path, const wchar_t *out_pdf_path, int page_index, float page_width_pt, float page_height_pt, int dpi)
 将 SVG 文件作为新页面插入 PDF 文档。 更多...
 
static void InsertSVGToPDF (const char *pdf_path, const char *svg_path, const char *out_pdf_path, int page_index, float page_width_pt, float page_height_pt, int dpi)
 将 SVG 文件作为新页面插入 PDF 文档。 更多...
 
static void InsertWMFToPage (const wchar_t *pdf_path, const wchar_t *wmf_path, const wchar_t *out_pdf_path, int page_index, float x, float y, float width, float height, int dpi)
 将 WMF/EMF 文件插入已有 PDF 页面的指定矩形区域。 更多...
 
static void InsertWMFToPage (const char *pdf_path, const char *wmf_path, const char *out_pdf_path, int page_index, float x, float y, float width, float height, int dpi)
 将 WMF/EMF 文件插入已有 PDF 页面的指定矩形区域。 更多...
 
static void InsertWMFToPDF (const wchar_t *pdf_path, const wchar_t *wmf_path, const wchar_t *out_pdf_path, int page_index, float page_width_pt, float page_height_pt, int dpi)
 将 WMF/EMF 文件作为新页面插入 PDF 文档。 更多...
 
static void InsertWMFToPDF (const char *pdf_path, const char *wmf_path, const char *out_pdf_path, int page_index, float page_width_pt, float page_height_pt, int dpi)
 将 WMF/EMF 文件作为新页面插入 PDF 文档。 更多...
 
static void Release ()
 释放矢量图形模块分配的所有资源。 更多...
 

额外继承的成员函数

- Public 成员函数 继承自 foxit::Base
FS_HANDLE Handle () const
 获取当前对象的句柄。 更多...
 

详细描述

用于将矢量图形(SVG、WMF/EMF)插入 PDF 文件的类。

该类提供将 SVG 矢量图形和 WMF/EMF 图元文件插入 PDF 文档的方法。 目标 PDF 的打开、修改和保存均在 fxvectorgraphics 共享库内部完成, 调用方无需通过 Foxit PDF SDK 自行打开文档。 输出文件会自动保留输入 PDF 的结构特性(线性化、交叉引用流等)。

在调用该类的任何其他方法之前,请先调用 VectorGraphics::Initialize 以加载 fxvectorgraphics 共享库。 当不再需要该模块时,调用 VectorGraphics::Release 。

当前,这个功能不在Linux x86/ARM 和 MAC ARM上支持。

成员函数说明

◆ Initialize()

static void foxit::addon::vectorgraphics::VectorGraphics::Initialize ( const wchar_t *  library_path)
static

通过加载 fxvectorgraphics 共享库来初始化矢量图形模块。

在"矢量图形"模块的生命周期中,此函数应在其他任何函数之前调用一次。 库将保持加载状态,直到调用 VectorGraphics::Release 。

参数
[in]library_pathfxvectorgraphics 共享库文件的完整路径,不能为空字符串。
返回
无。
注解
若 common::Library::Initialize 中使用的许可证信息未包含"Conversion"模块, 则用户无权使用矢量图形相关功能,此函数将抛出异常 foxit::e_ErrNoConversionModuleRight 。

◆ InsertSVGToPage() [1/2]

static void foxit::addon::vectorgraphics::VectorGraphics::InsertSVGToPage ( const wchar_t *  pdf_path,
const wchar_t *  svg_path,
const wchar_t *  out_pdf_path,
int  page_index,
float  x,
float  y,
float  width,
float  height,
int  dpi 
)
static

将 SVG 文件插入已有 PDF 页面的指定矩形区域。

SVG 图形将渲染到源 PDF 指定页面的指定矩形内,结果写入 out_pdf_path。 源 PDF 的结构特性(线性化、XRef 流等)将自动保留。

参数
[in]pdf_path源 PDF 文件路径,不能为空字符串。
[in]svg_pathSVG 文件路径,不能为空字符串。
[in]out_pdf_path输出 PDF 文件路径,不能为空字符串。
[in]page_index要插入 SVG 的页面的从零开始的索引。 有效范围:0 到(page_count-1)。 page_count 由函数 pdf::PDFDoc::GetPageCount 返回。
[in]x目标矩形左边缘的 X 坐标(单位:点)。
[in]y目标矩形下边缘的 Y 坐标(单位:点)。
[in]width目标矩形的宽度(单位:点),必须大于 0。
[in]height目标矩形的高度(单位:点),必须大于 0。
[in]dpi渲染分辨率(每英寸点数),必须大于 0。
返回
无。

◆ InsertSVGToPage() [2/2]

static void foxit::addon::vectorgraphics::VectorGraphics::InsertSVGToPage ( const char *  pdf_path,
const char *  svg_path,
const char *  out_pdf_path,
int  page_index,
float  x,
float  y,
float  width,
float  height,
int  dpi 
)
static

将 SVG 文件插入已有 PDF 页面的指定矩形区域。

SVG 图形将渲染到源 PDF 指定页面的指定矩形内,结果写入 out_pdf_path。 源 PDF 的结构特性(线性化、XRef 流等)将自动保留。

参数
[in]pdf_path源 PDF 文件路径,不能为空字符串。
[in]svg_pathSVG 文件路径,不能为空字符串。
[in]out_pdf_path输出 PDF 文件路径,不能为空字符串。
[in]page_index要插入 SVG 的页面的从零开始的索引。 有效范围:0 到(page_count-1)。 page_count 由函数 pdf::PDFDoc::GetPageCount 返回。
[in]x目标矩形左边缘的 X 坐标(单位:点)。
[in]y目标矩形下边缘的 Y 坐标(单位:点)。
[in]width目标矩形的宽度(单位:点),必须大于 0。
[in]height目标矩形的高度(单位:点),必须大于 0。
[in]dpi渲染分辨率(每英寸点数),必须大于 0。
返回
无。

◆ InsertSVGToPDF() [1/2]

static void foxit::addon::vectorgraphics::VectorGraphics::InsertSVGToPDF ( const wchar_t *  pdf_path,
const wchar_t *  svg_path,
const wchar_t *  out_pdf_path,
int  page_index,
float  page_width_pt,
float  page_height_pt,
int  dpi 
)
static

将 SVG 文件作为新页面插入 PDF 文档。

在 page_index 处插入指定大小的新页面,并将 SVG 图形渲染到该页面上, 结果写入 out_pdf_path。

参数
[in]pdf_path源 PDF 文件路径。 若为空字符串或指定文件不存在,将使用 out_pdf_path 新建 PDF 文档。
[in]svg_pathSVG 文件路径,不能为空字符串。
[in]out_pdf_path输出 PDF 文件路径,不能为空字符串。
[in]page_index要插入 SVG 的页面的从零开始的索引。 若该值小于 0,则页面插入到文档开头; 若大于等于 page_count,则追加到文档末尾。 page_count 由函数 pdf::PDFDoc::GetPageCount 返回。
[in]page_width_pt新页面的宽度(单位:点),必须大于 0。
[in]page_height_pt新页面的高度(单位:点),必须大于 0。
[in]dpi渲染分辨率(每英寸点数),必须大于 0。
返回
无。

◆ InsertSVGToPDF() [2/2]

static void foxit::addon::vectorgraphics::VectorGraphics::InsertSVGToPDF ( const char *  pdf_path,
const char *  svg_path,
const char *  out_pdf_path,
int  page_index,
float  page_width_pt,
float  page_height_pt,
int  dpi 
)
static

将 SVG 文件作为新页面插入 PDF 文档。

在 page_index 处插入指定大小的新页面,并将 SVG 图形渲染到该页面上, 结果写入 out_pdf_path。

参数
[in]pdf_path源 PDF 文件路径。 若为空字符串或指定文件不存在,将使用 out_pdf_path 新建 PDF 文档。
[in]svg_pathSVG 文件路径,不能为空字符串。
[in]out_pdf_path输出 PDF 文件路径,不能为空字符串。
[in]page_index要插入 SVG 的页面的从零开始的索引。 若该值小于 0,则页面插入到文档开头; 若大于等于 page_count,则追加到文档末尾。 page_count 由函数 pdf::PDFDoc::GetPageCount 返回。
[in]page_width_pt新页面的宽度(单位:点),必须大于 0。
[in]page_height_pt新页面的高度(单位:点),必须大于 0。
[in]dpi渲染分辨率(每英寸点数),必须大于 0。
返回
无。

◆ InsertWMFToPage() [1/2]

static void foxit::addon::vectorgraphics::VectorGraphics::InsertWMFToPage ( const wchar_t *  pdf_path,
const wchar_t *  wmf_path,
const wchar_t *  out_pdf_path,
int  page_index,
float  x,
float  y,
float  width,
float  height,
int  dpi 
)
static

将 WMF/EMF 文件插入已有 PDF 页面的指定矩形区域。

WMF/EMF 图形将渲染到源 PDF 指定页面的指定矩形内,结果写入 out_pdf_path。 源 PDF 的结构特性将自动保留。

参数
[in]pdf_path源 PDF 文件路径,不能为空字符串。
[in]wmf_pathWMF/EMF 文件路径,不能为空字符串。
[in]out_pdf_path输出 PDF 文件路径,不能为空字符串。
[in]page_index要插入 WMF/EMF 的页面的从零开始的索引。 有效范围:0 到(page_count-1)。 page_count 由函数 pdf::PDFDoc::GetPageCount 返回。
[in]x目标矩形左边缘的 X 坐标(单位:点)。
[in]y目标矩形下边缘的 Y 坐标(单位:点)。
[in]width目标矩形的宽度(单位:点),必须大于 0。
[in]height目标矩形的高度(单位:点),必须大于 0。
[in]dpi渲染分辨率(每英寸点数),必须大于 0。
返回
无。

◆ InsertWMFToPage() [2/2]

static void foxit::addon::vectorgraphics::VectorGraphics::InsertWMFToPage ( const char *  pdf_path,
const char *  wmf_path,
const char *  out_pdf_path,
int  page_index,
float  x,
float  y,
float  width,
float  height,
int  dpi 
)
static

将 WMF/EMF 文件插入已有 PDF 页面的指定矩形区域。

此重载版本接受 UTF-8 编码的窄字符路径。

参数
[in]pdf_path源 PDF 文件路径,不能为空字符串。
[in]wmf_pathWMF/EMF 文件路径,不能为空字符串。
[in]out_pdf_path输出 PDF 文件路径,不能为空字符串。
[in]page_index要插入 WMF/EMF 的页面的从零开始的索引。 有效范围:0 到(page_count-1)。 page_count 由函数 pdf::PDFDoc::GetPageCount 返回。
[in]x目标矩形左边缘的 X 坐标(单位:点)。
[in]y目标矩形下边缘的 Y 坐标(单位:点)。
[in]width目标矩形的宽度(单位:点),必须大于 0。
[in]height目标矩形的高度(单位:点),必须大于 0。
[in]dpi渲染分辨率(每英寸点数),必须大于 0。
返回
无。

◆ InsertWMFToPDF() [1/2]

static void foxit::addon::vectorgraphics::VectorGraphics::InsertWMFToPDF ( const wchar_t *  pdf_path,
const wchar_t *  wmf_path,
const wchar_t *  out_pdf_path,
int  page_index,
float  page_width_pt,
float  page_height_pt,
int  dpi 
)
static

将 WMF/EMF 文件作为新页面插入 PDF 文档。

在 page_index 处插入指定大小的新页面,并将 WMF/EMF 图形渲染到该页面上, 结果写入 out_pdf_path。

参数
[in]pdf_path源 PDF 文件路径。 若为空字符串或指定文件不存在,将使用 out_pdf_path 新建 PDF 文档。
[in]wmf_pathWMF/EMF 文件路径,不能为空字符串。
[in]out_pdf_path输出 PDF 文件路径,不能为空字符串。
[in]page_index要插入 WMF/EMF 的页面的从零开始的索引。 若该值小于 0,则页面插入到文档开头; 若大于等于 page_count,则追加到文档末尾。 page_count 由函数 pdf::PDFDoc::GetPageCount 返回。
[in]page_width_pt新页面的宽度(单位:点),必须大于 0。
[in]page_height_pt新页面的高度(单位:点),必须大于 0。
[in]dpi渲染分辨率(每英寸点数),必须大于 0。
返回
无。

◆ InsertWMFToPDF() [2/2]

static void foxit::addon::vectorgraphics::VectorGraphics::InsertWMFToPDF ( const char *  pdf_path,
const char *  wmf_path,
const char *  out_pdf_path,
int  page_index,
float  page_width_pt,
float  page_height_pt,
int  dpi 
)
static

将 WMF/EMF 文件作为新页面插入 PDF 文档。

在 page_index 处插入指定大小的新页面,并将 WMF/EMF 图形渲染到该页面上, 结果写入 out_pdf_path。

参数
[in]pdf_path源 PDF 文件路径。 若为空字符串或指定文件不存在,将使用 out_pdf_path 新建 PDF 文档。
[in]wmf_pathWMF/EMF 文件路径,不能为空字符串。
[in]out_pdf_path输出 PDF 文件路径,不能为空字符串。
[in]page_index要插入 WMF/EMF 的页面的从零开始的索引。 若该值小于 0,则页面插入到文档开头; 若大于等于 page_count,则追加到文档末尾。 page_count 由函数 pdf::PDFDoc::GetPageCount 返回。
[in]page_width_pt新页面的宽度(单位:点),必须大于 0。
[in]page_height_pt新页面的高度(单位:点),必须大于 0。
[in]dpi渲染分辨率(每英寸点数),必须大于 0。
返回
无。

◆ Release()

static void foxit::addon::vectorgraphics::VectorGraphics::Release ( )
static

释放矢量图形模块分配的所有资源。

当用户不再需要"矢量图形"模块时,应调用此函数以卸载共享库并释放所有相关资源。

返回
无。