From 16fd6e64f947e17144e05325e51d792df33eaa61 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Fri, 4 Jan 2019 12:32:02 -0500 Subject: Add QPDFWriter::getFinalVersion (fixes #266) --- include/qpdf/QPDFWriter.hh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'include') diff --git a/include/qpdf/QPDFWriter.hh b/include/qpdf/QPDFWriter.hh index 4385a409..8f18dad1 100644 --- a/include/qpdf/QPDFWriter.hh +++ b/include/qpdf/QPDFWriter.hh @@ -404,6 +404,18 @@ class QPDFWriter QPDF_DLL void registerProgressReporter(PointerHolder); + // Return the PDF version that will be written into the header. + // Calling this method does all the preparation for writing, so it + // is an error to call any methods that may cause a change to the + // version. Adding new objects to the original file after calling + // this may also cause problems. It is safe to update existing + // objects or stream contents after calling this method, e.g., to + // include the final version number in metadata. + QPDF_DLL + std::string getFinalVersion(); + + // Write the final file. There is no expectation of being able to + // call write() more than once. QPDF_DLL void write(); @@ -473,6 +485,7 @@ class QPDFWriter void writeLinearized(); void enqueuePart(std::vector& part); void writeEncryptionDictionary(); + void doWriteSetup(); void writeHeader(); void writeHintStream(int hint_id); qpdf_offset_t writeXRefTable( @@ -598,6 +611,7 @@ class QPDFWriter bool deterministic_id; Pl_MD5* md5_pipeline; std::string deterministic_id_data; + bool did_write_setup; // For linearization only std::string lin_pass1_filename; -- cgit v1.2.3-54-g00ecf