PDF 生成模板编辑器
开源可视化 PDF 生成引擎,支持自定义模板,并提供面向开发者的 API,灵活构建文档生成流程。
插入空白页面,或插入其他 PDF 页面到目标页面中。
以下是插入空白页面的示例代码:
// 插入到第一页之后。
const insertBeforeThisPage = 2;
const width = 612;
const height = 792;
await documentViewer.getDocument().insertBlankPages([insertBeforeThisPage], width, height);以下是插入其他 PDF 页面的示例代码:
const file = {...}; // File文件对象。
const insertBeforeThisPage = 2; // 插入到第一页之后。
const pagesToInsert = [1, '3-5']; // 插入PDF页面的范围。
const sourceDocument = await instance.Core.createDocument(file);
await documentViewer.getDocument().insertPages(sourceDocument, pagesToInsert, insertBeforeThisPage);