Switch from parseContentStream to parsePageContents

This commit is contained in:
Jay Berkenbilt 2018-01-30 21:39:38 -05:00
parent fcd611b61e
commit 6afe83978f
7 changed files with 13 additions and 12 deletions

View File

@ -57,6 +57,11 @@
problems are encountered as the error messages can include
information about which page the streams come from.
* Update content stream parsing example
(examples/pdf-parse-content.cc) to use new
QPDFObjectHandle::parsePageContents() method in favor of the older
QPDFObjectHandle::parseContentStream() method.
2018-02-04 Jay Berkenbilt <ejb@ql.org>
* Add QPDFWriter::setLinearizationPass1Filename method and

View File

@ -75,9 +75,8 @@ int main(int argc, char* argv[])
}
QPDFObjectHandle page = pages.at(pageno-1);
QPDFObjectHandle contents = page.getKey("/Contents");
ParserCallbacks cb;
QPDFObjectHandle::parseContentStream(contents, &cb);
page.parsePageContents(&cb);
}
catch (std::exception& e)
{

View File

@ -1769,9 +1769,7 @@ static void do_check(QPDF& pdf, Options& o, int& exit_code)
++pageno;
try
{
QPDFObjectHandle::parseContentStream(
(*iter).getKey("/Contents"),
&discard_contents);
(*iter).parsePageContents(&discard_contents);
}
catch (QPDFExc& e)
{

View File

@ -2,6 +2,6 @@ checking content-stream-errors.pdf
PDF Version: 1.3
File is not encrypted
File is not linearized
page 1: content stream objects 7 0 (content, file position 52): parse error while reading object
page 3: content stream objects 15 0 (stream data, file position 117): EOF found while reading inline image
page 4: content stream objects 19 0 (content, file position 53): parse error while reading object
page 1: page object 3 0 stream 7 0 (content, file position 52): parse error while reading object
page 3: page object 5 0 stream 15 0 (stream data, file position 117): EOF found while reading inline image
page 4: page object 6 0 stream 19 0 (content, file position 53): parse error while reading object

View File

@ -22,4 +22,4 @@ name: /Fl
name: /DP
dictionary: << /Columns 1 /Predictor 15 >>
operator: ID
content stream objects 4 0 (stream data, file position 139): EOF found while reading inline image
page object 3 0 stream 4 0 (stream data, file position 139): EOF found while reading inline image

View File

@ -4,6 +4,6 @@ File is not encrypted
File is not linearized
WARNING: split-content-stream-errors.pdf (file position 557): error decoding stream data for object 6 0: LZWDecoder: bad code received
WARNING: split-content-stream-errors.pdf (file position 557): stream will be re-processed without filtering to avoid data loss
WARNING: content stream objects (item index 0 (from 0)): ignoring non-stream in an array of streams
WARNING: page object 3 0 (item index 0 (from 0)): ignoring non-stream in an array of streams
WARNING: split-content-stream-errors.pdf (file position 557): error decoding stream data for object 6 0: LZWDecoder: bad code received
WARNING: content stream (content stream object 6 0): errors while decoding content stream

View File

@ -1296,9 +1296,8 @@ void runtest(int n, char const* filename1, char const* arg2)
iter != pages.end(); ++iter)
{
QPDFObjectHandle page = *iter;
QPDFObjectHandle contents = page.getKey("/Contents");
ParserCallbacks cb;
QPDFObjectHandle::parseContentStream(contents, &cb);
page.parsePageContents(&cb);
}
}
else if (n == 38)