PDF 生成模板编辑器
开源可视化 PDF 生成引擎,支持自定义模板,并提供面向开发者的 API,灵活构建文档生成流程。
删除指定页面,以下是删除页面的步骤:
CPDFReaderWidget:CPDFReaderWidgetController? _controller;
// 初始化 CPDFReaderWidget,并在 onCreated 回调中获取 controller
CPDFReaderWidget(
document: documentPath,
configuration: CPDFConfiguration(),
onCreated: (controller) {
setState(() {
this._controller = controller;
});
},
);
List<int> pagesToRemove = [0, 1, 2];
bool result = await document.removePages(pagesToRemove);使用 CPDFDocument:
// 创建并打开文档
CPDFDocument document = await CPDFDocument.createInstance();
var error = await document.open(pdfFilePath);
if (error == CPDFDocumentError.success) {
List<int> pagesToRemove = [0, 1, 2];
bool result = await document.removePages(pagesToRemove);
}