Randall R Schulz wrote:
...
> Let's generalize, then. How to add arbitrary strings? File name,
> page number, date of printing...
Or with a small Perl script that uses PDF::Reuse. As long as one
stays with the 14 standard PDF fonts, this is a very good quick
solution. If you want to try this road, I can post more information.
Please do! Any examples from any of the techniques you've mentioned
would be good to see.
Say I have a PDF file called "report.pdf". How would I print it with
that file name in the margin of either the first page or all pages.
Below an example that adds it to all pages; filename in the left
part of the headline, pagenumber in the right part. I added the
page number to show right-aligned output. I left off argument parsing.
If you use inch instead of cm, you have to adjust the computation
of the headline position: Discard the division by 2.54.
------------------- snip snap --------------------------------
#!/usr/bin/perl
use strict;
use PDF::Reuse;
use PDF::Reuse::Util;
my $in_file = 'test-header-template.pdf';
my $out_file = 'test-header-resultat.pdf';
prFile($out_file);
prFont('Helvetica');
prFontSize(10); # in pt
prCompress(1);
# Position of headline: measured from lower left corner.
my @headline_left = (2, 28.7); # in cm
my @headline_right = (19, 28.7);
# Convert cm to pt:
@headline_left = map { $_ / 2.54 * 72 } @headline_left;
@headline_right = map { $_ / 2.54 * 72 } @headline_right;
for ( my $pageno = 1 ;
scalar(prForm({ file => $in_file,
page => $pageno,
tolerant => 1})) ;
$pageno += 1
) {
blackText(); # in case the page ends with colored text
# left and right are alignments, from the reference point
prText(@headline_left, "File: $in_file", 'left');
prText(@headline_right, "Page: $pageno", 'right');
prPage();
}
prEnd();
exit(0);
------------------- snip snap --------------------------------
HTH,
Joachim
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Joachim Schrod Email: [EMAIL PROTECTED]
Roedermark, Germany
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]