pspdfkit自定义保存iOS

时间:2013-07-11 03:47:45

标签: ios pdf annotations pspdfkit

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

1 个答案:

答案 0 :(得分:2)

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

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