aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2020-04-05 23:18:46 +0200
committerJay Berkenbilt <ejb@ql.org>2020-04-06 02:07:13 +0200
commit08379321645133ba74dad4ce130055c087130bab (patch)
tree2a90eb01471f449d0b2876adfcb0c8cc224bec20
parent893d38b87e4ad6c6c55f49464f6b721c516ec878 (diff)
downloadqpdf-08379321645133ba74dad4ce130055c087130bab.tar.zst
Update documentation and test suite to lock in hard page copy
Issue #399 mentioned a use case for which qpdf has support, but the fact that it is supported was not documented or in the test suite, making it vulerable to accidental breakage.
-rw-r--r--manual/qpdf-manual.xml11
-rw-r--r--qpdf/qtest/qpdf.test15
-rw-r--r--qpdf/qtest/qpdf/deep-duplicate-pages.pdfbin0 -> 1287 bytes
3 files changed, 24 insertions, 2 deletions
diff --git a/manual/qpdf-manual.xml b/manual/qpdf-manual.xml
index a2dff114..c875baa2 100644
--- a/manual/qpdf-manual.xml
+++ b/manual/qpdf-manual.xml
@@ -1588,7 +1588,16 @@ outfile.pdf</option>
Prior to version 8.4, it was not possible to specify the same page
from the same file directly more than once, and the workaround of
specifying the same file in more than one way was required.
- Version 8.4 removes this limitation.
+ Version 8.4 removes this limitation, but there is still a valid
+ use case. When you specify the same page from the same file more
+ than once, qpdf will share objects between the pages. If you are
+ going to do further manipulation on the file and need the two
+ instances of the same original page to be deep copies, then you
+ can specify the file in two different ways. For example
+ <command>qpdf in.pdf --pages . 1 ./in.pdf 1 -- out.pdf</command>
+ would create a file with two copies of the first page of the
+ input, and the two copies would share any objects in common. This
+ includes fonts, images, and anything else the page references.
</para>
</sect1>
<sect1 id="ref.overlay-underlay">
diff --git a/qpdf/qtest/qpdf.test b/qpdf/qtest/qpdf.test
index e012b202..788ef2dc 100644
--- a/qpdf/qtest/qpdf.test
+++ b/qpdf/qtest/qpdf.test
@@ -2057,7 +2057,7 @@ foreach my $f (qw(page_api_2 direct-pages))
show_ntests();
# ----------
$td->notify("--- Merging and Splitting ---");
-$n_tests += 24;
+$n_tests += 26;
# Select pages from the same file multiple times including selecting
# twice from an encrypted file and specifying the password only the
@@ -2200,6 +2200,19 @@ $td->runtest("check output",
{$td->FILE => "a.pdf"},
{$td->FILE => "duplicate-pages.pdf"});
+# See https://github.com/qpdf/qpdf/issues/399 -- we don't want to
+# break this, especially if we ever implement deduplication of
+# identical streams.
+$td->runtest("force full page duplication",
+ {$td->COMMAND => "qpdf --static-id minimal.pdf" .
+ " --pages . ./minimal.pdf -- a.pdf"},
+ {$td->STRING => "", $td->EXIT_STATUS => 0},
+ $td->NORMALIZE_NEWLINES);
+$td->runtest("check output",
+ {$td->FILE => "a.pdf"},
+ {$td->FILE => "deep-duplicate-pages.pdf"});
+
+
show_ntests();
# ----------
$td->notify("--- Collating ---");
diff --git a/qpdf/qtest/qpdf/deep-duplicate-pages.pdf b/qpdf/qtest/qpdf/deep-duplicate-pages.pdf
new file mode 100644
index 00000000..2d273765
--- /dev/null
+++ b/qpdf/qtest/qpdf/deep-duplicate-pages.pdf
Binary files differ