Commit 08379321645133ba74dad4ce130055c087130bab
1 parent
893d38b8
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.
Showing
3 changed files
with
24 additions
and
2 deletions
manual/qpdf-manual.xml
| ... | ... | @@ -1588,7 +1588,16 @@ outfile.pdf</option> |
| 1588 | 1588 | Prior to version 8.4, it was not possible to specify the same page |
| 1589 | 1589 | from the same file directly more than once, and the workaround of |
| 1590 | 1590 | specifying the same file in more than one way was required. |
| 1591 | - Version 8.4 removes this limitation. | |
| 1591 | + Version 8.4 removes this limitation, but there is still a valid | |
| 1592 | + use case. When you specify the same page from the same file more | |
| 1593 | + than once, qpdf will share objects between the pages. If you are | |
| 1594 | + going to do further manipulation on the file and need the two | |
| 1595 | + instances of the same original page to be deep copies, then you | |
| 1596 | + can specify the file in two different ways. For example | |
| 1597 | + <command>qpdf in.pdf --pages . 1 ./in.pdf 1 -- out.pdf</command> | |
| 1598 | + would create a file with two copies of the first page of the | |
| 1599 | + input, and the two copies would share any objects in common. This | |
| 1600 | + includes fonts, images, and anything else the page references. | |
| 1592 | 1601 | </para> |
| 1593 | 1602 | </sect1> |
| 1594 | 1603 | <sect1 id="ref.overlay-underlay"> | ... | ... |
qpdf/qtest/qpdf.test
| ... | ... | @@ -2057,7 +2057,7 @@ foreach my $f (qw(page_api_2 direct-pages)) |
| 2057 | 2057 | show_ntests(); |
| 2058 | 2058 | # ---------- |
| 2059 | 2059 | $td->notify("--- Merging and Splitting ---"); |
| 2060 | -$n_tests += 24; | |
| 2060 | +$n_tests += 26; | |
| 2061 | 2061 | |
| 2062 | 2062 | # Select pages from the same file multiple times including selecting |
| 2063 | 2063 | # twice from an encrypted file and specifying the password only the |
| ... | ... | @@ -2200,6 +2200,19 @@ $td->runtest("check output", |
| 2200 | 2200 | {$td->FILE => "a.pdf"}, |
| 2201 | 2201 | {$td->FILE => "duplicate-pages.pdf"}); |
| 2202 | 2202 | |
| 2203 | +# See https://github.com/qpdf/qpdf/issues/399 -- we don't want to | |
| 2204 | +# break this, especially if we ever implement deduplication of | |
| 2205 | +# identical streams. | |
| 2206 | +$td->runtest("force full page duplication", | |
| 2207 | + {$td->COMMAND => "qpdf --static-id minimal.pdf" . | |
| 2208 | + " --pages . ./minimal.pdf -- a.pdf"}, | |
| 2209 | + {$td->STRING => "", $td->EXIT_STATUS => 0}, | |
| 2210 | + $td->NORMALIZE_NEWLINES); | |
| 2211 | +$td->runtest("check output", | |
| 2212 | + {$td->FILE => "a.pdf"}, | |
| 2213 | + {$td->FILE => "deep-duplicate-pages.pdf"}); | |
| 2214 | + | |
| 2215 | + | |
| 2203 | 2216 | show_ntests(); |
| 2204 | 2217 | # ---------- |
| 2205 | 2218 | $td->notify("--- Collating ---"); | ... | ... |
qpdf/qtest/qpdf/deep-duplicate-pages.pdf
0 → 100644
No preview for this file type