A while ago, I posted a script I was using for copying links to selected text in PDF files. This one here is an improved version that will encode empty spaces and everything else it needs to encode to create a valid link. It uses a tip offered by @BLUEFROG in this thread, and it circumvents a minor deficiency in it with regards to the linebreaks.
A couple of caveats:
- If I am not mistaken, links to selected text need to start at the word boundary. If you create a link and it does not work, double-check if the start of the selection coincides with the beginning of a word.
- If the selection spans across pages, the link won’t work.
So, to be clear, don’t select text on more than one PDF page, and always start the selection at the beginning of words.
Suggestions to improve upon it are more than welcome.
P.s.: @AW2307, perhaps this version could be useful to you.