diff options
-rw-r--r-- | manual/qpdf-manual.xml | 11 | ||||
-rw-r--r-- | qpdf/qtest/qpdf.test | 15 | ||||
-rw-r--r-- | qpdf/qtest/qpdf/deep-duplicate-pages.pdf | bin | 0 -> 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 Binary files differnew file mode 100644 index 00000000..2d273765 --- /dev/null +++ b/qpdf/qtest/qpdf/deep-duplicate-pages.pdf |