Reset state in QPDF::calculateLinearizationData

This makes it possible to use two different writers to write
linearized files from the same QPDF object.
This commit is contained in:
Jay Berkenbilt 2012-09-06 15:28:16 -04:00
parent 8d2b29ef98
commit fc4c82a950
2 changed files with 15 additions and 0 deletions

View File

@ -1,5 +1,10 @@
2012-09-06 Jay Berkenbilt <ejb@ql.org>
* Make it possible to write the same QPDF object with two
different QPDFWriter objects that have both called
setLinearization(true) by making private method
QPDF::calculateLinearizationData() properly initialize its state.
* Bug fix: Writing after calling QPDFWriter::setOutputMemory()
would cause a segmentation fault because of an internal field not
being initialized, rendering that method useless. This has been

View File

@ -1241,6 +1241,16 @@ QPDF::calculateLinearizationData(std::map<int, int> const& object_stream_data)
// * outlines: part 6 or 9
this->part4.clear();
this->part6.clear();
this->part7.clear();
this->part8.clear();
this->part9.clear();
this->c_linp = LinParameters();
this->c_page_offset_data = CHPageOffset();
this->c_shared_object_data = CHSharedObject();
this->c_outline_data = HGeneric();
QPDFObjectHandle root = getRoot();
bool outlines_in_first_page = false;
QPDFObjectHandle pagemode = root.getKey("/PageMode");