We can get selected text from a web view by using
- (NSString *)selectedText {
return [self stringByEvaluatingJavaScriptFromString:@"window.getSelection().toString()"];
}
But this won't work if I'm loading a PDF file. So what I thought is that to copy the selected text and then pasting it from the UIPasteboard
programmatically. It works fine when I click the copy button manually, but I don't want it to be like that. I want the copy cade to execute programatically. How can I make a call to it? Or simply, How can I get the reference of the selected text from a PDF file loaded in a web view.