我对 PSPDFKit 有疑问。问题如下:
我有一系列注释。我需要将它们添加到 pdf 文档中。
PSPDFDocument *newDocument = [PSPDFDocument documentWithURL:someURL];
newDocument.delegate = self;
[newDocument addAnnotations:annotations];
[newDocument saveAnnotationsWithError:nil];
NSError *error;
if (![[PSPDFProcessor defaultProcessor] generatePDFFromDocument:newDocument
pageRanges:@[[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, newDocument.pageCount)]]
outputFileURL:someURL
options:nil
progressBlock:nil
error:&error])
{
NSLog(@"%@", error);
}
出于测试目的,我只在第一页添加注释。添加注释后,我可以编写
NSArray *array = [newDocument annotationsForPage:0 type:PSPDFAnnotationTypeAll];
我收到了与我添加的相同的注释。如果我在将文档保存到文件后尝试编写这行代码,我会收到空数组。同样在委托方法文档中:didSaveAnnotations:我收到了用于注释的空数组。我试图保存AnnotationsWithCompletionBlock:,但我也在那里得到空的注释数组。显然,屏幕上的文档也不包含任何注释。
请帮帮我。先感谢您。