0

I have to fill out a form and I want to fill it in Latex. How can I insert the pdf/word file with the form and write on it in latex?

Thank you!

1 Answers1

2

I understand this differently from Henri - I assume you want to write on an already existing PDF file. (If you have a Word file, you need to convert to PDF first.)

You can use the textpos package to do your bidding, but I prefer to use tikz, since I use it more often anyway and am more comfortable with it. Here is an example.

\documentclass[11pt]{article}

\usepackage{lmodern,tikz,calc}
\usepackage[margin=0pt]{geometry}
\pagestyle{empty}

% text bold and red just for this example. Text nodes will be aligned
% by their bottom left corners.      
\tikzstyle{every node}=[anchor=base west,text=red,font=\bfseries]

% save the existing form in a box; we use the size of that 
% box to scale the coordinates. That way, the text elements will
% stay in their right places in case the graphic is resized later.
\newsavebox{\mybox}
\savebox{\mybox}{\includegraphics[width=0.9\textwidth]{picture}}

\newlength{\boxwidth}
\newlength{\boxheight}
\setlength{\boxwidth}{\wd\mybox}
\setlength{\boxheight}{\ht\mybox+\dp\mybox}

% define coordinate grid relative to box width
\newlength{\gridstep}
\setlength{\gridstep}{0.2\boxwidth}

\newcommand{\tikzgrid}[2][5in]{
  \draw[step=.1in,gray,very thin] (0,0) grid (#1,#2);
  \draw[step=.5in,black,very thin] (0,0) grid (#1,#2);
}

\begin{document}
\null\vfill
\centering
\begin{tikzpicture}[x=\gridstep,y=\gridstep]
% insert background image
\node at (0,0){\usebox{\mybox}};

% draw help lines. comment out once you are done placing the text elements.
\draw[step=0.25\gridstep,black!20,very thin] (0,0) grid (\boxwidth,\boxheight);
\draw[step=\gridstep,black,very thin] (0,0) grid (\boxwidth,\boxheight);

% the text elements. the coordinates in brackets are in units of 
% the major (black) help lines. 
\path 
(0.75,5.05) node {Pomegranate}
(1.75,4.75) node {roasted marshmallow}
(1.5,4.4)   node {Pokemons}
% a text node with line breaks and non-standard positioning
(1.5,0.75)  node[anchor=north west,text width=1in]
                {Mom,\\Dad,\\lil brotha.}
;

\end{tikzpicture}
\vfill
\end{document}

enter image description here