Personal web page: Emmanuel Branlard

SignPDF: A simple way to add a signature image to a pdf under linux

The following script allows the user to "sign a pdf" by adding/superimposing a signature image file to a given page on a pdf document under linux (debian, ubuntu, etc.). The user can select visually where to insert the signature with two cliks (rudimentary GUI). The image file, or scanned/digital signature can be in any format suported by imagemagick: pdf, png, jpeg etc. This simple action of inserting a graphical signature has nothing to do with the secured "digital signature" method.

Follow the link below to find the shell script and a .deb file for the package xv which is required by this script.

Folder


#############################################################
# SignPDF: A simple way to add a signature image to a pdf at given page under linux.
#          The inserted signature has the same aspect ratio than the original.
#############################################################
# Description:
#   The script uses xv to display the page where the signature should be inserted. 
#   Click on two points inside xv with the left-mouse-button to define the signature's 
#   box corner. Don't maintain the mouse. It has to be two single clicks. The order of
#   the click does not matter. Only the two last clicks are considered. Press q to quit 
#   xv. The signed file is generated in the same folder than the original, without 
#   overriding it. The signature keeps the same proportion than the original. You can 
#    move, but should not resize xv window.
#
# Written by : Emmanuel Branlard
# Date : April 2012
# Dependencies :  xv, pdftk, imagemagick .
#        To get xv: compile from source http://www.trilon.com/xv/d
#                   OR find a .deb repository on internet
# License : Feel free to modify and adapt it
#
# Usage:
#   First argument: pdf file 
#   Second argument: page number where the signature should be put
#   Third argument (optional):  signature file
#
# Example: Add a signature to file "my file.pdf" on page 5:
# ./SignPDF "my file.pdf" 5 "signature.png" 
#
# Note : You need to edit the SIGNATURE variable below for default signature
#        This script generates a folder where everything takes place
#        The folder is deleted afterwards.