circle.ch weblog by Urs Gehrig

 Search
A weblog about libre software, law, technology, politics and the like.
2014-09-13T00:10:13
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% header.ps -compose bumpmap -gravity south out.pdf

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

[1] http://www.lagotzki.de/pdftk/index.html#FAQ

Comments (0) Permalink del.icio.us

The URL to TrackBack this entry is:
   http://circle.ch/blog/b2trackback.php/1840

Comments closed.



Werbung:

Beiträge von Dritten:

Nachfolgende Titel verweisen auf von mir gelesene Weblogs.

Feeds:

Blog Content
Blog Comments

WikiAgenda:

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...

Archives:

Blog stack:

Bill Humphries
monorom
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 $