# PDF forms with LaTeX: how to disable spell check in \Textfield

I'm creating a formular with text fields and I would like to disable the spellchecker in the pdf reader.

I saw that there is a pdf flag for this "DoNotSpellCheck", but I don't know how to use it (if it is possible).

Actually, I have the code:

\documentclass[11pt,a4paper]{article}
\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text}
\usepackage{xunicode}
\usepackage{xltxtra}
\usepackage{polyglossia}
\setdefaultlanguage{french}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{hyperref}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\begin{document}
\TextField[width=\linewidth, name=surname, bordersep=10pt, height=1cm]{}
\end{document}


And, I get this in the pdf reader:

I would like something without the red underline which shows spell errors.

Does anyone know something about it?

Help will be highly appreciated. Thanks

• Show with a minimal example what you have so far. Feb 10, 2020 at 12:48

## 1 Answer

Somewhere in the depth of the manual is the remark that the option is the name in lowercase. You can either use it in the optional argument or add it to \DefaultOptionsofText. The following works for me. Don't use xltxtra and xunicode, the packages are deprecated.

\documentclass[11pt,a4paper]{article}
\usepackage{fontspec}

\usepackage{polyglossia}
\setdefaultlanguage{french}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{hyperref}

\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\begin{document}
\begin{Form}
\TextField[width=\linewidth, name=nameA, bordersep=10pt, height=1cm]{}

\renewcommand\DefaultOptionsofText{print,donotspellcheck}

\TextField[width=\linewidth, name=nameB, bordersep=10pt, height=1cm]{}
\end{Form}
\end{document}


• Thank you very much, it's great. I wonder if it is possible to do it for once at the beginning of the document?
– Sim
Feb 10, 2020 at 19:54
• I edited the answer and added a reference to \DefaultOptionsofText. And I also added the form enviroment. Feb 10, 2020 at 22:49
• Great, it works quite well. Thank a lot. I did not find the \DefaultOptionsofText in the hyperref manual. Where can I find it? And you add the print option, it does not change if I remove it, is it necessary?
– Sim
Feb 13, 2020 at 20:56