Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

http://live.julik.nl

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Add a watermark to a multi-page PDF (a-la Pragmatic Programmers)

This adds a text watermark to every page of a PDF document, as used by Pragmatic Programmers. Nothing secret here, more of a way to excercise "human" DRM. Used as:

   1  
   2     perl makepdf.pl "John Doe"


   1  
   2  use PDF::Reuse;
   3  use PDF::Reuse::Util;
   4  use strict;
   5  
   6  my ($name) = @ARGV;
   7  
   8  prFile('book_for_someone.pdf');
   9  
  10  my $sourcePdf = 'pdf_that_your_designer_made.pdf';
  11  my $greeting = "This book is personalized for " . $name;
  12  
  13  my $left = 1;
  14  while ($left) {
  15     prFont('HO');
  16     prAdd("0 0 0 rg\n0 g\nf\n");
  17     prText( 38, 800, $greeting);
  18     $left = prSinglePage($sourcePdf);   
  19  } 
  20  
  21  prEnd;
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS