[opensuse] Re: postscript question.
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: jschrod@acm.org Roedermark, Germany -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The Tuesday 2007-04-24 at 12:32 +0200, Joachim Schrod wrote:
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.
Interesting! But it says "Can't locate PDF/Reuse.pm", and I can't see that file in the dvd/oss/nonoss repos. - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) Comment: Made with pgp4pine 1.76 iD8DBQFGLeO4tTMYHG2NR9URAqfGAJoDgtV0ZyjyNVZuYZO9/75rI5h2uACfa2HJ cpNGpzddNnjlQbh2fH65GWQ= =V7Nm -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (2)
-
Carlos E. R.
-
Joachim Schrod