2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 02:49:00 +00:00

checkpoint -- will have to finish another day

git-svn-id: svn+q:///qpdf/trunk@661 71b93d88-0707-0410-a8cf-f5a4172ac649
This commit is contained in:
Jay Berkenbilt 2009-03-09 01:11:06 +00:00
parent 599daddb47
commit 2af08ee398
5 changed files with 29 additions and 12 deletions

View File

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

View File

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

View File

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

View File

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

View File

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