aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2020-10-23 20:25:21 +0200
committerJay Berkenbilt <ejb@ql.org>2020-10-23 22:27:51 +0200
commitf8e4b6161cce4d851222dababb2c8c96e4b1c864 (patch)
tree78e1e085f30767becfee7f8d2919e1c6d39bd2a9
parente3248a8cd1bcaba6322af828148cbaf415307e5c (diff)
downloadqpdf-f8e4b6161cce4d851222dababb2c8c96e4b1c864.tar.zst
With --no-warn, suppress warnings in split-pages
Warnings issued on the output QPDF object were not suppressing warnings since that option was only set on the input QPDF object.
-rw-r--r--qpdf/qpdf.cc4
-rw-r--r--qpdf/qtest/qpdf.test9
2 files changed, 12 insertions, 1 deletions
diff --git a/qpdf/qpdf.cc b/qpdf/qpdf.cc
index 86cd6ad7..a1f9de8a 100644
--- a/qpdf/qpdf.cc
+++ b/qpdf/qpdf.cc
@@ -5593,6 +5593,10 @@ static void do_split_pages(QPDF& pdf, Options& o)
}
QPDF outpdf;
outpdf.emptyPDF();
+ if (o.suppress_warnings)
+ {
+ outpdf.setSuppressWarnings(true);
+ }
for (size_t pageno = first; pageno <= last; ++pageno)
{
QPDFObjectHandle page = pages.at(pageno - 1);
diff --git a/qpdf/qtest/qpdf.test b/qpdf/qtest/qpdf.test
index 75021b56..60e5ba07 100644
--- a/qpdf/qtest/qpdf.test
+++ b/qpdf/qtest/qpdf.test
@@ -1724,7 +1724,7 @@ my @sp_cases = (
[1, 'broken data', '--pages broken-lzw.pdf --', 'split-out.pdf',
{$td->FILE => "broken-lzw.out", $td->EXIT_STATUS => 3}],
);
-$n_tests += 35;
+$n_tests += 36;
$n_compare_pdfs += 1;
for (@sp_cases)
{
@@ -1845,6 +1845,13 @@ $td->runtest("unreferenced resources with bad token",
$td->runtest("check output",
{$td->FILE => "split-out-bad-token-1-2.pdf"},
{$td->FILE => "split-tokens-split-1-2.pdf"});
+$td->runtest("--no-warn with proxied warnings during split",
+ {$td->COMMAND =>
+ "qpdf --qdf --static-id --split-pages=2" .
+ " --no-warn --remove-unreferenced-resources=yes" .
+ " split-tokens.pdf split-out-bad-token.pdf"},
+ {$td->STRING => "", $td->EXIT_STATUS => 3},
+ $td->NORMALIZE_NEWLINES);
$td->runtest("shared images in form xobject",
{$td->COMMAND => "qpdf --qdf --static-id --split-pages".