PDF 生成模板编辑器
开源可视化 PDF 生成引擎,支持自定义模板,并提供面向开发者的 API,灵活构建文档生成流程。
ComPDF React Native SDK 提供了渲染注释外观的 API,无需显示 PDF 查看器即可生成注释的可视化效果。这对于需要单独处理注释图像的场景非常有用,例如将注释作为独立元素进行展示或保存。
以下示例展示了如何渲染注释外观:
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,
}
);
}