[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [OT] signing a pdf document



On Wed, Jun 11, 2008 at 09:00:54 +0200, Johannes Wiedersich wrote:
> On 2008-06-10 23:42, Florian Kulzer wrote:
> > It is easy to scan your own signature and convert it into a compact
> > vector-based PDF that can be scaled without loss of quality. I doubt
> > that this constitutes a true signature in the legal sense, but it is
> > quite handy, for example to send "signed" documents directly to a fax
> > pseudo-printer.
> > 
> > To put the signature into an original document, e.g. into a PDF
> > registration form, I use Latex to superimpose the PDFs, as well as to
> > fill in any additional data that the form requires. I know no other
> > approach that preserves the full printing quality of the original PDF
> > while keeping the final PDF small.
> > 
> > I can post a simple example how to do this with Latex if you are
> > interested. 
> 
> Please, go ahead ;-)

I have included an example below that can be run through pdflatex. It
takes the first two pages of fontname.pdf (a document that is part of
texlive-base), puts some additional text on the first page and another
PDF (sample_eps.pdf, a font sample from texlive-doc-en) on top of the
second page.

It can be cumbersome to align a lot of text in textblock environments if
the original form has many irregularly-spaced input fields. You can load
the PDF form as a background image into the graphics program of your
choice (inkscape, scribus, OOo-draw, ...) and use this program to add
your text at the right positions. Then delete the background, safe your
aligned text as another PDF and superimpose the two PDFs with pdflatex.
If your preferred graphics/DTP software is not able to import the
original PDF as a suitable background image then you can use pdftoppm to
generate images of all the pages; just make sure that your graphics
software imports the images with the correct resolution.

If the original PDF is a real PDF form then you can try to fill in its
fields with pdftk (using generate_fdf, fill_form and flatten).
Furthermore, all poppler-based PDF readers (e.g. evince, okular) will
soon be able to fill in PDF forms natively. (Maybe this works already; I
have not tried it recently.)

------------------------------------------------------------------------

\documentclass[a4paper,12pt]{article}

\usepackage{graphicx}
\include{letterspacing}

\usepackage[absolute]{textpos}
\setlength{\TPHorizModule}{10mm}
\setlength{\TPVertModule}{10mm}

\renewcommand{\familydefault}{phv}
\pagestyle{empty}

%=================================================

\begin{document}
\setlength{\parindent}{0em}

%=================================================

\textblockorigin{0cm}{0cm}

\begin{textblock}{5}(3,12)
\Large John Doe
\end{textblock}

% how to change the spacing of the characters, e.g. for credit card fields
% that have a separate box for each digit

\begin{textblock}{10}(4,20)
\letterspace to 1.4\naturalwidth {\Large 1234567890123456}
\end{textblock}

%=================================================

\begin{textblock}{29.71}(0,0)
\includegraphics[page=1]{/usr/share/doc/texlive-base/fontname/fontname.pdf}
\end{textblock}

%=================================================

\vspace*{1mm}
\pagebreak

%=================================================

% how to superimpose another graphic file, e.g. for a signature

\begin{textblock}{8}(8,10)
\includegraphics[width=8cm]{/usr/share/doc/texlive-doc-en/english/truetype/sample_eps.pdf}
\end{textblock}

%=================================================

\begin{textblock}{29.71}(0,0)
\includegraphics[page=2]{/usr/share/doc/texlive-base/fontname/fontname.pdf}
\end{textblock}

%=================================================

\end{document}

-- 
Regards,            | http://users.icfo.es/Florian.Kulzer
          Florian   |


Reply to: