Skip to content
DemoAPI 参考文档FAQ
全新发布

PDF SDK 与 AI 文档处理

在 GitHub 获取完整的私有化部署SDK 包及 AI 智能文档处理能力,一键部署,快速构建您的文档处理工作流。

Guides

渲染注释外观

ComPDF React Native SDK 提供了渲染注释外观的 API,无需显示 PDF 查看器即可生成注释的可视化效果。这对于需要单独处理注释图像的场景非常有用,例如将注释作为独立元素进行展示或保存。

以下示例展示了如何渲染注释外观:

tsx
const page = pdfReaderRef.current?._pdfDocument.pageAtIndex(0);
const annotations = await page?.getAnnotations();
const annotation = annotations?.[0];

if (annotation) {
  const base64 = await pdfReaderRef.current?._pdfDocument.renderAnnotationAppearance(
    annotation,
    {
      scale: 4,
      compression: CPDFPageCompression.PNG,
    }
  );
}