我现在使用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];

最佳答案

要禁用自动保存功能,请在PSPDFDocument上调用document.annotationSaveMode = PSPDFAnnotationSaveModeDisabled

要通过单击特定按钮保存注释,可以在PSPDFAnnotationParser中调用saveAnnotationsWithError

关于ios - pspdfkit自定义保存iOS,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/17584720/

10-11 00:32