Skip to content

Save Document

When using the CPDFReaderView component, the document is automatically saved during operations such as sharing, flattening, or adding watermarks. Additionally, you can manually save the document at any time. For example:

tsx
const saveResult = await pdfReaderRef.current.save();

When creating CPDFReaderView, you can set a save listener to handle save events. For example:

tsx
const pdfReaderRef = useRef<CPDFReaderView>(null);

const saveDocument = () => {
    console.log('ComPDFKitRN saveDocument');
}

<CPDFReaderView
    ref={pdfReaderRef}
    document={samplePDF}
    saveDocument={saveDocument}
    configuration={ComPDFKit.getDefaultConfig({
    })}/>