[pdftex] Links & \pdfannot problems (newlines & width)

Heiko Oberdiek oberdiek at uni-freiburg.de
Sat Sep 27 07:39:36 CEST 2008

On Sat, Sep 27, 2008 at 02:32:09AM +0200, Jörg Ebeling wrote:

> For this \href or \url appeared to be best for me, but then I recognized 
> that some Reader version like the well common 8.1.x ones, doesn't have 
> the functionality to "right-click" and "copy to clipboard" linkx, or any 
> other possibility to copy the link instead of simply clicking them.
> So I looked for another solution than simply writing the URLs as plain 
> text to the document (because I won't get them printed !) and recognized 
> the very nice PDF- Text- Annotations.

> My first problem is the simple linebreak. The PDF- Reference says that 
> the common string escape sequence like \n, \t, \r exists, but when 
> trying to put an \n into the /Contents string, LaTeX gives me an error.

\string\n, \string\r, \string\t
or \detokenize{\n}, ...

or within \pdfstringdef (hyperref): \textHT (\t) \textLF (\n) \textCR (\r)

>  /T (Possible URLs)
>  /Contents (Testnote.
>   Public accessible link ... IE specific fancy URL: 
> http://....../Ljuskällor & Drifton)

You can only use PDFDocEncoding or Unicode (UTF16), therefore care
is needed for 8bit characters. Also some characters need to be escaped
(unmatched parentheses, backslash).

hyperref provides \pdfstrindef for this job:

\pdfstringdef\ContentsString{Public ... Ljuskällor \& Drifton}

Yours sincerely
  Heiko <oberdiek at uni-freiburg.de>

More information about the pdftex mailing list