aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2009-10-05 02:42:48 +0200
committerJay Berkenbilt <ejb@ql.org>2009-10-05 02:42:48 +0200
commitc2023db265ea35ad7d0ab0cd989f16479bcb798d (patch)
treea4cbc126f6152a185ec10b58f5330c7bfbe5f90a /include
parentc1e53f148096c329650068694fbde82f018560bf (diff)
downloadqpdf-c2023db265ea35ad7d0ab0cd989f16479bcb798d.tar.zst
Implement changes suggested by Zarko and our subsequent conversations:
- Add a way to set the minimum PDF version - Add a way to force the PDF version - Have isEncrypted return true if an /Encrypt dictionary exists even when we can't read the file - Allow qpdf_init_write to be called multiple times - Update some comments in headers git-svn-id: svn+q:///qpdf/trunk@748 71b93d88-0707-0410-a8cf-f5a4172ac649
Diffstat (limited to 'include')
-rw-r--r--include/qpdf/QPDFWriter.hh33
-rw-r--r--include/qpdf/qpdf-c.h13
2 files changed, 44 insertions, 2 deletions
diff --git a/include/qpdf/QPDFWriter.hh b/include/qpdf/QPDFWriter.hh
index 7d62e476..b5f23457 100644
--- a/include/qpdf/QPDFWriter.hh
+++ b/include/qpdf/QPDFWriter.hh
@@ -34,7 +34,13 @@ class Pl_Count;
class QPDFWriter
{
public:
- // Passing null as filename means write to stdout
+ // Passing null as filename means write to stdout. QPDFWriter
+ // will create a zero-length output file upon construction. If
+ // write fails, the empty or partially written file will not be
+ // deleted. This is by design: sometimes the partial file may be
+ // useful for tracking down problems. If your application doesn't
+ // want the partially written file to be left behind, you should
+ // delete it the eventual call to write fails.
DLL_EXPORT
QPDFWriter(QPDF& pdf, char const* filename);
DLL_EXPORT
@@ -78,6 +84,30 @@ class QPDFWriter
DLL_EXPORT
void setQDFMode(bool);
+ // Set the minimum PDF version. If the PDF version of the input
+ // file (or previously set minimum version) is less than the
+ // version passed to this method, the PDF version of the output
+ // file will be set to this value. If the original PDF file's
+ // version or previously set minimum version is already this
+ // version or later, the original file's version will be used.
+ // QPDFWriter automatically sets the minimum version to 1.4 when
+ // R3 encryption parameters are used, and to 1.5 when object
+ // streams are used.
+ DLL_EXPORT
+ void setMinimumPDFVersion(std::string const&);
+
+ // Force the PDF version of the output file to be a given version.
+ // Use of this function may create PDF files that will not work
+ // properly with older PDF viewers. When a PDF version is set
+ // using this function, qpdf will use this version even if the
+ // file contains features that are not supported in that version
+ // of PDF. In other words, you should only use this function if
+ // you are sure the PDF file in question has no features of newer
+ // versions of PDF or if you are willing to create files that old
+ // viewers may try to open but not be able to properly interpret.
+ DLL_EXPORT
+ void forcePDFVersion(std::string const&);
+
// Cause a static /ID value to be generated. Use only in test
// suites.
DLL_EXPORT
@@ -241,6 +271,7 @@ class QPDFWriter
std::string id1; // for /ID key of
std::string id2; // trailer dictionary
std::string min_pdf_version;
+ std::string forced_pdf_version;
int encryption_dict_objid;
std::string cur_data_key;
std::list<PointerHolder<Pipeline> > to_delete;
diff --git a/include/qpdf/qpdf-c.h b/include/qpdf/qpdf-c.h
index 11dae4f1..fab8112b 100644
--- a/include/qpdf/qpdf-c.h
+++ b/include/qpdf/qpdf-c.h
@@ -189,7 +189,12 @@ extern "C" {
/* Supply the name of the file to be written and initialize the
* qpdf_data object to handle writing operations. This function
* also attempts to create the file. The PDF data is not written
- * until the call to qpdf_write.
+ * until the call to qpdf_write. qpdf_init_write may be called
+ * multiple times for the same qpdf_data object. When
+ * qpdf_init_write is called, all information from previous calls
+ * to functions that set write parameters (qpdf_set_linearization,
+ * etc.) is lost, so any write parameter functions must be called
+ * again.
*/
DLL_EXPORT
QPDF_ERROR_CODE qpdf_init_write(qpdf_data qpdf, char const* filename);
@@ -256,6 +261,12 @@ extern "C" {
DLL_EXPORT
void qpdf_set_linearization(qpdf_data qpdf, QPDF_BOOL value);
+ DLL_EXPORT
+ void qpdf_set_minimum_pdf_version(qpdf_data qpdf, char const* version);
+
+ DLL_EXPORT
+ void qpdf_force_pdf_version(qpdf_data qpdf, char const* version);
+
/* Do actual write operation. */
DLL_EXPORT
QPDF_ERROR_CODE qpdf_write(qpdf_data qpdf);