Discussion:
using PDF ActualText in plain (pdf)tex
Jim Diamond
2017-03-22 02:01:20 UTC
Raw Message
Using plain TeX, I'd like to put some text in a PDF file which gives
different text when copied and pasted.

I see the accsupp package for LaTeX, and I played around with some
not-quite-equivalent pdfliterals, but to no real success. In other
words, I don't know what I am doing. (I can make some text have
replacement text, but the copied/pasted text bears no resemblance to
what I really want.)

Does anyone have
- plain TeX macros to do this which they would share,
- words of wisdom, or
- a pointer to some documents which will spell out what I need to do
in detail?

Thanks.

Jim
Scott Pakin
2017-03-24 20:48:00 UTC
Raw Message
Post by Jim Diamond
Using plain TeX, I'd like to put some text in a PDF file which gives
different text when copied and pasted.
I see the accsupp package for LaTeX, and I played around with some
not-quite-equivalent pdfliterals, but to no real success. In other
words, I don't know what I am doing. (I can make some text have
replacement text, but the copied/pasted text bears no resemblance to
what I really want.)
Does anyone have
- plain TeX macros to do this which they would share,
- words of wisdom, or
- a pointer to some documents which will spell out what I need to do
in detail?
Try:

Altering text is%
\pdfliteral{
/Span <<
/ActualText (easy)
BDC
}
hard%
\pdfliteral{EMC}.
\bye

-- Scott
Jim Diamond
2017-03-25 20:34:14 UTC
Raw Message
Post by Scott Pakin
Post by Jim Diamond
Using plain TeX, I'd like to put some text in a PDF file which gives
different text when copied and pasted.
I see the accsupp package for LaTeX, and I played around with some
not-quite-equivalent pdfliterals, but to no real success. In other
words, I don't know what I am doing. (I can make some text have
replacement text, but the copied/pasted text bears no resemblance to
what I really want.)
Does anyone have
- plain TeX macros to do this which they would share,
- words of wisdom, or
- a pointer to some documents which will spell out what I need to do
in detail?
Altering text is%
\pdfliteral{
/Span <<
/ActualText (easy)
BDC
}
hard%
\pdfliteral{EMC}.
\bye
Scott,

thanks very much. I see that although that works in acrobat reader,
evince, xpdf, nor the PDF reader in my firefox are not so
cooperative. No wonder I couldn't get it working when I tried
evince.

Cheers.
Jim