2
1
mirror of https://github.com/qpdf/qpdf.git synced 2025-02-02 11:58:25 +00:00

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.
This commit is contained in:
Jay Berkenbilt 2020-10-23 14:25:21 -04:00
parent e3248a8cd1
commit f8e4b6161c
2 changed files with 12 additions and 1 deletions

View File

@ -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);

View File

@ -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".