1

Hi I'm looking to use the PSPDFKit framework and its full text search features to find documents. I am doing this in a Cordova/Phonegap application so i want to return the search results data back to my Javascript application.

I am running into an issue with return the document name / path and not the document UID. Is it possible to cast the documentUID to a PSPDFDocument

[library documentUIDsMatchingString:searchString options:nil completionHandler:
 ^(NSString* searchString, NSDictionary<NSString *,NSIndexSet *> * resultSet) {
              for (NSString *UID in resultSet) {
                  NSIndexSet *indexSet = resultSet[UID];
                  NSLog(@"Found the following matches in document %@: %@", UID, indexSet);
              }
 }

The above UID would look something like this:

samplepdf_ffa29462f17ca27908ab82bdd3d575a7

Which doesn't mean very much, theres a method called -metadataForUID but that always returns null when called with the above string.

Leon Ho
  • 101
  • 1
  • 8

1 Answers1

1

I checked out PSPDFKit documentation and when you look at PSPDFDocument (https://pspdfkit.com/guides/ios/current/getting-started/using-pspdfdocument/), they mention to build your own way of storing documentUIDs and the PSPDFDocument.

During indexing process you will have the path of the document and the documentUID. So I am creating my own data structure (i.e. NSDictionary ) and store it in the NSCache, like recommended in the doc.

It works very good in my case. The indexing process is performed every time, when the app is started or a new document is added. The good thing is, that PSPDFKit does not index the documents twice, so I have no performance issues.

I tested with PSPDFKit 6.3

i89
  • 1,092
  • 8
  • 11