Skip to content
ComPDF
Guides

编辑注释

您可以通过修改注释对象的属性来更新注释的外观和内容。以下示例展示了如何修改注释的颜色、透明度和内容:

dart
CPDFPage page = controller.document.pageAtIndex(pageIndex);
var annotations = await page.getAnnotations();
var annotation = annotations[0];
annotation.title = 'ComPDF-Note-A';
annotation.content = 'update note annotation content';
annotation.color = Colors.red;
annotation.alpha = 255;

await controller.document.updateAnnotation(annotation);

更多可修改的属性请参考各注释类的定义,例如 CPDFNoteAnnotationCPDFMarkupAnnotation 等。

此外,ComPDF Flutter SDK 还提供了修改注释属性的面板弹窗。您可以通过调用以下 API 显示注释属性编辑面板:

dart
await controller.showAnnotationPropertiesView(annotation);