diff --git a/ChangeLog b/ChangeLog index d93ed079..ff2b959b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,8 +8,8 @@ structure of file, attempt to decode all stream data. * libqpdf/QPDFWriter.cc (QPDFWriter::writeObject): In QDF mode, - write a comment to the QDF file that indicates the object ID from - the original file. + write a comment to the QDF file before each object that indicates + the object ID of the corresponding object from the original file. * libqpdf/QPDF.cc (QPDF::pipeStreamData): Issue a warning instead of failing if there is a problem found while decoding stream. diff --git a/qpdf/qpdf.cc b/qpdf/qpdf.cc index 279eef33..7429881d 100644 --- a/qpdf/qpdf.cc +++ b/qpdf/qpdf.cc @@ -455,7 +455,7 @@ int main(int argc, char* argv[]) // 1 2 3 4 5 6 7 8 // 12345678901234567890123456789012345678901234567890123456789012345678901234567890 std::cout - << whoami << " version 2.0.4" << std::endl + << whoami << " version 2.0.4+" << std::endl << "Copyright (c) 2005-2009 Jay Berkenbilt" << std::endl << "This software may be distributed under the terms of version 2 of the" @@ -952,6 +952,8 @@ int main(int argc, char* argv[]) } if (! pdf.getWarnings().empty()) { + std::cerr << whoami << ": operation succeeded with warnings;" + << " resulting file may have some problems" << std::endl; exit(EXIT_WARNING); } } diff --git a/qpdf/qtest/qpdf.test b/qpdf/qtest/qpdf.test index 0751afbd..2b59b70d 100644 --- a/qpdf/qtest/qpdf.test +++ b/qpdf/qtest/qpdf.test @@ -282,8 +282,8 @@ check_pdf("no recompression", show_ntests(); # ---------- $td->notify("--- Object Stream Tests ---"); -$n_tests += 36 * 6; -$n_compare_pdfs += 36; +$n_tests += (36 * 4) + (12 * 2); +$n_compare_pdfs += 36 + 12; for (my $n = 16; $n <= 19; ++$n) { @@ -294,13 +294,23 @@ for (my $n = 16; $n <= 19; ++$n) { foreach my $qdf ('-qdf', '', '-encrypt "" x 128 --') { - # 6 tests + 1 compare_pdfs + # 4 tests + 1 compare_pdfs * 36 cases + # 2 tests + 1 compare_pdfs * 12 cases $td->runtest("object stream mode", {$td->COMMAND => "qpdf --static-id $flags $qdf $in a.pdf"}, {$td->STRING => "", $td->EXIT_STATUS => 0}); compare_pdfs("good$n.pdf", "a.pdf"); + if ($qdf eq '-qdf') + { + $td->runtest("fix-qdf identity check", + {$td->COMMAND => "fix-qdf a.pdf >| b.pdf"}, + {$td->STRING => "", $td->EXIT_STATUS => 0}); + $td->runtest("compare files", + {$td->FILE => "a.pdf"}, + {$td->FILE => "b.pdf"}); + } $td->runtest("convert to qdf", {$td->COMMAND => "qpdf --static-id -qdf -decrypt" . @@ -313,12 +323,15 @@ for (my $n = 16; $n <= 19; ++$n) " -object-streams=disable a.pdf b.qdf"}, {$td->STRING => "", $td->EXIT_STATUS => 0}); - $td->runtest("compare files", - {$td->FILE => "a.qdf"}, - {$td->FILE => "b.qdf"}); - $td->runtest("fix-qdf identity check", - {$td->COMMAND => "fix-qdf a.qdf >| b.pdf"}, - {$td->STRING => "", $td->EXIT_STATUS => 0}); + # XXX The comparison is broken because of the new original + # object comments. We need a script that compares qpdfs + # by normalizing those comments (like replacing the object + # IDs with nnn) and then diffs. That will work here and + # in some of the other failure cases. For the rest where + # we're actually checking the qdf itself, we will need to + # store the new qdf files with the object IDs. That can't + # be done blindly -- we need to make sure the output is + # correct! $td->runtest("compare files", {$td->FILE => "a.qdf"}, {$td->FILE => "b.qdf"}); diff --git a/qpdf/qtest/qpdf/append-page-content-damaged.out b/qpdf/qtest/qpdf/append-page-content-damaged.out index 0e30aece..a3916a1f 100644 --- a/qpdf/qtest/qpdf/append-page-content-damaged.out +++ b/qpdf/qtest/qpdf/append-page-content-damaged.out @@ -1,3 +1,4 @@ WARNING: append-page-content-damaged.pdf: offset 0: file is damaged WARNING: append-page-content-damaged.pdf: can't find startxref WARNING: Attempting to reconstruct cross-reference table +qpdf: operation succeeded with warnings; resulting file may have some problems diff --git a/qpdf/qtest/qpdf/heifer.out b/qpdf/qtest/qpdf/heifer.out index 5a9bb975..75012a18 100644 --- a/qpdf/qtest/qpdf/heifer.out +++ b/qpdf/qtest/qpdf/heifer.out @@ -2,3 +2,4 @@ WARNING: heifer.pdf: offset 0: file is damaged WARNING: heifer.pdf: offset 92741: xref not found WARNING: Attempting to reconstruct cross-reference table WARNING: heifer.pdf: offset 51: attempting to recover stream length +qpdf: operation succeeded with warnings; resulting file may have some problems