weblog by Urs Gehrig

A weblog about libre software, law, technology, politics and the like.
Academic, Android, Apache, Apple, Art, Best Of, Biotech, Civil Society, Content Management, Cooking, Copyright, Creative Commons, Crosspost, Culture, Database, Deutsch, DRM, Economy, Education, Event, Gadget, General, Geodata, Government, Health, Howto, Humor, Innovation, Intellectual Property, Java, Language, LaTeX, Law, Linux, Media, Moblog, Mozilla, Music, Office, Open Content, Open Source, P2P, PHP, Podcast, Politics, Privacy, Projects, Random Thought, Rant, Science, Search, Social Network, Software, Sport, Talks, Technology, Technology Transfer, Travelling, Weblog, Wiki, Wireless and Mobile, XML

03. October 2007

Adding header or footer information to existing PDF
@ 08:03:11

Recently we had to deal with PDF manipulation, respectively the need to add header information to an existing PDF file. First thing I tried was using LaTeX as outlined by Stefan Lagotzki [1]. But a solution to apply more easy was needed. Imagemagick's "composite" does now the job quite well. Multipage PDF files have first to be split up and then being treated with composite as outlined below:
$ pdftk A=multipage.pdf cat A1 output multipage.1.pdf
$ pdftk A=multipage.pdf cat A2 output multipage.2.pdf

The commandline below takes the singlepage PDF at a resolution of 300dpi and resizes it to a percentage and then glues it to the header page, which is of the size A4. Resizing ensures, that the header information is always visible above the included singlepage:
$ composite -density 300 multipage.1.pdf -resize 93% -compose bumpmap -gravity south out.pdf

The header page could look like shown below:
%%DocumentMedia: A4 595 842 0 () ()
%%Orientation: Portrait
%%Pages: (atend)
%%DocumentFonts: Times-Roman Helvetica
%%Page: 1 1
50 760 moveto
/Courier findfont 14 scalefont setfont
(Add your text right here...) show
%%Pages: 1


Comments (0) Permalink

The URL to TrackBack this entry is:

Comments closed.


Beiträge von Dritten:

Nachfolgende Titel verweisen auf von mir gelesene Weblogs.


Blog Content
Blog Comments



Good question, but...
Hi, thank you very...
Unter http://www.s...
Ich weiss mir nich...
ThanQ matthias. Th...
in case you just w...
ich liebe dir, urs...
hi there, sorry i...
Hoi Leo. I haven'...
Do you know the si...


Blog stack:

Bill Humphries
Wendy M. Seltzer
Christian Stocker
Roger Fischer
Sandro Zic
Wez Furlong
Ben Hammersley
George Schlossnagle
Joichi Ito
Lawrence Lessig
Derek Slater
Karl-Friedrich Lenz
John Palfrey
Bernhard A.M. Seefeld
Gregor J. Rothfuss
Rainer Langenhan
Elke Engel
Sebastian Bergmann
Simon Willison
Jeremy Zwaodny
Udo Vetter
Axel A. Horns
Miguel de Icaza
Andreas Halter
Silvan Zurbrügg
Hannes Gassert
Markus Koller

$Date: 2005/11/05 11:14:30 $