I'm trying to access the strings in a PDF loaded remotely in a UIWebView
. Since Apple has the copy/define options listed for the UIMenuController
items, i thought it would be just as easy as implementing the stringByEvaluatingJavaScriptFromString
declaration to utilize with my custom shareMenuController item. However, this works universally across most web pages and text ranges, with the exception of remote PDFs. How does Apple access these strings to copy the selected ranges to the clipboard or define?
Correction:
I just tested the 'define' sharedMenuController
item populated by Apple when text is selected in a UIWebView
pdf document format and an error occurs:
+[_UIDictionaryManager _availableDefinitionDictionaries] returned nil. Error: Error Domain=ASError Code=21 "The operation couldn’t be completed. (ASError error 21 - Unable to copy asset information)"
I've also noticed you can't search PDF text from a user search term when in Safari. So I suppose they have trouble extracting it themselves. Could be memory issues, i'm not sure, but they still are able to copy the selected text to the clipboard. How would we emulate that and handle the copied text ourselves?