Flatten PDF Forms Fields in React Native

PSPDFKit for React Native allows you to create a new document with flattened forms. In a document with flattened forms, the form fields and their contents are still visible, but they’re no longer editable.

The example below shows how to flatten forms using the PSPDFKit.processAnnotations(annotationChange, annotationType, sourceDocumentPath, processedDocumentPath) function:

const sourceDocumentPath = ...
const RNFS = require("react-native-fs");
const processedDocumentPath = RNFS.DocumentDirectoryPath + '/flattened.pdf';
PSPDFKit.processAnnotations('flatten', 'all', sourceDocumentPath, processedDocumentPath);

For more details about how to use the processAnnotations() function, please refer to our guide on how to process annotations.