我现在正在使用pspdfkit for ios,我现在可以从本地目录中注释pdf。问题是注释会自动保存。我已经打开了这样的pdf。只有在按下保存按钮时才能保存pdf?我可以像下面的代码那样做自定义保存按钮。
PSPDFDocument *document = [PSPDFDocument documentWithURL:documentURL];
PSPDFViewController *pdfController = [[PSPDFViewController alloc] initWithDocument:document];
pdfController.openInButtonItem.openOptions = PSPDFOpenInOptionsOriginal;
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStyleBordered target:self action:@selector(backFromDocument)] ;
pdfController.leftBarButtonItems = @[backButton];
pdfController.rightBarButtonItems = @[pdfController.annotationButtonItem, pdfController.searchButtonItem, pdfController.outlineButtonItem, pdfController.viewModeButtonItem];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:pdfController];
[self presentViewController:navController animated:YES completion:NULL];
答案 0 :(得分:2)
要在PSPDFDocument上禁用自动保存功能调用document.annotationSaveMode = PSPDFAnnotationSaveModeDisabled
。
要通过单击特定按钮保存注释,可以在PSPDFAnnotationParser中调用saveAnnotationsWithError
。