summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--include/qpdf/QPDF.hh13
-rw-r--r--libqpdf/QPDF.cc12
-rw-r--r--manual/qpdf-manual.xml16
4 files changed, 46 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 0efdebec..e07bca21 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2019-08-31 Jay Berkenbilt <ejb@ql.org>
+ * Add QPDF::anyWarnings() method to find out whether there have
+ been any warnings without resetting the list.
+
+ * Add QPDF::closeInputSource() method to release the input source
+ so the input file can be deleted or renamed.
+
* Add methods rename_file and remove_file to QUtil.
2019-08-24 Jay Berkenbilt <ejb@ql.org>
diff --git a/include/qpdf/QPDF.hh b/include/qpdf/QPDF.hh
index c488e0b1..736e1676 100644
--- a/include/qpdf/QPDF.hh
+++ b/include/qpdf/QPDF.hh
@@ -101,6 +101,14 @@ class QPDF
void processInputSource(PointerHolder<InputSource>,
char const* password = 0);
+ // Close or otherwise release the input source. Once this has been
+ // called, no other methods of qpdf can be called safely except
+ // for getWarnings and anyWarnings(). After this has been called,
+ // it is safe to perform operations on the input file such as
+ // deleting or renaming it.
+ QPDF_DLL
+ void closeInputSource();
+
// For certain forensic or investigatory purposes, it may
// sometimes be useful to specify the encryption key directly,
// even though regular PDF applications do not provide a way to do
@@ -206,6 +214,11 @@ class QPDF
QPDF_DLL
std::vector<QPDFExc> getWarnings();
+ // Indicate whether any warnings have been issued so far. Does not
+ // clear the list of warnings.
+ QPDF_DLL
+ bool anyWarnings() const;
+
// Return an application-scoped unique ID for this QPDF object.
// This is not a globally unique ID. It is constructing using a
// timestamp and a random number and is intended to be unique
diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc
index a774bd42..57f57d27 100644
--- a/libqpdf/QPDF.cc
+++ b/libqpdf/QPDF.cc
@@ -240,6 +240,12 @@ QPDF::processInputSource(PointerHolder<InputSource> source,
}
void
+QPDF::closeInputSource()
+{
+ this->m->file = 0;
+}
+
+void
QPDF::setPasswordIsHexKey(bool val)
{
this->m->provided_password_is_hex_key = val;
@@ -291,6 +297,12 @@ QPDF::getWarnings()
}
bool
+QPDF::anyWarnings() const
+{
+ return ! this->m->warnings.empty();
+}
+
+bool
QPDF::findHeader()
{
qpdf_offset_t global_offset = this->m->file->tell();
diff --git a/manual/qpdf-manual.xml b/manual/qpdf-manual.xml
index 4f3b54ae..bfdefc41 100644
--- a/manual/qpdf-manual.xml
+++ b/manual/qpdf-manual.xml
@@ -4429,7 +4429,7 @@ print "\n";
</listitem>
<listitem>
<para>
- the
+ The
<option>--compression-level=<replaceable>level</replaceable></option>
sets the zlib compression level used for any streams
compressed by <literal>/FlateDecode</literal>. Most
@@ -4459,6 +4459,20 @@ print "\n";
</listitem>
<listitem>
<para>
+ Method <function>QPDF::anyWarnings</function> tells whether
+ there have been any warnings without clearing the list of
+ warnings.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Method <function>QPDF::closeInputSource</function> closes or
+ otherwise releases the input source. This enables the input
+ file to be deleted or renamed.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
New methods have been added to <classname>QUtil</classname>
for converting back and forth between strings and unsigned
integers: <function>uint_to_string</function>,