@@ -21,6 +21,7 @@ @interface PSPDFKitPlugin () <PSPDFViewControllerDelegate, PSPDFFlexibleToolbarC
2121@property (nonatomic , strong ) PSPDFViewController *pdfController;
2222@property (nonatomic , strong ) PSPDFDocument *pdfDocument;
2323@property (nonatomic , strong ) NSDictionary *defaultOptions;
24+ @property (nonatomic ) BOOL disableAutomaticSaving;
2425
2526@end
2627
@@ -713,6 +714,16 @@ - (void)setEditableAnnotationTypesForPSPDFViewControllerWithJSON:(NSArray *)type
713714 }];
714715}
715716
717+ - (void )setDisableAutomaticSavingForPSPDFViewControllerWithJSON : (NSNumber *)shouldDisable
718+ {
719+ self.disableAutomaticSaving = shouldDisable.boolValue ;
720+ }
721+
722+ - (NSNumber *)disableAutomaticSavingAsJSON
723+ {
724+ return @(self.disableAutomaticSaving );
725+ }
726+
716727- (NSArray *)editableAnnotationTypesAsJSON
717728{
718729 return _pdfController.configuration .editableAnnotationTypes .allObjects ;
@@ -1318,6 +1329,11 @@ - (void)toggleAnnotationToolbar:(CDVInvokedUrlCommand *)command
13181329
13191330#pragma mark Delegate methods
13201331
1332+ - (BOOL )pdfViewController : (PSPDFViewController *)pdfController shouldSaveDocument : (nonnull PSPDFDocument *)document withOptions : (NSDictionary <PSPDFDocumentSaveOption,id> *__autoreleasing _Nonnull * _Nonnull)options
1333+ {
1334+ return !self.disableAutomaticSaving ;
1335+ }
1336+
13211337- (void )pdfViewController : (PSPDFViewController *)pdfController willBeginDisplayingPageView : (PSPDFPageView *)pageView forPageAtIndex : (NSInteger )pageIndex
13221338{
13231339 [self sendEventWithJSON: [NSString stringWithFormat: @" {type:'willBeginDisplayingPageView',page:%ld }" , (long ) pageIndex]];
0 commit comments