Cond !bool{}/!bool_lax{} did not negate. Fixed.
[exim.git] / doc / doc-docbook / PageLabelPDF
CommitLineData
9b371988
PH
1#! /usr/bin/perl -w
2
4f578862 3# $Cambridge: exim/doc/doc-docbook/PageLabelPDF,v 1.2 2006/04/04 14:03:49 ph10 Exp $
9b371988
PH
4
5# Program to add page label information to the PDF output file. I have not
6# found a way of automatically discovering the number of frontmatter pages
4f578862
PH
7# in the document. It is therefore taken as an argument to be inserted into the
8# next statement.
9b371988
PH
9
10$add = "/PageLabels << /Nums [ 0 << /S /r >>\n" .
4f578862 11 " $ARGV[0] << /S /D >>\n" .
9b371988
PH
12 " ]\n" .
13 " >>\n";
14
15$extra = length $add;
16
17$before = 0;
4f578862 18while (<STDIN>)
9b371988
PH
19 {
20 print;
21 $before += length($_);
22 last if $_ =~ "^<< /Type /Catalog";
23 }
24
25print $add;
26
4f578862 27while (<STDIN>)
9b371988
PH
28 {
29 print;
30 last if $_ =~ /^xref$/;
31 }
32
4f578862 33while (<STDIN>)
9b371988
PH
34 {
35 if (/^(\d{10}) (.*)/)
36 {
37 my($was) = $1;
38 my($rest) = $2;
39 printf "%010d $rest\n", $was + (($was > $before)? $extra : 0);
40 }
41 elsif (/^startxref/)
42 {
43 print;
4f578862 44 $_ = <STDIN>;
9b371988
PH
45 if (/^(\d+)/)
46 {
47 print $1 + $extra, "\n";
48 }
49 else
50 {
51 print;
52 }
53 }
54 else
55 {
56 print;
57 }
58 }
59
60# End
61
62