We can get the selected text from the web view using
- (NSString *)selectedText {
return [self stringByEvaluatingJavaScriptFromString:@"window.getSelection().toString()"];
}
But this will not work if I upload a PDF file. So I thought that to copy the selected text and then paste it from UIPasteboardprogrammatically. It works great when I press the copy button manually, but I do not want this to be the case. I want a copy of cade to be executed programmatically. How do i call? Or simply, How can I get a link to selected text from a PDF file loaded in a web view.
source
share