Text Copy Workaround

One of the long standing PDF.js issues is 6657 about missing spaces when text is copied from PDF. It doesn't happen with all documents but appears to be a pretty common issue.

PDF viewer that comes with PDF Highlighter v4.2 has a workaround for the text copy issue – it can get correctly formatted text of the selected area directly from the Highlighter server, and update clipboard. This process is very fast and not noticeable to user.

With the workaround enabled, text that previously was copied as:

Theywereindeedaqueer-lookingpartythatassembledonthebank—thebirdswithdraggledfeathers,theanimalswiththeirfurclingingclosetothem,andalldrippingwet,cross,anduncomfortable.

is now copied with formatting it had in the document:

They were indeed a queer-looking party that assembled on the
bank—the birds with draggled feathers, the animals with their
fur clinging close to them, and all dripping wet, cross, and
uncomfortable.

Activating the text copy workaround

Highlighter automatically enables the copy workaround script when hlCopy option is enabled (default).

If you want to customize behavior of the workaround script, add the following line to your application.conf :

highlighter.viewer.hlCopy = 0
highlighter.viewer.script = "../examples/viewer-copy-fix.js"

This tells Highlighter server to disable the default workaround script and include a sample script when opening the viewer. You can find script viewer-copy-fix.js among installed Highlighter files.

We recommend making a copy of the script and using your version as the original file may be overwritten on Highlighter update. If you're using the viewer from a non-default location, you will need to copy and adjust the script option.


comments powered by Disqus