[pdftex] display unicode string with \pdfannot

Vasile Gaburici vgaburici at gmail.com
Thu Aug 28 21:52:56 CEST 2008


The experts surely make this look easy :)

On Thu, Aug 28, 2008 at 7:58 PM, Heiko Oberdiek
<oberdiek at uni-freiburg.de> wrote:
> 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>
> --
> _______________________________________________
> pdftex mailing list
> pdftex at tug.org
> http://tug.org/mailman/listinfo/pdftex
>


More information about the pdftex mailing list