aboutsummaryrefslogtreecommitdiffstats
path: root/qpdf
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2020-01-26 22:43:55 +0100
committerJay Berkenbilt <ejb@ql.org>2020-01-26 22:50:57 +0100
commit57c01ef81ff11b208188bbdedc98b6ce20c786b3 (patch)
tree164cd1ba4e8e5f911f7ef860068d68b39831231f /qpdf
parentbbc2f8ffae939eab598f583514fb132d23c11705 (diff)
downloadqpdf-57c01ef81ff11b208188bbdedc98b6ce20c786b3.tar.zst
In qdf mode, don't write extra XRef streams (fixes #386)
fix-qdf assumes there is exactly one XRef stream and that it is at the end of the file.
Diffstat (limited to 'qpdf')
-rw-r--r--qpdf/qpdf.testcov1
-rw-r--r--qpdf/qtest/qpdf.test12
-rw-r--r--qpdf/qtest/qpdf/compress-objstm-xref-qdf.pdfbin0 -> 1249 bytes
3 files changed, 12 insertions, 1 deletions
diff --git a/qpdf/qpdf.testcov b/qpdf/qpdf.testcov
index db3de950..f16f0364 100644
--- a/qpdf/qpdf.testcov
+++ b/qpdf/qpdf.testcov
@@ -448,3 +448,4 @@ QPDFWriter stream in ostream 0
QPDFObjectHandle duplicate dict key 0
QPDFWriter no encryption sig contents 0
QPDFPageObjectHelper colorspace lookup 0
+QPDFWriter ignore XRef in qdf mode 0
diff --git a/qpdf/qtest/qpdf.test b/qpdf/qtest/qpdf.test
index f9bab01f..e42e204a 100644
--- a/qpdf/qtest/qpdf.test
+++ b/qpdf/qtest/qpdf.test
@@ -2779,7 +2779,7 @@ for (my $n = 16; $n <= 19; ++$n)
show_ntests();
# ----------
$td->notify("--- Specific File Tests ---");
-$n_tests += 4;
+$n_tests += 7;
# Special PDF files that caused problems at some point
@@ -2800,6 +2800,16 @@ $td->runtest("compress objstm and xref",
$td->runtest("check output",
{$td->FILE => "a.pdf"},
{$td->FILE => "compress-objstm-xref.pdf"});
+$td->runtest("qdf + preserved-unreferenced + xref streams",
+ {$td->COMMAND => "qpdf --qdf --preserve-unreferenced" .
+ " --static-id compress-objstm-xref.pdf a.pdf"},
+ {$td->STRING => "", $td->EXIT_STATUS => 0});
+$td->runtest("check output",
+ {$td->FILE => "a.pdf"},
+ {$td->FILE => "compress-objstm-xref-qdf.pdf"});
+$td->runtest("check fix-qdf idempotency",
+ {$td->COMMAND => "fix-qdf a.pdf"},
+ {$td->FILE => "a.pdf", $td->EXIT_STATUS => 0});
show_ntests();
# ----------
diff --git a/qpdf/qtest/qpdf/compress-objstm-xref-qdf.pdf b/qpdf/qtest/qpdf/compress-objstm-xref-qdf.pdf
new file mode 100644
index 00000000..d6b78a05
--- /dev/null
+++ b/qpdf/qtest/qpdf/compress-objstm-xref-qdf.pdf
Binary files differ