我已经为iOS构建了Podofo 0.9.3以及所有其他必要的库来支持amrv7、arm64和模拟器。我的项目运行良好,但我的问题是第二次加载文档。Podofo总是会出现“未找到目录对象”的错误。如果我在Mac上使用预览应用程序打开文档并保存它,Podofo就可以再次打开该文档。
这是我用来打开文档并保存的代码:
self.doc = new PoDoFo::PdfMemDocument([path UTF8String]);
NSString *tmpPath = [self createCopyForFile:self.pdfPath];
self.doc->Write([tmpPath UTF8String]);
NSData *myFile = [NSData dataWithContentsOfFile:tmpPath];
[myFile writeToFile:tmpPath atomically:YES];
NSFileManager *fileManager = [NSFileManager defaultManager];
NSError *error;
if ([fileManager fileExistsAtPath:self.pdfPath] == YES) {
[fileManager removeItemAtPath:self.pdfPath error:&error];
}
[fileManager copyItemAtPath:tmpPath toPath:self.pdfPath error:&error];
错误出现在这里:
void PdfMemDocument::InitFromParser( PdfParser* pParser )
{
...
PdfObject* pCatalog = pTrailer->GetIndirectKey( "Root" );
if( !pCatalog )
{
PODOFO_RAISE_ERROR_INFO( ePdfError_NoObject, "Catalog object not found!" );
...
}
你们最近是否为iOS构建了Podofo? 任何想法这是为什么发生的?