Schrek.fr

Mon super blog :)

  1. home
  2. posts
  3. 2023
  4. 08
  5. Latex-PDF-editable

Latex, PDF éditable

Cet article fait partie de la série: Latex


Table des matières

Avec la classe hyperref, on peut facilement créer des documents PDF éditable.

J’ai fait un petit exemple avec un attestation d’hébergement.

La documentation est bien faite.

Exemple

\documentclass[12pt,a4paper]{article}
\usepackage[right=2cm,left=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage[french]{babel}
\usepackage[default]{lato}
\usepackage{xcolor}
\usepackage{hyperref}
	\hypersetup{
		colorlinks=true,
		linkcolor=black,
	}
\usepackage{fancyhdr}
\pagestyle{empty}

\setlength\parindent{0pt}

\begin{document}

\begin{Form}

\begin{center}
	\textbf{\uppercase{ATTESTATION D'HÉBERGEMENT}} \\
\end{center}
\vspace{5mm}
Je soussigné(e), \\

\vspace{5mm}

\TextField[width=5cm,borderwidth=0pt]{Mme/M. :} \\
\TextField[width=5cm,borderwidth=0pt]{Né(e) le :} \\
\TextField[width=5cm,borderwidth=0pt]{À :} \\
\TextField[width=14cm,borderwidth=0pt]{Demeurant :} \\

\vspace{5mm}

déclare sur l'honneur héberger à mon domicile,\\

\vspace{5mm}
\TextField[width=5cm,borderwidth=0pt]{Mme/M. :} \\
\TextField[width=5cm,borderwidth=0pt]{Né(e) le :} \\
\TextField[width=5cm,borderwidth=0pt]{À :} \\
\vspace{5mm}

depuis le\\

\vspace{5mm}

\TextField[width=8cm,borderwidth=0pt]{Date de début d'hébergement:}\\
\vspace{5mm}
\TextField[width=14cm,borderwidth=0pt]{à l'adresse suivante :}

\TextField[width=8cm,borderwidth=0pt]{Fait à :} \\
\\
\TextField[width=4cm,borderwidth=0pt]{Le :} 
\TextField[width=1cm,borderwidth=0pt,maxlen=2]{à} 
\TextField[width=1cm,borderwidth=0pt,maxlen=2]{h} \\


\TextField[width=14cm,borderwidth=0pt]{Signature :} 

\end{Form}

\end{document}
Voir sur overleaf

Explications

  • On ouvre le formulaire avec la balise \begin{Form}
  • \TextField[width=4cm,borderwidth=0pt]{Le :} Ajoute la partie à completer
  • On ferme le formulaire avec la balise \end{Form}

En vrac

Voir en bas dans les liens de téléchargements.

\documentclass[12pt,a4paper]{article}
\usepackage[right=2cm,left=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage[french]{babel}
\usepackage[default]{lato}
\usepackage{xcolor}
\usepackage{hyperref}
	\hypersetup{
		colorlinks=true,
		linkcolor=black,
	}
\usepackage{fancyhdr}
\pagestyle{empty}

\begin{document}


\begin{Form}
Case à cocher:\\

	\CheckBox[bordercolor=black]{}


Villes:\\ 

\ChoiceMenu[combo,width=5cm,charsize=12pt,default=Paris,bordercolor=blue]{\mbox{}}{Paris,Lyon,Marseille} \\

Sexe:\\


\ChoiceMenu[radio,charsize=14pt,bordercolor=green,radiosymbol=\ding{170}]{\mbox{}}{Homme,Femme,Aucun}\\

Études:\\

\CheckBox[charsize=12pt]{Rien:}\\

\CheckBox[charsize=12pt]{Collège:}\\

\CheckBox[charsize=12pt]{Lycée:} \\
\end{Form}

\end{document}

Astuce

Pour modifier l’icône de choix \ding{170}] , voir liste dessous ou sur Cpan:

Liens

https://blog.dorian-depriester.fr/latex/creer-des-formulaire-pdf-editables

https://la-bibliotex.fr/2020/04/11/creer-des-pdf-editables-avec-latex/

https://www.maltegerken.de/blog/2021/07/creating-pdf-forms-with-latex/

https://latex-tutorial.com/bullet-styles/

comments powered by Disqus