1

I am trying hyperref textfield using the minimum code posted here.

\documentclass{article}
\usepackage{hyperref}

\begin{document}
\pdfstringdef\mytext{Hello\string\r World}

{
  \begin{Form}\TextField[multiline,name=toaddress,width=5cm,charsize=12pt,default=\mytext]{\mbox{}}
  \end{Form}
}
\end{document}

The "Hello" is shown correctly when pdfLaTeX is used. However, if xeLaTeX is used, some non-recognizable stuff is generated, which can be shown by Chrome but not Adobe or MS Edge. Can you suggest whether and how to use xeLaTeX to display the content correctly ?

1

1 Answer 1

2

Using \pdfstringdef here is wrong. As hyperref internally escapes the value you are now escaping it twice. Give the default value as simple text and enter the newline with ^^J:

\documentclass{article}
\usepackage{hyperref}

\begin{document}
  \begin{Form}
  \TextField[multiline,name=toaddress,width=5cm,charsize=12pt,default=Hello^^JWorld]{\mbox{}}
  \end{Form}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .