PDF 生成模板编辑器
开源可视化 PDF 生成引擎,支持自定义模板,并提供面向开发者的 API,灵活构建文档生成流程。
ComPDF React Native SDK 提供 API,可修改注释属性以更新注释的外观和内容。以下示例展示了如何修改注释的颜色、透明度和内容:
const document = pdfReaderRef?.current?._pdfDocument;
const page = document.pageAtIndex(0);
const annotations = await page?.getAnnotations();
const annotation = annotations![0];
annotation.update({
title: `Updated ${annotation.type} Annotation`,
content: `This ${annotation.type} annotation has been updated.`,
color: "#FF33AA",
alpha: 180,
});
await document.updateAnnotation(annotation);更多可修改的属性请参考各注释类的定义,例如 CPDFNoteAnnotation、CPDFMarkupAnnotation 等。
此外,ComPDF SDK 还提供了修改注释属性的面板弹窗。可以通过调用以下 API 显示注释属性编辑面板:
await pdfReaderRef?.current?.showAnnotationPropertiesView(annotation);