2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 19:08:59 +00:00

Add methods QPDF::anyWarnings and QPDF::closeInputSource

This commit is contained in:
Jay Berkenbilt 2019-08-31 15:10:29 -04:00
parent 41b5c46497
commit babd12c9b2
4 changed files with 46 additions and 1 deletions

View File

@ -1,5 +1,11 @@
2019-08-31 Jay Berkenbilt <ejb@ql.org> 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. * Add methods rename_file and remove_file to QUtil.
2019-08-24 Jay Berkenbilt <ejb@ql.org> 2019-08-24 Jay Berkenbilt <ejb@ql.org>

View File

@ -101,6 +101,14 @@ class QPDF
void processInputSource(PointerHolder<InputSource>, void processInputSource(PointerHolder<InputSource>,
char const* password = 0); 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 // For certain forensic or investigatory purposes, it may
// sometimes be useful to specify the encryption key directly, // sometimes be useful to specify the encryption key directly,
// even though regular PDF applications do not provide a way to do // even though regular PDF applications do not provide a way to do
@ -206,6 +214,11 @@ class QPDF
QPDF_DLL QPDF_DLL
std::vector<QPDFExc> getWarnings(); 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. // Return an application-scoped unique ID for this QPDF object.
// This is not a globally unique ID. It is constructing using a // This is not a globally unique ID. It is constructing using a
// timestamp and a random number and is intended to be unique // timestamp and a random number and is intended to be unique

View File

@ -239,6 +239,12 @@ QPDF::processInputSource(PointerHolder<InputSource> source,
parse(password); parse(password);
} }
void
QPDF::closeInputSource()
{
this->m->file = 0;
}
void void
QPDF::setPasswordIsHexKey(bool val) QPDF::setPasswordIsHexKey(bool val)
{ {
@ -290,6 +296,12 @@ QPDF::getWarnings()
return result; return result;
} }
bool
QPDF::anyWarnings() const
{
return ! this->m->warnings.empty();
}
bool bool
QPDF::findHeader() QPDF::findHeader()
{ {

View File

@ -4429,7 +4429,7 @@ print "\n";
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
the The
<option>--compression-level=<replaceable>level</replaceable></option> <option>--compression-level=<replaceable>level</replaceable></option>
sets the zlib compression level used for any streams sets the zlib compression level used for any streams
compressed by <literal>/FlateDecode</literal>. Most compressed by <literal>/FlateDecode</literal>. Most
@ -4457,6 +4457,20 @@ print "\n";
additional details. additional details.
</para> </para>
</listitem> </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> <listitem>
<para> <para>
New methods have been added to <classname>QUtil</classname> New methods have been added to <classname>QUtil</classname>