From 9ebabd19538512b6515696b164a17b90060a75c3 Mon Sep 17 00:00:00 2001 From: m-holger Date: Mon, 26 Sep 2022 18:27:25 +0100 Subject: Add new methods QPDF::newStream --- include/qpdf/QPDF.hh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'include') diff --git a/include/qpdf/QPDF.hh b/include/qpdf/QPDF.hh index f3160bf9..06afc44f 100644 --- a/include/qpdf/QPDF.hh +++ b/include/qpdf/QPDF.hh @@ -382,6 +382,36 @@ class QPDF QPDF_DLL std::map getXRefTable(); + // Public factory methods + + // Create a new stream. A subsequent call must be made to + // replaceStreamData() to provide data for the stream. The stream's + // dictionary may be retrieved by calling getDict(), and the resulting + // dictionary may be modified. Alternatively, you can create a new + // dictionary and call replaceDict to install it. + QPDF_DLL + QPDFObjectHandle newStream(); + + // Create a new stream. Use the given buffer as the stream data. The + // stream dictionary's /Length key will automatically be set to the size of + // the data buffer. If additional keys are required, the stream's + // dictionary may be retrieved by calling getDict(), and the resulting + // dictionary may be modified. This method is just a convenient wrapper + // around the newStream() and replaceStreamData(). It is a convenience + // methods for streams that require no parameters beyond the stream length. + // Note that you don't have to deal with compression yourself if you use + // QPDFWriter. By default, QPDFWriter will automatically compress + // uncompressed stream data. Example programs are provided that + // illustrate this. + QPDF_DLL + QPDFObjectHandle newStream(std::shared_ptr data); + + // Create new stream with data from string. This method will + // create a copy of the data rather than using the user-provided + // buffer as in the std::shared_ptr version of newStream. + QPDF_DLL + QPDFObjectHandle newStream(std::string const& data); + // Install this object handle as an indirect object and return an // indirect reference to it. QPDF_DLL -- cgit v1.2.3-70-g09d2