summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--testing/resources/annotiter.in4
-rw-r--r--testing/resources/annotiter.pdf4
-rw-r--r--testing/resources/bookmarks.in5
-rw-r--r--testing/resources/bookmarks.pdf5
-rw-r--r--testing/resources/bookmarks_circular.in5
-rw-r--r--testing/resources/bookmarks_circular.pdf5
-rw-r--r--testing/resources/circular_viewer_ref.in2
-rw-r--r--testing/resources/circular_viewer_ref.pdf2
-rw-r--r--testing/resources/combobox_form.in4
-rw-r--r--testing/resources/combobox_form.pdf14
-rw-r--r--testing/resources/hello_world.in6
-rw-r--r--testing/resources/hello_world.pdf18
-rw-r--r--testing/resources/launch_action.in7
-rw-r--r--testing/resources/launch_action.pdf19
-rw-r--r--testing/resources/named_dests.in5
-rw-r--r--testing/resources/named_dests.pdf5
-rw-r--r--testing/resources/repeat_viewer_ref.in2
-rw-r--r--testing/resources/repeat_viewer_ref.pdf2
-rw-r--r--testing/resources/text_form.in3
-rw-r--r--testing/resources/text_form.pdf7
-rw-r--r--testing/resources/unsupported_feature.in8
-rw-r--r--testing/resources/unsupported_feature.pdf21
-rw-r--r--testing/resources/use_outlines.in6
-rw-r--r--testing/resources/use_outlines.pdf18
-rw-r--r--testing/resources/viewer_ref.in5
-rw-r--r--testing/resources/viewer_ref.pdf5
-rw-r--r--testing/resources/weblinks.in6
-rw-r--r--testing/resources/weblinks.pdf16
-rw-r--r--testing/resources/weblinks_across_lines.in6
-rw-r--r--testing/resources/weblinks_across_lines.pdf18
-rw-r--r--testing/resources/zero_length_stream.in5
-rw-r--r--testing/resources/zero_length_stream.pdf5
-rwxr-xr-xtesting/tools/fixup_pdf_template.py15
33 files changed, 105 insertions, 153 deletions
diff --git a/testing/resources/annotiter.in b/testing/resources/annotiter.in
index 4dc2a4ee2e..21e7b45e17 100644
--- a/testing/resources/annotiter.in
+++ b/testing/resources/annotiter.in
@@ -122,8 +122,6 @@ endobj
>>
endobj
{{xref}}
-trailer <<
- /Root 1 0 R
->>
+{{trailer}}
{{startxref}}
%%EOF
diff --git a/testing/resources/annotiter.pdf b/testing/resources/annotiter.pdf
index 2cb6d395d0..feb7909768 100644
--- a/testing/resources/annotiter.pdf
+++ b/testing/resources/annotiter.pdf
@@ -150,9 +150,7 @@ xref
0000001160 00000 n
0000001288 00000 n
0000001415 00000 n
-trailer <<
- /Root 1 0 R
->>
+trailer<< /Root 1 0 R /Size 26 >>
startxref
1546
%%EOF
diff --git a/testing/resources/bookmarks.in b/testing/resources/bookmarks.in
index dfa6e1426f..793f6ae542 100644
--- a/testing/resources/bookmarks.in
+++ b/testing/resources/bookmarks.in
@@ -90,9 +90,6 @@ ET
endstream
endobj
{{xref}}
-trailer <<
- /Size 6
- /Root 1 0 R
->>
+{{trailer}}
{{startxref}}
%%EOF
diff --git a/testing/resources/bookmarks.pdf b/testing/resources/bookmarks.pdf
index 824ce78db7..8c2eb5ac7b 100644
--- a/testing/resources/bookmarks.pdf
+++ b/testing/resources/bookmarks.pdf
@@ -115,10 +115,7 @@ xref
0000000000 65535 f
0000000924 00000 n
0000001034 00000 n
-trailer <<
- /Size 6
- /Root 1 0 R
->>
+trailer<< /Root 1 0 R /Size 23 >>
startxref
1122
%%EOF
diff --git a/testing/resources/bookmarks_circular.in b/testing/resources/bookmarks_circular.in
index 48a5695e17..1b05f36a1e 100644
--- a/testing/resources/bookmarks_circular.in
+++ b/testing/resources/bookmarks_circular.in
@@ -90,9 +90,6 @@ ET
endstream
endobj
{{xref}}
-trailer <<
- /Size 6
- /Root 1 0 R
->>
+{{trailer}}
{{startxref}}
%%EOF
diff --git a/testing/resources/bookmarks_circular.pdf b/testing/resources/bookmarks_circular.pdf
index e7eb624781..0e4ef86e69 100644
--- a/testing/resources/bookmarks_circular.pdf
+++ b/testing/resources/bookmarks_circular.pdf
@@ -115,10 +115,7 @@ xref
0000000000 65535 f
0000000924 00000 n
0000001034 00000 n
-trailer <<
- /Size 6
- /Root 1 0 R
->>
+trailer<< /Root 1 0 R /Size 23 >>
startxref
1122
%%EOF
diff --git a/testing/resources/circular_viewer_ref.in b/testing/resources/circular_viewer_ref.in
index f791607e91..0ce7808154 100644
--- a/testing/resources/circular_viewer_ref.in
+++ b/testing/resources/circular_viewer_ref.in
@@ -19,6 +19,6 @@ endobj
endobj
{{xref}}
-trailer <</Root 1 0 R>>
+{{trailer}}
{{startxref}}
%%EOF
diff --git a/testing/resources/circular_viewer_ref.pdf b/testing/resources/circular_viewer_ref.pdf
index 2e5c4dd8ab..f97d068a06 100644
--- a/testing/resources/circular_viewer_ref.pdf
+++ b/testing/resources/circular_viewer_ref.pdf
@@ -29,7 +29,7 @@ xref
0000000000 65535 f
0000000000 65535 f
0000000195 00000 n
-trailer <</Root 1 0 R>>
+trailer<< /Root 1 0 R /Size 8 >>
startxref
291
%%EOF
diff --git a/testing/resources/combobox_form.in b/testing/resources/combobox_form.in
index c64f329f22..6c9f914023 100644
--- a/testing/resources/combobox_form.in
+++ b/testing/resources/combobox_form.in
@@ -31,6 +31,7 @@ endobj
/Subtype /Type1
/BaseFont /Helvetica
>>
+endobj
{{object 7 0}}
<< /Length 51 >>
stream
@@ -66,6 +67,7 @@ endobj
/Opt [(Apple) (Banana) (Cherry)]
/V (Banana)
>>
+endobj
{{object 10 0}}
<<
/Type /Annot
@@ -79,6 +81,6 @@ endobj
>>
endobj
{{xref}}
-trailer<< /Size 10 /Root 1 0 R >>
+{{trailer}}
{{startxref}}
%%EOF
diff --git a/testing/resources/combobox_form.pdf b/testing/resources/combobox_form.pdf
index d543737606..5249276b62 100644
--- a/testing/resources/combobox_form.pdf
+++ b/testing/resources/combobox_form.pdf
@@ -32,6 +32,7 @@ endobj
/Subtype /Type1
/BaseFont /Helvetica
>>
+endobj
7 0 obj
<< /Length 51 >>
stream
@@ -67,6 +68,7 @@ endobj
/Opt [(Apple) (Banana) (Cherry)]
/V (Banana)
>>
+endobj
10 0 obj
<<
/Type /Annot
@@ -88,11 +90,11 @@ xref
0000000335 00000 n
0000000368 00000 n
0000000399 00000 n
-0000000468 00000 n
-0000000568 00000 n
-0000000772 00000 n
-0000000961 00000 n
-trailer<< /Size 10 /Root 1 0 R >>
+0000000475 00000 n
+0000000575 00000 n
+0000000779 00000 n
+0000000975 00000 n
+trailer<< /Root 1 0 R /Size 11 >>
startxref
-1150
+1164
%%EOF
diff --git a/testing/resources/hello_world.in b/testing/resources/hello_world.in
index 19fce0ce33..d3cf265c35 100644
--- a/testing/resources/hello_world.in
+++ b/testing/resources/hello_world.in
@@ -3,6 +3,7 @@
/Type /Catalog
/Pages 2 0 R
>>
+endobj
{{object 2 0}} <<
/Type /Pages
/MediaBox [ 0 0 200 200 ]
@@ -48,9 +49,6 @@ ET
endstream
endobj
{{xref}}
-trailer <<
- /Size 6
- /Root 1 0 R
->>
+{{trailer}}
{{startxref}}
%%EOF
diff --git a/testing/resources/hello_world.pdf b/testing/resources/hello_world.pdf
index bb4f0a88e7..dcde8f7655 100644
--- a/testing/resources/hello_world.pdf
+++ b/testing/resources/hello_world.pdf
@@ -4,6 +4,7 @@
/Type /Catalog
/Pages 2 0 R
>>
+endobj
2 0 obj <<
/Type /Pages
/MediaBox [ 0 0 200 200 ]
@@ -52,15 +53,12 @@ xref
0 7
0000000000 65535 f
0000000015 00000 n
-0000000061 00000 n
-0000000154 00000 n
-0000000296 00000 n
-0000000374 00000 n
-0000000450 00000 n
-trailer <<
- /Size 6
- /Root 1 0 R
->>
+0000000068 00000 n
+0000000161 00000 n
+0000000303 00000 n
+0000000381 00000 n
+0000000457 00000 n
+trailer<< /Root 1 0 R /Size 7 >>
startxref
-571
+578
%%EOF
diff --git a/testing/resources/launch_action.in b/testing/resources/launch_action.in
index c98539f5ea..00569e4489 100644
--- a/testing/resources/launch_action.in
+++ b/testing/resources/launch_action.in
@@ -3,6 +3,7 @@
/Type /Catalog
/Pages 2 0 R
>>
+endobj
{{object 2 0}} <<
/Type /Pages
/MediaBox [ 0 0 200 200 ]
@@ -40,15 +41,13 @@ endobj
/F 6 0 R
/S /Launch
>>
+endobj
{{object 6 0}} <<
/F (test.pdf)
/Type / Filespec
>>
endobj
{{xref}}
-trailer <<
- /Size 6
- /Root 1 0 R
->>
+{{trailer}}
{{startxref}}
%%EOF
diff --git a/testing/resources/launch_action.pdf b/testing/resources/launch_action.pdf
index 99a42923de..327c863c7a 100644
--- a/testing/resources/launch_action.pdf
+++ b/testing/resources/launch_action.pdf
@@ -4,6 +4,7 @@
/Type /Catalog
/Pages 2 0 R
>>
+endobj
2 0 obj <<
/Type /Pages
/MediaBox [ 0 0 200 200 ]
@@ -41,6 +42,7 @@ endobj
/F 6 0 R
/S /Launch
>>
+endobj
6 0 obj <<
/F (test.pdf)
/Type / Filespec
@@ -50,15 +52,12 @@ xref
0 7
0000000000 65535 f
0000000015 00000 n
-0000000061 00000 n
-0000000154 00000 n
-0000000223 00000 n
-0000000489 00000 n
-0000000527 00000 n
-trailer <<
- /Size 6
- /Root 1 0 R
->>
+0000000068 00000 n
+0000000161 00000 n
+0000000230 00000 n
+0000000496 00000 n
+0000000541 00000 n
+trailer<< /Root 1 0 R /Size 7 >>
startxref
-583
+597
%%EOF
diff --git a/testing/resources/named_dests.in b/testing/resources/named_dests.in
index 5309ee23aa..a97aebe8bf 100644
--- a/testing/resources/named_dests.in
+++ b/testing/resources/named_dests.in
@@ -101,9 +101,6 @@ ET
endstream
endobj
{{xref}}
-trailer <<
- /Size 6
- /Root 1 0 R
->>
+{{trailer}}
{{startxref}}
%%EOF
diff --git a/testing/resources/named_dests.pdf b/testing/resources/named_dests.pdf
index 2e0e5ce71d..b99cead4ce 100644
--- a/testing/resources/named_dests.pdf
+++ b/testing/resources/named_dests.pdf
@@ -126,10 +126,7 @@ xref
0000000000 65535 f
0000001283 00000 n
0000001393 00000 n
-trailer <<
- /Size 6
- /Root 1 0 R
->>
+trailer<< /Root 1 0 R /Size 23 >>
startxref
1481
%%EOF
diff --git a/testing/resources/repeat_viewer_ref.in b/testing/resources/repeat_viewer_ref.in
index 6b436e535f..09a17f522d 100644
--- a/testing/resources/repeat_viewer_ref.in
+++ b/testing/resources/repeat_viewer_ref.in
@@ -14,6 +14,6 @@ endobj
endobj
{{xref}}
-trailer <</Root 1 0 R>>
+{{trailer}}
{{startxref}}
%%EOF
diff --git a/testing/resources/repeat_viewer_ref.pdf b/testing/resources/repeat_viewer_ref.pdf
index 3f4ee47724..72bd7e4847 100644
--- a/testing/resources/repeat_viewer_ref.pdf
+++ b/testing/resources/repeat_viewer_ref.pdf
@@ -24,7 +24,7 @@ xref
0000000000 65535 f
0000000000 65535 f
0000000221 00000 n
-trailer <</Root 1 0 R>>
+trailer<< /Root 1 0 R /Size 8 >>
startxref
317
%%EOF
diff --git a/testing/resources/text_form.in b/testing/resources/text_form.in
index 4872986af1..c30f0bac4e 100644
--- a/testing/resources/text_form.in
+++ b/testing/resources/text_form.in
@@ -40,6 +40,7 @@ endobj
/Subtype /Type1
/BaseFont /Helvetica
>>
+endobj
{{object 8 0}}
<< /Length 51 >>
stream
@@ -52,6 +53,6 @@ ET
endstream
endobj
{{xref}}
-trailer<< /Size 8 /Root 1 0 R >>
+{{trailer}}
{{startxref}}
%%EOF
diff --git a/testing/resources/text_form.pdf b/testing/resources/text_form.pdf
index f72a73567b..1f3ab8571c 100644
--- a/testing/resources/text_form.pdf
+++ b/testing/resources/text_form.pdf
@@ -41,6 +41,7 @@ endobj
/Subtype /Type1
/BaseFont /Helvetica
>>
+endobj
8 0 obj
<< /Length 51 >>
stream
@@ -62,8 +63,8 @@ xref
0000000445 00000 n
0000000478 00000 n
0000000509 00000 n
-0000000578 00000 n
-trailer<< /Size 8 /Root 1 0 R >>
+0000000585 00000 n
+trailer<< /Root 1 0 R /Size 9 >>
startxref
-678
+685
%%EOF
diff --git a/testing/resources/unsupported_feature.in b/testing/resources/unsupported_feature.in
index 3aa8632d14..d3080519bf 100644
--- a/testing/resources/unsupported_feature.in
+++ b/testing/resources/unsupported_feature.in
@@ -9,12 +9,12 @@ endobj
/Type /Pages
/Count 3
/Kids [
- 10 0 R
+ 3 0 R
]
>>
endobj
% Page number 0.
-{{object 10 0}} <<
+{{object 3 0}} <<
/Type /Page
/Parent 2 0 R
/Resources <<
@@ -25,8 +25,6 @@ endobj
>>
endobj
{{xref}}
-trailer <<
- /Root 1 0 R
->>
+{{trailer}}
{{startxref}}
%%EOF
diff --git a/testing/resources/unsupported_feature.pdf b/testing/resources/unsupported_feature.pdf
index f7091c5016..eb7ee08fa4 100644
--- a/testing/resources/unsupported_feature.pdf
+++ b/testing/resources/unsupported_feature.pdf
@@ -10,12 +10,12 @@ endobj
/Type /Pages
/Count 3
/Kids [
- 10 0 R
+ 3 0 R
]
>>
endobj
% Page number 0.
-10 0 obj <<
+3 0 obj <<
/Type /Page
/Parent 2 0 R
/Resources <<
@@ -26,21 +26,12 @@ endobj
>>
endobj
xref
-0 11
+0 4
0000000000 65535 f
0000000015 00000 n
0000000088 00000 n
-0000000000 65535 f
-0000000000 65535 f
-0000000000 65535 f
-0000000000 65535 f
-0000000000 65535 f
-0000000000 65535 f
-0000000000 65535 f
-0000000177 00000 n
-trailer <<
- /Root 1 0 R
->>
+0000000176 00000 n
+trailer<< /Root 1 0 R /Size 4 >>
startxref
-312
+310
%%EOF
diff --git a/testing/resources/use_outlines.in b/testing/resources/use_outlines.in
index b344143f64..7b09ff9547 100644
--- a/testing/resources/use_outlines.in
+++ b/testing/resources/use_outlines.in
@@ -4,6 +4,7 @@
/Pages 2 0 R
/PageMode /UseOutlines
>>
+endobj
{{object 2 0}} <<
/Type /Pages
/MediaBox [ 0 0 200 200 ]
@@ -49,9 +50,6 @@ ET
endstream
endobj
{{xref}}
-trailer <<
- /Size 6
- /Root 1 0 R
->>
+{{trailer}}
{{startxref}}
%%EOF
diff --git a/testing/resources/use_outlines.pdf b/testing/resources/use_outlines.pdf
index 371ff4083c..81b01cabf6 100644
--- a/testing/resources/use_outlines.pdf
+++ b/testing/resources/use_outlines.pdf
@@ -5,6 +5,7 @@
/Pages 2 0 R
/PageMode /UseOutlines
>>
+endobj
2 0 obj <<
/Type /Pages
/MediaBox [ 0 0 200 200 ]
@@ -53,15 +54,12 @@ xref
0 7
0000000000 65535 f
0000000015 00000 n
-0000000086 00000 n
-0000000179 00000 n
-0000000321 00000 n
-0000000399 00000 n
-0000000475 00000 n
-trailer <<
- /Size 6
- /Root 1 0 R
->>
+0000000093 00000 n
+0000000186 00000 n
+0000000328 00000 n
+0000000406 00000 n
+0000000482 00000 n
+trailer<< /Root 1 0 R /Size 7 >>
startxref
-596
+603
%%EOF
diff --git a/testing/resources/viewer_ref.in b/testing/resources/viewer_ref.in
index 62ae372dfe..704e9d3a46 100644
--- a/testing/resources/viewer_ref.in
+++ b/testing/resources/viewer_ref.in
@@ -49,9 +49,6 @@ ET
endstream
endobj
{{xref}}
-trailer <<
- /Size 6
- /Root 1 0 R
->>
+{{trailer}}
{{startxref}}
%%EOF
diff --git a/testing/resources/viewer_ref.pdf b/testing/resources/viewer_ref.pdf
index fb72107b5b..851ea273e7 100644
--- a/testing/resources/viewer_ref.pdf
+++ b/testing/resources/viewer_ref.pdf
@@ -73,10 +73,7 @@ xref
0000000000 65535 f
0000000000 65535 f
0000000537 00000 n
-trailer <<
- /Size 6
- /Root 1 0 R
->>
+trailer<< /Root 1 0 R /Size 22 >>
startxref
625
%%EOF
diff --git a/testing/resources/weblinks.in b/testing/resources/weblinks.in
index ed20b2e642..818e676e90 100644
--- a/testing/resources/weblinks.in
+++ b/testing/resources/weblinks.in
@@ -3,6 +3,7 @@
/Type /Catalog
/Pages 2 0 R
>>
+endobj
{{object 2 0}} <<
/Type /Pages
/MediaBox [ 0 0 600 600 ]
@@ -58,9 +59,6 @@ ET
endstream
endobj
{{xref}}
-trailer <<
- /Size 6
- /Root 1 0 R
->>
+{{trailer}}
{{startxref}}
%%EOF
diff --git a/testing/resources/weblinks.pdf b/testing/resources/weblinks.pdf
index 0d201a45aa..2639be85dc 100644
--- a/testing/resources/weblinks.pdf
+++ b/testing/resources/weblinks.pdf
@@ -4,6 +4,7 @@
/Type /Catalog
/Pages 2 0 R
>>
+endobj
2 0 obj <<
/Type /Pages
/MediaBox [ 0 0 600 600 ]
@@ -62,15 +63,12 @@ xref
0 7
0000000000 65535 f
0000000015 00000 n
-0000000061 00000 n
-0000000154 00000 n
-0000000374 00000 n
+0000000068 00000 n
+0000000161 00000 n
+0000000381 00000 n
0000000000 65535 f
-0000000450 00000 n
-trailer <<
- /Size 6
- /Root 1 0 R
->>
+0000000457 00000 n
+trailer<< /Root 1 0 R /Size 7 >>
startxref
-963
+970
%%EOF
diff --git a/testing/resources/weblinks_across_lines.in b/testing/resources/weblinks_across_lines.in
index bb04b5e9cf..5771534913 100644
--- a/testing/resources/weblinks_across_lines.in
+++ b/testing/resources/weblinks_across_lines.in
@@ -3,6 +3,7 @@
/Type /Catalog
/Pages 2 0 R
>>
+endobj
{{object 2 0}} <<
/Type /Pages
/MediaBox [ 0 0 600 600 ]
@@ -66,9 +67,6 @@ ET
endstream
endobj
{{xref}}
-trailer <<
- /Size 6
- /Root 1 0 R
->>
+{{trailer}}
{{startxref}}
%%EOF
diff --git a/testing/resources/weblinks_across_lines.pdf b/testing/resources/weblinks_across_lines.pdf
index e9327c4b34..b70910d629 100644
--- a/testing/resources/weblinks_across_lines.pdf
+++ b/testing/resources/weblinks_across_lines.pdf
@@ -4,6 +4,7 @@
/Type /Catalog
/Pages 2 0 R
>>
+endobj
2 0 obj <<
/Type /Pages
/MediaBox [ 0 0 600 600 ]
@@ -70,15 +71,12 @@ xref
0 7
0000000000 65535 f
0000000015 00000 n
-0000000061 00000 n
-0000000154 00000 n
-0000000296 00000 n
-0000000374 00000 n
-0000000450 00000 n
-trailer <<
- /Size 6
- /Root 1 0 R
->>
+0000000068 00000 n
+0000000161 00000 n
+0000000303 00000 n
+0000000381 00000 n
+0000000457 00000 n
+trailer<< /Root 1 0 R /Size 7 >>
startxref
-921
+928
%%EOF
diff --git a/testing/resources/zero_length_stream.in b/testing/resources/zero_length_stream.in
index 5b258d4d74..e7203437cc 100644
--- a/testing/resources/zero_length_stream.in
+++ b/testing/resources/zero_length_stream.in
@@ -55,9 +55,6 @@ ET
endstream
endobj
{{xref}}
-trailer <<
- /Size 6
- /Root 1 0 R
->>
+{{trailer}}
{{startxref}}
%%EOF
diff --git a/testing/resources/zero_length_stream.pdf b/testing/resources/zero_length_stream.pdf
index 90fae5be7f..1317c3f98a 100644
--- a/testing/resources/zero_length_stream.pdf
+++ b/testing/resources/zero_length_stream.pdf
@@ -65,10 +65,7 @@ xref
0000000382 00000 n
0000000458 00000 n
0000000531 00000 n
-trailer <<
- /Size 6
- /Root 1 0 R
->>
+trailer<< /Root 1 0 R /Size 8 >>
startxref
652
%%EOF
diff --git a/testing/tools/fixup_pdf_template.py b/testing/tools/fixup_pdf_template.py
index 80a712f6e8..10ca241242 100755
--- a/testing/tools/fixup_pdf_template.py
+++ b/testing/tools/fixup_pdf_template.py
@@ -10,8 +10,10 @@ script replaces {{name}}-style variables in the input with calculated results
{{header}} - expands to the header comment required for PDF files.
{{xref}} - expands to a generated xref table, noting the offset.
+ {{trailer}} - expands to a standard trailer with "1 0 R" as the /Root.
{{startxref} - expands to a startxref directive followed by correct offset.
- {{object x y}} - expands to |x y obj| declaration, noting the offset."""
+ {{object x y}} - expands to |x y obj| declaration, noting the offset.
+"""
import optparse
import os
@@ -19,15 +21,19 @@ import re
import sys
class TemplateProcessor:
- HEADER_TOKEN = '{{header}}'
+ HEADER_TOKEN = '{{header}}'
HEADER_REPLACEMENT = '%PDF-1.7\n%\xa0\xf2\xa4\xf4'
XREF_TOKEN = '{{xref}}'
XREF_REPLACEMENT = 'xref\n%d %d\n'
- # XREF rows must be exactly 20 bytes - space required.
XREF_REPLACEMENT_N = '%010d %05d n \n'
XREF_REPLACEMENT_F = '0000000000 65535 f \n'
+ # XREF rows must be exactly 20 bytes - space required.
+ assert(len(XREF_REPLACEMENT_F) == 20)
+
+ TRAILER_TOKEN = '{{trailer}}'
+ TRAILER_REPLACEMENT = 'trailer<< /Root 1 0 R /Size %d >>'
STARTXREF_TOKEN= '{{startxref}}'
STARTXREF_REPLACEMENT = 'startxref\n%d'
@@ -60,6 +66,9 @@ class TemplateProcessor:
if self.XREF_TOKEN in line:
self.xref_offset = self.offset
line = self.generate_xref_table()
+ if self.TRAILER_TOKEN in line:
+ replacement = self.TRAILER_REPLACEMENT % (self.max_object_number + 1)
+ line = line.replace(self.TRAILER_TOKEN, replacement)
if self.STARTXREF_TOKEN in line:
replacement = self.STARTXREF_REPLACEMENT % self.xref_offset
line = line.replace(self.STARTXREF_TOKEN, replacement)