I found the vfr framework by exploring some of the best alternatives for displaying pdf in an application. In my context, I need to download pdf; It is no longer included in the application package. It was easy to use the vfr framework with built-in pdf, but I was still at a dead end, forcing it to work with the downloaded data that I write to a file, and then initialize the ReaderDocument using this path. I can upload the same file to UIWebView without problems, so I do not believe this data. Here is the code:
NSString *fullPathToPDF = [[[self appDelegate] urlForFileUnderRecursiveDocWithName:self.pdfName andOptionallyStartingAtDirectory:[[self appDelegate] pathURLForImagesDirectory]] path]; ReaderDocument *pdfDoc = [ReaderDocument withDocumentFilePath:fullPathToPDF password:nil];
The result of pdfDoc will either be zero, or, passing it the full path, as indicated above, will fail with the statement from line 229 of the ReaderDocument
NSAssert(NO, @"CGPDFDocumentRef == NULL");
because (I make a reasonable assumption) this line (217, same class):
CGPDFDocumentRef thePDFDocRef = CGPDFDocumentCreateX(docURLRef, _password);
Unable to create CGPDFDocumentRef. Earlier, I mentioned the difference between passing it the full path and just passing it the file name, but because, looking at the code, the ReaderDocument class seems to make some assumptions about where it expects to find the files. I was unable to get it to work no matter where I save the file, or what I pass to it ... with the DocumentFilePath method.
I repeat, I can use the same file and open it in UIWebView without any problems.
So, anyone who has this same problem, or can do what I'm trying to succeed? Thank you