PDFTron - React Native - Android
Hi, I am looking trying to save annotations to the document using react native.
I added a custom button to the viewer, and used the SaveDocument api to save the document which executes but it seems like the annotations are not saved when I reopen the document.
Here’s the code snippet
return (
<View style={{ flex: 1 }}>
<DocumentView
ref={(c) => this._viewer = c}
document={filepath}
showLeadingNavButton={false}
leadingNavButtonIcon={
Platform.OS === "ios" ? "ic_close_black_24px.png" : "ic_arrow_back_white_24dp"
}
onLeadingNavButtonPressed={this.onLeadingNavButtonPressed}
onDocumentLoaded={path => {
console.info("The document has finished loading:", path);
}}
fitMode={Config.FitMode.FitPage}
bottomToolbarEnabled={true}
annotationToolbars={[myToolbar]}
collabEnabled={true}
currentUser={this.props.currentUser ? this.props.currentUser.value : "Guest"}
currentUserName={this.props.currentUserName ? this.props.currentUserName.value : "Guest"}
annotationMenuItems={[
Config.AnnotationMenu.note,
Config.AnnotationMenu.style,
Config.AnnotationMenu.delete
]}
/>
<View style={styles.button}>
<Button
onPress={() => {
this._viewer.saveDocument().then((filepath) => {
console.info('saveDocument:', filepath);
});
}}
title="Save"
/>
</View>
</View>
);
Could you please share API to save annotations to the document?
Also, my use case is similar to Save Annotations in Mendix documentation that you have provided. I am looking for something similar in React Native. Kindly provide your inputs on this too.
Thanks