[pdftex] display unicode string with \pdfannot

Heiko Oberdiek oberdiek at uni-freiburg.de
Thu Aug 28 18:58:34 CEST 2008


On Thu, Aug 28, 2008 at 04:25:31PM +0300, Vasile Gaburici wrote:

> Of course it doesn't work because \pdfannot takes raw PDF as input.
> LICRs, which is what the ucs package produces for any char > 127, will
> not do what you think. For instance:
> 
> \pdfannot{/Subtype /Square /Border [ 0 0 0.1 ] /C [0 0 1] %
> /T (Some title) /Contents (My text: \backslash) }
> 
> Will produce a box with this contents:
> 
> My Text: delimiter "026E30F
> 
> You need to change catcodes so you can output UTF-16BE unmolested,
> which is what PDF needs for *its* strings; see section 3.8.1 in PDF
> 1.7 reference.

Or use hyperref:

\documentclass{article}
\let\OrgShow\show
\usepackage{ucs}
\AtBeginDocument{\let\show\OrgShow}
\usepackage[unicode]{hyperref}
\begin{document}
Hi
\pdfstringdef\ContentsString{Phrase Code = \textcopyright\texttrademark}
\pdfannot{%
  /Subtype/Square%
  /Border[0 0 .1]%
  /C[0 0 1]%
  /T(BoilerPlate)%
  /Contents(\ContentsString)%
}
\end{document}

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


More information about the pdftex mailing list