Guides
Render Annotation Appearance
ComPDF React Native SDK provides an API for rendering annotation appearances, allowing you to generate the visual representation of annotations without displaying the PDF viewer. This is useful when you need to process annotation images separately, such as displaying or saving annotations as standalone elements.
The following example shows how to render an annotation appearance:
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,
}
);
}