Commit 748ab301d4f17c77393b08de4ef541b957bde275
1 parent
eff113fa
go back to function-based DLL_EXPORT rather than class-based to avoid creation o…
…f export files with executables under msvc git-svn-id: svn+q:///qpdf/trunk@849 71b93d88-0707-0410-a8cf-f5a4172ac649
Showing
26 changed files
with
266 additions
and
26 deletions
README.windows
| @@ -68,6 +68,12 @@ and then | @@ -68,6 +68,12 @@ and then | ||
| 68 | 68 | ||
| 69 | make | 69 | make |
| 70 | 70 | ||
| 71 | +NOTE: automated dependencies are not generated with the msvc build. | ||
| 72 | +If you're planning on making modifications, you should probably work | ||
| 73 | +with mingw. If there is a need, I can add dependency information to | ||
| 74 | +the msvc build, but since I only use it for generating release | ||
| 75 | +versions, I haven't bothered. | ||
| 76 | + | ||
| 71 | The -DHAVE_VSNPRINTF is really only required for things that include | 77 | The -DHAVE_VSNPRINTF is really only required for things that include |
| 72 | zutil.h from zlib. You don't have to worry about this when compiling | 78 | zutil.h from zlib. You don't have to worry about this when compiling |
| 73 | against qpdf with MSVC -- only when building zlib. It's harmless to | 79 | against qpdf with MSVC -- only when building zlib. It's harmless to |
include/qpdf/Buffer.hh
| @@ -10,16 +10,24 @@ | @@ -10,16 +10,24 @@ | ||
| 10 | 10 | ||
| 11 | #include <qpdf/DLL.h> | 11 | #include <qpdf/DLL.h> |
| 12 | 12 | ||
| 13 | -class DLL_EXPORT Buffer | 13 | +class Buffer |
| 14 | { | 14 | { |
| 15 | public: | 15 | public: |
| 16 | + DLL_EXPORT | ||
| 16 | Buffer(); | 17 | Buffer(); |
| 18 | + DLL_EXPORT | ||
| 17 | Buffer(unsigned long size); | 19 | Buffer(unsigned long size); |
| 20 | + DLL_EXPORT | ||
| 18 | Buffer(Buffer const&); | 21 | Buffer(Buffer const&); |
| 22 | + DLL_EXPORT | ||
| 19 | Buffer& operator=(Buffer const&); | 23 | Buffer& operator=(Buffer const&); |
| 24 | + DLL_EXPORT | ||
| 20 | ~Buffer(); | 25 | ~Buffer(); |
| 26 | + DLL_EXPORT | ||
| 21 | unsigned long getSize() const; | 27 | unsigned long getSize() const; |
| 28 | + DLL_EXPORT | ||
| 22 | unsigned char const* getBuffer() const; | 29 | unsigned char const* getBuffer() const; |
| 30 | + DLL_EXPORT | ||
| 23 | unsigned char* getBuffer(); | 31 | unsigned char* getBuffer(); |
| 24 | 32 | ||
| 25 | private: | 33 | private: |
include/qpdf/Pipeline.hh
| @@ -33,20 +33,25 @@ | @@ -33,20 +33,25 @@ | ||
| 33 | #include <qpdf/DLL.h> | 33 | #include <qpdf/DLL.h> |
| 34 | #include <string> | 34 | #include <string> |
| 35 | 35 | ||
| 36 | -class DLL_EXPORT Pipeline | 36 | +class Pipeline |
| 37 | { | 37 | { |
| 38 | public: | 38 | public: |
| 39 | + DLL_EXPORT | ||
| 39 | Pipeline(char const* identifier, Pipeline* next); | 40 | Pipeline(char const* identifier, Pipeline* next); |
| 40 | 41 | ||
| 42 | + DLL_EXPORT | ||
| 41 | virtual ~Pipeline(); | 43 | virtual ~Pipeline(); |
| 42 | 44 | ||
| 43 | // Subclasses should implement write and finish to do their jobs | 45 | // Subclasses should implement write and finish to do their jobs |
| 44 | // and then, if they are not end-of-line pipelines, call | 46 | // and then, if they are not end-of-line pipelines, call |
| 45 | // getNext()->write or getNext()->finish. | 47 | // getNext()->write or getNext()->finish. |
| 48 | + DLL_EXPORT | ||
| 46 | virtual void write(unsigned char* data, int len) = 0; | 49 | virtual void write(unsigned char* data, int len) = 0; |
| 50 | + DLL_EXPORT | ||
| 47 | virtual void finish() = 0; | 51 | virtual void finish() = 0; |
| 48 | 52 | ||
| 49 | protected: | 53 | protected: |
| 54 | + DLL_EXPORT | ||
| 50 | Pipeline* getNext(bool allow_null = false); | 55 | Pipeline* getNext(bool allow_null = false); |
| 51 | std::string identifier; | 56 | std::string identifier; |
| 52 | 57 |
include/qpdf/Pl_Buffer.hh
| @@ -24,17 +24,22 @@ | @@ -24,17 +24,22 @@ | ||
| 24 | #include <qpdf/Buffer.hh> | 24 | #include <qpdf/Buffer.hh> |
| 25 | #include <list> | 25 | #include <list> |
| 26 | 26 | ||
| 27 | -class DLL_EXPORT Pl_Buffer: public Pipeline | 27 | +class Pl_Buffer: public Pipeline |
| 28 | { | 28 | { |
| 29 | public: | 29 | public: |
| 30 | + DLL_EXPORT | ||
| 30 | Pl_Buffer(char const* identifier, Pipeline* next = 0); | 31 | Pl_Buffer(char const* identifier, Pipeline* next = 0); |
| 32 | + DLL_EXPORT | ||
| 31 | virtual ~Pl_Buffer(); | 33 | virtual ~Pl_Buffer(); |
| 34 | + DLL_EXPORT | ||
| 32 | virtual void write(unsigned char*, int); | 35 | virtual void write(unsigned char*, int); |
| 36 | + DLL_EXPORT | ||
| 33 | virtual void finish(); | 37 | virtual void finish(); |
| 34 | 38 | ||
| 35 | // Each call to getBuffer() resets this object -- see notes above. | 39 | // Each call to getBuffer() resets this object -- see notes above. |
| 36 | // The caller is responsible for deleting the returned Buffer | 40 | // The caller is responsible for deleting the returned Buffer |
| 37 | // object. | 41 | // object. |
| 42 | + DLL_EXPORT | ||
| 38 | Buffer* getBuffer(); | 43 | Buffer* getBuffer(); |
| 39 | 44 | ||
| 40 | private: | 45 | private: |
include/qpdf/Pl_Count.hh
| @@ -13,17 +13,24 @@ | @@ -13,17 +13,24 @@ | ||
| 13 | 13 | ||
| 14 | #include <qpdf/Pipeline.hh> | 14 | #include <qpdf/Pipeline.hh> |
| 15 | 15 | ||
| 16 | -class DLL_EXPORT Pl_Count: public Pipeline | 16 | +class Pl_Count: public Pipeline |
| 17 | { | 17 | { |
| 18 | public: | 18 | public: |
| 19 | + DLL_EXPORT | ||
| 19 | Pl_Count(char const* identifier, Pipeline* next); | 20 | Pl_Count(char const* identifier, Pipeline* next); |
| 21 | + DLL_EXPORT | ||
| 20 | virtual ~Pl_Count(); | 22 | virtual ~Pl_Count(); |
| 23 | + DLL_EXPORT | ||
| 21 | virtual void write(unsigned char*, int); | 24 | virtual void write(unsigned char*, int); |
| 25 | + DLL_EXPORT | ||
| 22 | virtual void finish(); | 26 | virtual void finish(); |
| 27 | + DLL_EXPORT | ||
| 23 | // Returns the number of bytes written | 28 | // Returns the number of bytes written |
| 29 | + DLL_EXPORT | ||
| 24 | int getCount() const; | 30 | int getCount() const; |
| 25 | // Returns the last character written, or '\0' if no characters | 31 | // Returns the last character written, or '\0' if no characters |
| 26 | // have been written (in which case getCount() returns 0) | 32 | // have been written (in which case getCount() returns 0) |
| 33 | + DLL_EXPORT | ||
| 27 | unsigned char getLastChar() const; | 34 | unsigned char getLastChar() const; |
| 28 | 35 | ||
| 29 | private: | 36 | private: |
include/qpdf/Pl_Discard.hh
| @@ -16,12 +16,16 @@ | @@ -16,12 +16,16 @@ | ||
| 16 | 16 | ||
| 17 | #include <qpdf/Pipeline.hh> | 17 | #include <qpdf/Pipeline.hh> |
| 18 | 18 | ||
| 19 | -class DLL_EXPORT Pl_Discard: public Pipeline | 19 | +class Pl_Discard: public Pipeline |
| 20 | { | 20 | { |
| 21 | public: | 21 | public: |
| 22 | + DLL_EXPORT | ||
| 22 | Pl_Discard(); | 23 | Pl_Discard(); |
| 24 | + DLL_EXPORT | ||
| 23 | virtual ~Pl_Discard(); | 25 | virtual ~Pl_Discard(); |
| 26 | + DLL_EXPORT | ||
| 24 | virtual void write(unsigned char*, int); | 27 | virtual void write(unsigned char*, int); |
| 28 | + DLL_EXPORT | ||
| 25 | virtual void finish(); | 29 | virtual void finish(); |
| 26 | }; | 30 | }; |
| 27 | 31 |
include/qpdf/Pl_Flate.hh
| @@ -12,18 +12,22 @@ | @@ -12,18 +12,22 @@ | ||
| 12 | 12 | ||
| 13 | #include <zlib.h> | 13 | #include <zlib.h> |
| 14 | 14 | ||
| 15 | -class DLL_EXPORT Pl_Flate: public Pipeline | 15 | +class Pl_Flate: public Pipeline |
| 16 | { | 16 | { |
| 17 | public: | 17 | public: |
| 18 | static int const def_bufsize = 65536; | 18 | static int const def_bufsize = 65536; |
| 19 | 19 | ||
| 20 | enum action_e { a_inflate, a_deflate }; | 20 | enum action_e { a_inflate, a_deflate }; |
| 21 | 21 | ||
| 22 | + DLL_EXPORT | ||
| 22 | Pl_Flate(char const* identifier, Pipeline* next, | 23 | Pl_Flate(char const* identifier, Pipeline* next, |
| 23 | action_e action, int out_bufsize = def_bufsize); | 24 | action_e action, int out_bufsize = def_bufsize); |
| 25 | + DLL_EXPORT | ||
| 24 | virtual ~Pl_Flate(); | 26 | virtual ~Pl_Flate(); |
| 25 | 27 | ||
| 28 | + DLL_EXPORT | ||
| 26 | virtual void write(unsigned char* data, int len); | 29 | virtual void write(unsigned char* data, int len); |
| 30 | + DLL_EXPORT | ||
| 27 | virtual void finish(); | 31 | virtual void finish(); |
| 28 | 32 | ||
| 29 | private: | 33 | private: |
include/qpdf/Pl_StdioFile.hh
| @@ -18,15 +18,19 @@ | @@ -18,15 +18,19 @@ | ||
| 18 | // This pipeline is reusable. | 18 | // This pipeline is reusable. |
| 19 | // | 19 | // |
| 20 | 20 | ||
| 21 | -class DLL_EXPORT Pl_StdioFile: public Pipeline | 21 | +class Pl_StdioFile: public Pipeline |
| 22 | { | 22 | { |
| 23 | public: | 23 | public: |
| 24 | // f is externally maintained; this class just writes to and | 24 | // f is externally maintained; this class just writes to and |
| 25 | // flushes it. It does not close it. | 25 | // flushes it. It does not close it. |
| 26 | + DLL_EXPORT | ||
| 26 | Pl_StdioFile(char const* identifier, FILE* f); | 27 | Pl_StdioFile(char const* identifier, FILE* f); |
| 28 | + DLL_EXPORT | ||
| 27 | virtual ~Pl_StdioFile(); | 29 | virtual ~Pl_StdioFile(); |
| 28 | 30 | ||
| 31 | + DLL_EXPORT | ||
| 29 | virtual void write(unsigned char* buf, int len); | 32 | virtual void write(unsigned char* buf, int len); |
| 33 | + DLL_EXPORT | ||
| 30 | virtual void finish(); | 34 | virtual void finish(); |
| 31 | 35 | ||
| 32 | private: | 36 | private: |
include/qpdf/QPDF.hh
| @@ -25,10 +25,12 @@ class BitStream; | @@ -25,10 +25,12 @@ class BitStream; | ||
| 25 | class BitWriter; | 25 | class BitWriter; |
| 26 | class QPDFExc; | 26 | class QPDFExc; |
| 27 | 27 | ||
| 28 | -class DLL_EXPORT QPDF | 28 | +class QPDF |
| 29 | { | 29 | { |
| 30 | public: | 30 | public: |
| 31 | + DLL_EXPORT | ||
| 31 | QPDF(); | 32 | QPDF(); |
| 33 | + DLL_EXPORT | ||
| 32 | ~QPDF(); | 34 | ~QPDF(); |
| 33 | 35 | ||
| 34 | // Associate a file with a QPDF object and do initial parsing of | 36 | // Associate a file with a QPDF object and do initial parsing of |
| @@ -41,6 +43,7 @@ class DLL_EXPORT QPDF | @@ -41,6 +43,7 @@ class DLL_EXPORT QPDF | ||
| 41 | // encrypted,either a null password or an empty password can be | 43 | // encrypted,either a null password or an empty password can be |
| 42 | // used. If the file is encrypted, either the user password or | 44 | // used. If the file is encrypted, either the user password or |
| 43 | // the owner password may be supplied. | 45 | // the owner password may be supplied. |
| 46 | + DLL_EXPORT | ||
| 44 | void processFile(char const* filename, char const* password = 0); | 47 | void processFile(char const* filename, char const* password = 0); |
| 45 | 48 | ||
| 46 | // Parameter settings | 49 | // Parameter settings |
| @@ -49,18 +52,21 @@ class DLL_EXPORT QPDF | @@ -49,18 +52,21 @@ class DLL_EXPORT QPDF | ||
| 49 | // (one that contains both cross-reference streams and | 52 | // (one that contains both cross-reference streams and |
| 50 | // cross-reference tables). This can be useful for testing to | 53 | // cross-reference tables). This can be useful for testing to |
| 51 | // ensure that a hybrid file would work with an older reader. | 54 | // ensure that a hybrid file would work with an older reader. |
| 55 | + DLL_EXPORT | ||
| 52 | void setIgnoreXRefStreams(bool); | 56 | void setIgnoreXRefStreams(bool); |
| 53 | 57 | ||
| 54 | // By default, any warnings are issued to stderr as they are | 58 | // By default, any warnings are issued to stderr as they are |
| 55 | // encountered. If this is called with a true value, reporting of | 59 | // encountered. If this is called with a true value, reporting of |
| 56 | // warnings is suppressed. You may still retrieve warnings by | 60 | // warnings is suppressed. You may still retrieve warnings by |
| 57 | // calling getWarnings. | 61 | // calling getWarnings. |
| 62 | + DLL_EXPORT | ||
| 58 | void setSuppressWarnings(bool); | 63 | void setSuppressWarnings(bool); |
| 59 | 64 | ||
| 60 | // By default, QPDF will try to recover if it finds certain types | 65 | // By default, QPDF will try to recover if it finds certain types |
| 61 | // of errors in PDF files. If turned off, it will throw an | 66 | // of errors in PDF files. If turned off, it will throw an |
| 62 | // exception on the first such problem it finds without attempting | 67 | // exception on the first such problem it finds without attempting |
| 63 | // recovery. | 68 | // recovery. |
| 69 | + DLL_EXPORT | ||
| 64 | void setAttemptRecovery(bool); | 70 | void setAttemptRecovery(bool); |
| 65 | 71 | ||
| 66 | // Other public methods | 72 | // Other public methods |
| @@ -70,19 +76,26 @@ class DLL_EXPORT QPDF | @@ -70,19 +76,26 @@ class DLL_EXPORT QPDF | ||
| 70 | // throws an exception. Note that if setSuppressWarnings was not | 76 | // throws an exception. Note that if setSuppressWarnings was not |
| 71 | // called or was called with a false value, any warnings retrieved | 77 | // called or was called with a false value, any warnings retrieved |
| 72 | // here will have already been issued to stderr. | 78 | // here will have already been issued to stderr. |
| 79 | + DLL_EXPORT | ||
| 73 | std::vector<QPDFExc> getWarnings(); | 80 | std::vector<QPDFExc> getWarnings(); |
| 74 | 81 | ||
| 82 | + DLL_EXPORT | ||
| 75 | std::string getFilename() const; | 83 | std::string getFilename() const; |
| 84 | + DLL_EXPORT | ||
| 76 | std::string getPDFVersion() const; | 85 | std::string getPDFVersion() const; |
| 86 | + DLL_EXPORT | ||
| 77 | QPDFObjectHandle getTrailer(); | 87 | QPDFObjectHandle getTrailer(); |
| 88 | + DLL_EXPORT | ||
| 78 | QPDFObjectHandle getRoot(); | 89 | QPDFObjectHandle getRoot(); |
| 79 | 90 | ||
| 80 | // Install this object handle as an indirect object and return an | 91 | // Install this object handle as an indirect object and return an |
| 81 | // indirect reference to it. | 92 | // indirect reference to it. |
| 93 | + DLL_EXPORT | ||
| 82 | QPDFObjectHandle makeIndirectObject(QPDFObjectHandle); | 94 | QPDFObjectHandle makeIndirectObject(QPDFObjectHandle); |
| 83 | 95 | ||
| 84 | // Retrieve an object by object ID and generation. Returns an | 96 | // Retrieve an object by object ID and generation. Returns an |
| 85 | // indirect reference to it. | 97 | // indirect reference to it. |
| 98 | + DLL_EXPORT | ||
| 86 | QPDFObjectHandle getObjectByID(int objid, int generation); | 99 | QPDFObjectHandle getObjectByID(int objid, int generation); |
| 87 | 100 | ||
| 88 | // Encryption support | 101 | // Encryption support |
| @@ -115,31 +128,46 @@ class DLL_EXPORT QPDF | @@ -115,31 +128,46 @@ class DLL_EXPORT QPDF | ||
| 115 | bool encrypt_metadata; | 128 | bool encrypt_metadata; |
| 116 | }; | 129 | }; |
| 117 | 130 | ||
| 131 | + DLL_EXPORT | ||
| 118 | bool isEncrypted() const; | 132 | bool isEncrypted() const; |
| 119 | 133 | ||
| 134 | + DLL_EXPORT | ||
| 120 | bool isEncrypted(int& R, int& P); | 135 | bool isEncrypted(int& R, int& P); |
| 121 | 136 | ||
| 122 | // Encryption permissions -- not enforced by QPDF | 137 | // Encryption permissions -- not enforced by QPDF |
| 138 | + DLL_EXPORT | ||
| 123 | bool allowAccessibility(); | 139 | bool allowAccessibility(); |
| 140 | + DLL_EXPORT | ||
| 124 | bool allowExtractAll(); | 141 | bool allowExtractAll(); |
| 142 | + DLL_EXPORT | ||
| 125 | bool allowPrintLowRes(); | 143 | bool allowPrintLowRes(); |
| 144 | + DLL_EXPORT | ||
| 126 | bool allowPrintHighRes(); | 145 | bool allowPrintHighRes(); |
| 146 | + DLL_EXPORT | ||
| 127 | bool allowModifyAssembly(); | 147 | bool allowModifyAssembly(); |
| 148 | + DLL_EXPORT | ||
| 128 | bool allowModifyForm(); | 149 | bool allowModifyForm(); |
| 150 | + DLL_EXPORT | ||
| 129 | bool allowModifyAnnotation(); | 151 | bool allowModifyAnnotation(); |
| 152 | + DLL_EXPORT | ||
| 130 | bool allowModifyOther(); | 153 | bool allowModifyOther(); |
| 154 | + DLL_EXPORT | ||
| 131 | bool allowModifyAll(); | 155 | bool allowModifyAll(); |
| 132 | 156 | ||
| 133 | // Helper function to trim padding from user password. Calling | 157 | // Helper function to trim padding from user password. Calling |
| 134 | // trim_user_password on the result of getPaddedUserPassword gives | 158 | // trim_user_password on the result of getPaddedUserPassword gives |
| 135 | // getTrimmedUserPassword's result. | 159 | // getTrimmedUserPassword's result. |
| 160 | + DLL_EXPORT | ||
| 136 | static void trim_user_password(std::string& user_password); | 161 | static void trim_user_password(std::string& user_password); |
| 162 | + DLL_EXPORT | ||
| 137 | static std::string compute_data_key( | 163 | static std::string compute_data_key( |
| 138 | std::string const& encryption_key, int objid, int generation, | 164 | std::string const& encryption_key, int objid, int generation, |
| 139 | bool use_aes); | 165 | bool use_aes); |
| 166 | + DLL_EXPORT | ||
| 140 | static std::string compute_encryption_key( | 167 | static std::string compute_encryption_key( |
| 141 | std::string const& password, EncryptionData const& data); | 168 | std::string const& password, EncryptionData const& data); |
| 142 | 169 | ||
| 170 | + DLL_EXPORT | ||
| 143 | static void compute_encryption_O_U( | 171 | static void compute_encryption_O_U( |
| 144 | char const* user_password, char const* owner_password, | 172 | char const* user_password, char const* owner_password, |
| 145 | int V, int R, int key_len, int P, bool encrypt_metadata, | 173 | int V, int R, int key_len, int P, bool encrypt_metadata, |
| @@ -148,19 +176,23 @@ class DLL_EXPORT QPDF | @@ -148,19 +176,23 @@ class DLL_EXPORT QPDF | ||
| 148 | // Return the full user password as stored in the PDF file. If | 176 | // Return the full user password as stored in the PDF file. If |
| 149 | // you are attempting to recover the user password in a | 177 | // you are attempting to recover the user password in a |
| 150 | // user-presentable form, call getTrimmedUserPassword() instead. | 178 | // user-presentable form, call getTrimmedUserPassword() instead. |
| 179 | + DLL_EXPORT | ||
| 151 | std::string const& getPaddedUserPassword() const; | 180 | std::string const& getPaddedUserPassword() const; |
| 152 | // Return human-readable form of user password. | 181 | // Return human-readable form of user password. |
| 182 | + DLL_EXPORT | ||
| 153 | std::string getTrimmedUserPassword() const; | 183 | std::string getTrimmedUserPassword() const; |
| 154 | 184 | ||
| 155 | // Linearization support | 185 | // Linearization support |
| 156 | 186 | ||
| 157 | // Returns true iff the file starts with a linearization parameter | 187 | // Returns true iff the file starts with a linearization parameter |
| 158 | // dictionary. Does no additional validation. | 188 | // dictionary. Does no additional validation. |
| 189 | + DLL_EXPORT | ||
| 159 | bool isLinearized(); | 190 | bool isLinearized(); |
| 160 | 191 | ||
| 161 | // Performs various sanity checks on a linearized file. Return | 192 | // Performs various sanity checks on a linearized file. Return |
| 162 | // true if no errors or warnings. Otherwise, return false and | 193 | // true if no errors or warnings. Otherwise, return false and |
| 163 | // output errors and warnings to stdout. | 194 | // output errors and warnings to stdout. |
| 195 | + DLL_EXPORT | ||
| 164 | bool checkLinearization(); | 196 | bool checkLinearization(); |
| 165 | 197 | ||
| 166 | // Calls checkLinearization() and, if possible, prints normalized | 198 | // Calls checkLinearization() and, if possible, prints normalized |
| @@ -168,9 +200,11 @@ class DLL_EXPORT QPDF | @@ -168,9 +200,11 @@ class DLL_EXPORT QPDF | ||
| 168 | // includes adding min values to delta values and adjusting | 200 | // includes adding min values to delta values and adjusting |
| 169 | // offsets based on the location and size of the primary hint | 201 | // offsets based on the location and size of the primary hint |
| 170 | // stream. | 202 | // stream. |
| 203 | + DLL_EXPORT | ||
| 171 | void showLinearizationData(); | 204 | void showLinearizationData(); |
| 172 | 205 | ||
| 173 | // Shows the contents of the cross-reference table | 206 | // Shows the contents of the cross-reference table |
| 207 | + DLL_EXPORT | ||
| 174 | void showXRefTable(); | 208 | void showXRefTable(); |
| 175 | 209 | ||
| 176 | // Optimization support -- see doc/optimization. Implemented in | 210 | // Optimization support -- see doc/optimization. Implemented in |
| @@ -184,26 +218,31 @@ class DLL_EXPORT QPDF | @@ -184,26 +218,31 @@ class DLL_EXPORT QPDF | ||
| 184 | // This is available so that the test suite can make sure that a | 218 | // This is available so that the test suite can make sure that a |
| 185 | // linearized file is already optimized. When called in this way, | 219 | // linearized file is already optimized. When called in this way, |
| 186 | // optimize() still populates the object <-> user maps | 220 | // optimize() still populates the object <-> user maps |
| 221 | + DLL_EXPORT | ||
| 187 | void optimize(std::map<int, int> const& object_stream_data, | 222 | void optimize(std::map<int, int> const& object_stream_data, |
| 188 | bool allow_changes = true); | 223 | bool allow_changes = true); |
| 189 | 224 | ||
| 190 | // Replace all references to indirect objects that are "scalars" | 225 | // Replace all references to indirect objects that are "scalars" |
| 191 | // (i.e., things that don't have children: not arrays, streams, or | 226 | // (i.e., things that don't have children: not arrays, streams, or |
| 192 | // dictionaries) with direct objects. | 227 | // dictionaries) with direct objects. |
| 228 | + DLL_EXPORT | ||
| 193 | void flattenScalarReferences(); | 229 | void flattenScalarReferences(); |
| 194 | 230 | ||
| 195 | // Decode all streams, discarding the output. Used to check | 231 | // Decode all streams, discarding the output. Used to check |
| 196 | // correctness of stream encoding. | 232 | // correctness of stream encoding. |
| 233 | + DLL_EXPORT | ||
| 197 | void decodeStreams(); | 234 | void decodeStreams(); |
| 198 | 235 | ||
| 199 | // For QPDFWriter: | 236 | // For QPDFWriter: |
| 200 | 237 | ||
| 201 | // Remove /ID, /Encrypt, and /Prev keys from the trailer | 238 | // Remove /ID, /Encrypt, and /Prev keys from the trailer |
| 202 | // dictionary since these are regenerated during write. | 239 | // dictionary since these are regenerated during write. |
| 240 | + DLL_EXPORT | ||
| 203 | void trimTrailerForWrite(); | 241 | void trimTrailerForWrite(); |
| 204 | 242 | ||
| 205 | // Get lists of all objects in order according to the part of a | 243 | // Get lists of all objects in order according to the part of a |
| 206 | // linearized file that they belong to. | 244 | // linearized file that they belong to. |
| 245 | + DLL_EXPORT | ||
| 207 | void getLinearizedParts( | 246 | void getLinearizedParts( |
| 208 | std::map<int, int> const& object_stream_data, | 247 | std::map<int, int> const& object_stream_data, |
| 209 | std::vector<QPDFObjectHandle>& part4, | 248 | std::vector<QPDFObjectHandle>& part4, |
| @@ -212,6 +251,7 @@ class DLL_EXPORT QPDF | @@ -212,6 +251,7 @@ class DLL_EXPORT QPDF | ||
| 212 | std::vector<QPDFObjectHandle>& part8, | 251 | std::vector<QPDFObjectHandle>& part8, |
| 213 | std::vector<QPDFObjectHandle>& part9); | 252 | std::vector<QPDFObjectHandle>& part9); |
| 214 | 253 | ||
| 254 | + DLL_EXPORT | ||
| 215 | void generateHintStream(std::map<int, QPDFXRefEntry> const& xref, | 255 | void generateHintStream(std::map<int, QPDFXRefEntry> const& xref, |
| 216 | std::map<int, size_t> const& lengths, | 256 | std::map<int, size_t> const& lengths, |
| 217 | std::map<int, int> const& obj_renumber, | 257 | std::map<int, int> const& obj_renumber, |
| @@ -219,15 +259,18 @@ class DLL_EXPORT QPDF | @@ -219,15 +259,18 @@ class DLL_EXPORT QPDF | ||
| 219 | int& S, int& O); | 259 | int& S, int& O); |
| 220 | 260 | ||
| 221 | // Map object to object stream that contains it | 261 | // Map object to object stream that contains it |
| 262 | + DLL_EXPORT | ||
| 222 | void getObjectStreamData(std::map<int, int>&); | 263 | void getObjectStreamData(std::map<int, int>&); |
| 223 | // Get a list of objects that would be permitted in an object | 264 | // Get a list of objects that would be permitted in an object |
| 224 | // stream | 265 | // stream |
| 266 | + DLL_EXPORT | ||
| 225 | std::vector<int> getCompressibleObjects(); | 267 | std::vector<int> getCompressibleObjects(); |
| 226 | 268 | ||
| 227 | // Convenience routines for common functions. See also | 269 | // Convenience routines for common functions. See also |
| 228 | // QPDFObjectHandle.hh for additional convenience routines. | 270 | // QPDFObjectHandle.hh for additional convenience routines. |
| 229 | 271 | ||
| 230 | // Traverse page tree return all /Page objects. | 272 | // Traverse page tree return all /Page objects. |
| 273 | + DLL_EXPORT | ||
| 231 | std::vector<QPDFObjectHandle> const& getAllPages(); | 274 | std::vector<QPDFObjectHandle> const& getAllPages(); |
| 232 | 275 | ||
| 233 | // Resolver class is restricted to QPDFObjectHandle so that only | 276 | // Resolver class is restricted to QPDFObjectHandle so that only |
include/qpdf/QPDFExc.hh
| @@ -12,14 +12,16 @@ | @@ -12,14 +12,16 @@ | ||
| 12 | #include <qpdf/Constants.h> | 12 | #include <qpdf/Constants.h> |
| 13 | #include <stdexcept> | 13 | #include <stdexcept> |
| 14 | 14 | ||
| 15 | -class DLL_EXPORT QPDFExc: public std::runtime_error | 15 | +class QPDFExc: public std::runtime_error |
| 16 | { | 16 | { |
| 17 | public: | 17 | public: |
| 18 | + DLL_EXPORT | ||
| 18 | QPDFExc(qpdf_error_code_e error_code, | 19 | QPDFExc(qpdf_error_code_e error_code, |
| 19 | std::string const& filename, | 20 | std::string const& filename, |
| 20 | std::string const& object, | 21 | std::string const& object, |
| 21 | off_t offset, | 22 | off_t offset, |
| 22 | std::string const& message); | 23 | std::string const& message); |
| 24 | + DLL_EXPORT | ||
| 23 | virtual ~QPDFExc() throw (); | 25 | virtual ~QPDFExc() throw (); |
| 24 | 26 | ||
| 25 | // To get a complete error string, call what(), provided by | 27 | // To get a complete error string, call what(), provided by |
| @@ -32,10 +34,15 @@ class DLL_EXPORT QPDFExc: public std::runtime_error | @@ -32,10 +34,15 @@ class DLL_EXPORT QPDFExc: public std::runtime_error | ||
| 32 | // the underlying issue, but it is more programmer-friendly than | 34 | // the underlying issue, but it is more programmer-friendly than |
| 33 | // trying to parse a string that is subject to change. | 35 | // trying to parse a string that is subject to change. |
| 34 | 36 | ||
| 37 | + DLL_EXPORT | ||
| 35 | qpdf_error_code_e getErrorCode() const; | 38 | qpdf_error_code_e getErrorCode() const; |
| 39 | + DLL_EXPORT | ||
| 36 | std::string const& getFilename() const; | 40 | std::string const& getFilename() const; |
| 41 | + DLL_EXPORT | ||
| 37 | std::string const& getObject() const; | 42 | std::string const& getObject() const; |
| 43 | + DLL_EXPORT | ||
| 38 | off_t getFilePosition() const; | 44 | off_t getFilePosition() const; |
| 45 | + DLL_EXPORT | ||
| 39 | std::string const& getMessageDetail() const; | 46 | std::string const& getMessageDetail() const; |
| 40 | 47 | ||
| 41 | private: | 48 | private: |
include/qpdf/QPDFObject.hh
include/qpdf/QPDFObjectHandle.hh
| @@ -23,40 +23,61 @@ | @@ -23,40 +23,61 @@ | ||
| 23 | class Pipeline; | 23 | class Pipeline; |
| 24 | class QPDF; | 24 | class QPDF; |
| 25 | 25 | ||
| 26 | -class DLL_EXPORT QPDFObjectHandle | 26 | +class QPDFObjectHandle |
| 27 | { | 27 | { |
| 28 | public: | 28 | public: |
| 29 | + DLL_EXPORT | ||
| 29 | QPDFObjectHandle(); | 30 | QPDFObjectHandle(); |
| 31 | + DLL_EXPORT | ||
| 30 | bool isInitialized() const; | 32 | bool isInitialized() const; |
| 31 | 33 | ||
| 32 | // Exactly one of these will return true for any object. | 34 | // Exactly one of these will return true for any object. |
| 35 | + DLL_EXPORT | ||
| 33 | bool isBool(); | 36 | bool isBool(); |
| 37 | + DLL_EXPORT | ||
| 34 | bool isNull(); | 38 | bool isNull(); |
| 39 | + DLL_EXPORT | ||
| 35 | bool isInteger(); | 40 | bool isInteger(); |
| 41 | + DLL_EXPORT | ||
| 36 | bool isReal(); | 42 | bool isReal(); |
| 43 | + DLL_EXPORT | ||
| 37 | bool isName(); | 44 | bool isName(); |
| 45 | + DLL_EXPORT | ||
| 38 | bool isString(); | 46 | bool isString(); |
| 47 | + DLL_EXPORT | ||
| 39 | bool isArray(); | 48 | bool isArray(); |
| 49 | + DLL_EXPORT | ||
| 40 | bool isDictionary(); | 50 | bool isDictionary(); |
| 51 | + DLL_EXPORT | ||
| 41 | bool isStream(); | 52 | bool isStream(); |
| 42 | 53 | ||
| 43 | // This returns true in addition to the query for the specific | 54 | // This returns true in addition to the query for the specific |
| 44 | // type for indirect objects. | 55 | // type for indirect objects. |
| 56 | + DLL_EXPORT | ||
| 45 | bool isIndirect(); | 57 | bool isIndirect(); |
| 46 | 58 | ||
| 47 | // True for everything except array, dictionary, and stream | 59 | // True for everything except array, dictionary, and stream |
| 60 | + DLL_EXPORT | ||
| 48 | bool isScalar(); | 61 | bool isScalar(); |
| 49 | 62 | ||
| 50 | // Public factory methods | 63 | // Public factory methods |
| 51 | 64 | ||
| 65 | + DLL_EXPORT | ||
| 52 | static QPDFObjectHandle newNull(); | 66 | static QPDFObjectHandle newNull(); |
| 67 | + DLL_EXPORT | ||
| 53 | static QPDFObjectHandle newBool(bool value); | 68 | static QPDFObjectHandle newBool(bool value); |
| 69 | + DLL_EXPORT | ||
| 54 | static QPDFObjectHandle newInteger(int value); | 70 | static QPDFObjectHandle newInteger(int value); |
| 71 | + DLL_EXPORT | ||
| 55 | static QPDFObjectHandle newReal(std::string const& value); | 72 | static QPDFObjectHandle newReal(std::string const& value); |
| 73 | + DLL_EXPORT | ||
| 56 | static QPDFObjectHandle newName(std::string const& name); | 74 | static QPDFObjectHandle newName(std::string const& name); |
| 75 | + DLL_EXPORT | ||
| 57 | static QPDFObjectHandle newString(std::string const& str); | 76 | static QPDFObjectHandle newString(std::string const& str); |
| 77 | + DLL_EXPORT | ||
| 58 | static QPDFObjectHandle newArray( | 78 | static QPDFObjectHandle newArray( |
| 59 | std::vector<QPDFObjectHandle> const& items); | 79 | std::vector<QPDFObjectHandle> const& items); |
| 80 | + DLL_EXPORT | ||
| 60 | static QPDFObjectHandle newDictionary( | 81 | static QPDFObjectHandle newDictionary( |
| 61 | std::map<std::string, QPDFObjectHandle> const& items); | 82 | std::map<std::string, QPDFObjectHandle> const& items); |
| 62 | 83 | ||
| @@ -65,58 +86,78 @@ class DLL_EXPORT QPDFObjectHandle | @@ -65,58 +86,78 @@ class DLL_EXPORT QPDFObjectHandle | ||
| 65 | // type, an exception is thrown. | 86 | // type, an exception is thrown. |
| 66 | 87 | ||
| 67 | // Methods for bool objects | 88 | // Methods for bool objects |
| 89 | + DLL_EXPORT | ||
| 68 | bool getBoolValue(); | 90 | bool getBoolValue(); |
| 69 | 91 | ||
| 70 | // Methods for integer objects | 92 | // Methods for integer objects |
| 93 | + DLL_EXPORT | ||
| 71 | int getIntValue(); | 94 | int getIntValue(); |
| 72 | 95 | ||
| 73 | // Methods for real objects | 96 | // Methods for real objects |
| 97 | + DLL_EXPORT | ||
| 74 | std::string getRealValue(); | 98 | std::string getRealValue(); |
| 75 | 99 | ||
| 76 | // Methods that work for both integer and real objects | 100 | // Methods that work for both integer and real objects |
| 101 | + DLL_EXPORT | ||
| 77 | bool isNumber(); | 102 | bool isNumber(); |
| 103 | + DLL_EXPORT | ||
| 78 | double getNumericValue(); | 104 | double getNumericValue(); |
| 79 | 105 | ||
| 80 | // Methods for name objects; see also name and array objects | 106 | // Methods for name objects; see also name and array objects |
| 107 | + DLL_EXPORT | ||
| 81 | std::string getName(); | 108 | std::string getName(); |
| 82 | 109 | ||
| 83 | // Methods for string objects | 110 | // Methods for string objects |
| 111 | + DLL_EXPORT | ||
| 84 | std::string getStringValue(); | 112 | std::string getStringValue(); |
| 113 | + DLL_EXPORT | ||
| 85 | std::string getUTF8Value(); | 114 | std::string getUTF8Value(); |
| 86 | 115 | ||
| 87 | // Methods for array objects; see also name and array objects | 116 | // Methods for array objects; see also name and array objects |
| 117 | + DLL_EXPORT | ||
| 88 | int getArrayNItems(); | 118 | int getArrayNItems(); |
| 119 | + DLL_EXPORT | ||
| 89 | QPDFObjectHandle getArrayItem(int n); | 120 | QPDFObjectHandle getArrayItem(int n); |
| 90 | 121 | ||
| 91 | // Methods for dictionary objects | 122 | // Methods for dictionary objects |
| 123 | + DLL_EXPORT | ||
| 92 | bool hasKey(std::string const&); | 124 | bool hasKey(std::string const&); |
| 125 | + DLL_EXPORT | ||
| 93 | QPDFObjectHandle getKey(std::string const&); | 126 | QPDFObjectHandle getKey(std::string const&); |
| 127 | + DLL_EXPORT | ||
| 94 | std::set<std::string> getKeys(); | 128 | std::set<std::string> getKeys(); |
| 95 | 129 | ||
| 96 | // Methods for name and array objects | 130 | // Methods for name and array objects |
| 131 | + DLL_EXPORT | ||
| 97 | bool isOrHasName(std::string const&); | 132 | bool isOrHasName(std::string const&); |
| 98 | 133 | ||
| 99 | // Mutator methods. Use with caution. | 134 | // Mutator methods. Use with caution. |
| 100 | 135 | ||
| 101 | // Recursively copy this object, making it direct. Throws an | 136 | // Recursively copy this object, making it direct. Throws an |
| 102 | // exception if a loop is detected or any sub-object is a stream. | 137 | // exception if a loop is detected or any sub-object is a stream. |
| 138 | + DLL_EXPORT | ||
| 103 | void makeDirect(); | 139 | void makeDirect(); |
| 104 | 140 | ||
| 105 | // Mutator methods for array objects | 141 | // Mutator methods for array objects |
| 142 | + DLL_EXPORT | ||
| 106 | void setArrayItem(int, QPDFObjectHandle const&); | 143 | void setArrayItem(int, QPDFObjectHandle const&); |
| 107 | 144 | ||
| 108 | // Mutator methods for dictionary objects | 145 | // Mutator methods for dictionary objects |
| 109 | 146 | ||
| 110 | // Replace value of key, adding it if it does not exist | 147 | // Replace value of key, adding it if it does not exist |
| 148 | + DLL_EXPORT | ||
| 111 | void replaceKey(std::string const& key, QPDFObjectHandle const&); | 149 | void replaceKey(std::string const& key, QPDFObjectHandle const&); |
| 112 | // Remove key, doing nothing if key does not exist | 150 | // Remove key, doing nothing if key does not exist |
| 151 | + DLL_EXPORT | ||
| 113 | void removeKey(std::string const& key); | 152 | void removeKey(std::string const& key); |
| 114 | 153 | ||
| 115 | // Methods for stream objects | 154 | // Methods for stream objects |
| 155 | + DLL_EXPORT | ||
| 116 | QPDFObjectHandle getDict(); | 156 | QPDFObjectHandle getDict(); |
| 117 | 157 | ||
| 118 | // Returns filtered (uncompressed) stream data. Throws an | 158 | // Returns filtered (uncompressed) stream data. Throws an |
| 119 | // exception if the stream is filtered and we can't decode it. | 159 | // exception if the stream is filtered and we can't decode it. |
| 160 | + DLL_EXPORT | ||
| 120 | PointerHolder<Buffer> getStreamData(); | 161 | PointerHolder<Buffer> getStreamData(); |
| 121 | 162 | ||
| 122 | // Write stream data through the given pipeline. A null pipeline | 163 | // Write stream data through the given pipeline. A null pipeline |
| @@ -136,14 +177,19 @@ class DLL_EXPORT QPDFObjectHandle | @@ -136,14 +177,19 @@ class DLL_EXPORT QPDFObjectHandle | ||
| 136 | // value of this function to determine whether or not the /Filter | 177 | // value of this function to determine whether or not the /Filter |
| 137 | // and /DecodeParms keys in the stream dictionary should be | 178 | // and /DecodeParms keys in the stream dictionary should be |
| 138 | // replaced if writing a new stream object. | 179 | // replaced if writing a new stream object. |
| 180 | + DLL_EXPORT | ||
| 139 | bool pipeStreamData(Pipeline*, bool filter, | 181 | bool pipeStreamData(Pipeline*, bool filter, |
| 140 | bool normalize, bool compress); | 182 | bool normalize, bool compress); |
| 141 | 183 | ||
| 142 | // return 0 for direct objects | 184 | // return 0 for direct objects |
| 185 | + DLL_EXPORT | ||
| 143 | int getObjectID() const; | 186 | int getObjectID() const; |
| 187 | + DLL_EXPORT | ||
| 144 | int getGeneration() const; | 188 | int getGeneration() const; |
| 145 | 189 | ||
| 190 | + DLL_EXPORT | ||
| 146 | std::string unparse(); | 191 | std::string unparse(); |
| 192 | + DLL_EXPORT | ||
| 147 | std::string unparseResolved(); | 193 | std::string unparseResolved(); |
| 148 | 194 | ||
| 149 | // Convenience routines for commonly performed functions | 195 | // Convenience routines for commonly performed functions |
| @@ -153,6 +199,7 @@ class DLL_EXPORT QPDFObjectHandle | @@ -153,6 +199,7 @@ class DLL_EXPORT QPDFObjectHandle | ||
| 153 | // function does not presently support inherited resources. See | 199 | // function does not presently support inherited resources. See |
| 154 | // comment in the source for details. Return value is a map from | 200 | // comment in the source for details. Return value is a map from |
| 155 | // XObject name to the image object, which is always a stream. | 201 | // XObject name to the image object, which is always a stream. |
| 202 | + DLL_EXPORT | ||
| 156 | std::map<std::string, QPDFObjectHandle> getPageImages(); | 203 | std::map<std::string, QPDFObjectHandle> getPageImages(); |
| 157 | 204 | ||
| 158 | // Throws an exception if this is not a Page object. Returns a | 205 | // Throws an exception if this is not a Page object. Returns a |
| @@ -160,6 +207,7 @@ class DLL_EXPORT QPDFObjectHandle | @@ -160,6 +207,7 @@ class DLL_EXPORT QPDFObjectHandle | ||
| 160 | // the given page. This routine allows the caller to not care | 207 | // the given page. This routine allows the caller to not care |
| 161 | // whether there are one or more than one content streams for a | 208 | // whether there are one or more than one content streams for a |
| 162 | // page. | 209 | // page. |
| 210 | + DLL_EXPORT | ||
| 163 | std::vector<QPDFObjectHandle> getPageContents(); | 211 | std::vector<QPDFObjectHandle> getPageContents(); |
| 164 | 212 | ||
| 165 | // Initializers for objects. This Factory class gives the QPDF | 213 | // Initializers for objects. This Factory class gives the QPDF |
include/qpdf/QPDFTokenizer.hh
| @@ -13,7 +13,7 @@ | @@ -13,7 +13,7 @@ | ||
| 13 | #include <string> | 13 | #include <string> |
| 14 | #include <stdio.h> | 14 | #include <stdio.h> |
| 15 | 15 | ||
| 16 | -class DLL_EXPORT QPDFTokenizer | 16 | +class QPDFTokenizer |
| 17 | { | 17 | { |
| 18 | public: | 18 | public: |
| 19 | enum token_type_e | 19 | enum token_type_e |
| @@ -84,6 +84,7 @@ class DLL_EXPORT QPDFTokenizer | @@ -84,6 +84,7 @@ class DLL_EXPORT QPDFTokenizer | ||
| 84 | std::string error_message; | 84 | std::string error_message; |
| 85 | }; | 85 | }; |
| 86 | 86 | ||
| 87 | + DLL_EXPORT | ||
| 87 | QPDFTokenizer(); | 88 | QPDFTokenizer(); |
| 88 | 89 | ||
| 89 | // PDF files with version < 1.2 allowed the pound character | 90 | // PDF files with version < 1.2 allowed the pound character |
| @@ -91,6 +92,7 @@ class DLL_EXPORT QPDFTokenizer | @@ -91,6 +92,7 @@ class DLL_EXPORT QPDFTokenizer | ||
| 91 | // character was allowed only when followed by two hexadecimal | 92 | // character was allowed only when followed by two hexadecimal |
| 92 | // digits. This method should be called when parsing a PDF file | 93 | // digits. This method should be called when parsing a PDF file |
| 93 | // whose version is older than 1.2. | 94 | // whose version is older than 1.2. |
| 95 | + DLL_EXPORT | ||
| 94 | void allowPoundAnywhereInName(); | 96 | void allowPoundAnywhereInName(); |
| 95 | 97 | ||
| 96 | // Mode of operation: | 98 | // Mode of operation: |
| @@ -101,19 +103,23 @@ class DLL_EXPORT QPDFTokenizer | @@ -101,19 +103,23 @@ class DLL_EXPORT QPDFTokenizer | ||
| 101 | 103 | ||
| 102 | // It these are called when a token is available, an exception | 104 | // It these are called when a token is available, an exception |
| 103 | // will be thrown. | 105 | // will be thrown. |
| 106 | + DLL_EXPORT | ||
| 104 | void presentCharacter(char ch); | 107 | void presentCharacter(char ch); |
| 108 | + DLL_EXPORT | ||
| 105 | void presentEOF(); | 109 | void presentEOF(); |
| 106 | 110 | ||
| 107 | // If a token is available, return true and initialize token with | 111 | // If a token is available, return true and initialize token with |
| 108 | // the token, unread_char with whether or not we have to unread | 112 | // the token, unread_char with whether or not we have to unread |
| 109 | // the last character, and if unread_char, ch with the character | 113 | // the last character, and if unread_char, ch with the character |
| 110 | // to unread. | 114 | // to unread. |
| 115 | + DLL_EXPORT | ||
| 111 | bool getToken(Token& token, bool& unread_char, char& ch); | 116 | bool getToken(Token& token, bool& unread_char, char& ch); |
| 112 | 117 | ||
| 113 | // This function returns true of the current character is between | 118 | // This function returns true of the current character is between |
| 114 | // tokens (i.e., white space that is not part of a string) or is | 119 | // tokens (i.e., white space that is not part of a string) or is |
| 115 | // part of a comment. A tokenizing filter can call this to | 120 | // part of a comment. A tokenizing filter can call this to |
| 116 | // determine whether to output the character. | 121 | // determine whether to output the character. |
| 122 | + DLL_EXPORT | ||
| 117 | bool betweenTokens(); | 123 | bool betweenTokens(); |
| 118 | 124 | ||
| 119 | private: | 125 | private: |
include/qpdf/QPDFWriter.hh
| @@ -32,7 +32,7 @@ class QPDF; | @@ -32,7 +32,7 @@ class QPDF; | ||
| 32 | class QPDFObjectHandle; | 32 | class QPDFObjectHandle; |
| 33 | class Pl_Count; | 33 | class Pl_Count; |
| 34 | 34 | ||
| 35 | -class DLL_EXPORT QPDFWriter | 35 | +class QPDFWriter |
| 36 | { | 36 | { |
| 37 | public: | 37 | public: |
| 38 | // Passing null as filename means write to stdout. QPDFWriter | 38 | // Passing null as filename means write to stdout. QPDFWriter |
| @@ -42,7 +42,9 @@ class DLL_EXPORT QPDFWriter | @@ -42,7 +42,9 @@ class DLL_EXPORT QPDFWriter | ||
| 42 | // useful for tracking down problems. If your application doesn't | 42 | // useful for tracking down problems. If your application doesn't |
| 43 | // want the partially written file to be left behind, you should | 43 | // want the partially written file to be left behind, you should |
| 44 | // delete it the eventual call to write fails. | 44 | // delete it the eventual call to write fails. |
| 45 | + DLL_EXPORT | ||
| 45 | QPDFWriter(QPDF& pdf, char const* filename); | 46 | QPDFWriter(QPDF& pdf, char const* filename); |
| 47 | + DLL_EXPORT | ||
| 46 | ~QPDFWriter(); | 48 | ~QPDFWriter(); |
| 47 | 49 | ||
| 48 | // Set the value of object stream mode. In disable mode, we never | 50 | // Set the value of object stream mode. In disable mode, we never |
| @@ -52,6 +54,7 @@ class DLL_EXPORT QPDFWriter | @@ -52,6 +54,7 @@ class DLL_EXPORT QPDFWriter | ||
| 52 | // generate a conventional cross-reference table if there are no | 54 | // generate a conventional cross-reference table if there are no |
| 53 | // object streams and a cross-reference stream if there are object | 55 | // object streams and a cross-reference stream if there are object |
| 54 | // streams. The default is o_preserve. | 56 | // streams. The default is o_preserve. |
| 57 | + DLL_EXPORT | ||
| 55 | void setObjectStreamMode(qpdf_object_stream_e); | 58 | void setObjectStreamMode(qpdf_object_stream_e); |
| 56 | 59 | ||
| 57 | // Set value of stream data mode. In uncompress mode, we attempt | 60 | // Set value of stream data mode. In uncompress mode, we attempt |
| @@ -59,6 +62,7 @@ class DLL_EXPORT QPDFWriter | @@ -59,6 +62,7 @@ class DLL_EXPORT QPDFWriter | ||
| 59 | // preserve any filtering applied to streams. In compress mode, | 62 | // preserve any filtering applied to streams. In compress mode, |
| 60 | // if we can apply all filters and the stream is not already | 63 | // if we can apply all filters and the stream is not already |
| 61 | // optimally compressed, recompress the stream. | 64 | // optimally compressed, recompress the stream. |
| 65 | + DLL_EXPORT | ||
| 62 | void setStreamDataMode(qpdf_stream_data_e); | 66 | void setStreamDataMode(qpdf_stream_data_e); |
| 63 | 67 | ||
| 64 | // Set value of content stream normalization. The default is | 68 | // Set value of content stream normalization. The default is |
| @@ -68,6 +72,7 @@ class DLL_EXPORT QPDFWriter | @@ -68,6 +72,7 @@ class DLL_EXPORT QPDFWriter | ||
| 68 | // damage the content stream. This flag should be used only for | 72 | // damage the content stream. This flag should be used only for |
| 69 | // debugging and experimenting with PDF content streams. Never | 73 | // debugging and experimenting with PDF content streams. Never |
| 70 | // use it for production files. | 74 | // use it for production files. |
| 75 | + DLL_EXPORT | ||
| 71 | void setContentNormalization(bool); | 76 | void setContentNormalization(bool); |
| 72 | 77 | ||
| 73 | // Set QDF mode. QDF mode causes special "pretty printing" of | 78 | // Set QDF mode. QDF mode causes special "pretty printing" of |
| @@ -75,6 +80,7 @@ class DLL_EXPORT QPDFWriter | @@ -75,6 +80,7 @@ class DLL_EXPORT QPDFWriter | ||
| 75 | // Resulting PDF files can be edited in a text editor and then run | 80 | // Resulting PDF files can be edited in a text editor and then run |
| 76 | // through fix-qdf to update cross reference tables and stream | 81 | // through fix-qdf to update cross reference tables and stream |
| 77 | // lengths. | 82 | // lengths. |
| 83 | + DLL_EXPORT | ||
| 78 | void setQDFMode(bool); | 84 | void setQDFMode(bool); |
| 79 | 85 | ||
| 80 | // Set the minimum PDF version. If the PDF version of the input | 86 | // Set the minimum PDF version. If the PDF version of the input |
| @@ -86,6 +92,7 @@ class DLL_EXPORT QPDFWriter | @@ -86,6 +92,7 @@ class DLL_EXPORT QPDFWriter | ||
| 86 | // QPDFWriter automatically sets the minimum version to 1.4 when | 92 | // QPDFWriter automatically sets the minimum version to 1.4 when |
| 87 | // R3 encryption parameters are used, and to 1.5 when object | 93 | // R3 encryption parameters are used, and to 1.5 when object |
| 88 | // streams are used. | 94 | // streams are used. |
| 95 | + DLL_EXPORT | ||
| 89 | void setMinimumPDFVersion(std::string const&); | 96 | void setMinimumPDFVersion(std::string const&); |
| 90 | 97 | ||
| 91 | // Force the PDF version of the output file to be a given version. | 98 | // Force the PDF version of the output file to be a given version. |
| @@ -103,27 +110,32 @@ class DLL_EXPORT QPDFWriter | @@ -103,27 +110,32 @@ class DLL_EXPORT QPDFWriter | ||
| 103 | // that type of encryption will explicitly disable decryption. | 110 | // that type of encryption will explicitly disable decryption. |
| 104 | // Additionally, forcing to a version below 1.5 will disable | 111 | // Additionally, forcing to a version below 1.5 will disable |
| 105 | // object streams. | 112 | // object streams. |
| 113 | + DLL_EXPORT | ||
| 106 | void forcePDFVersion(std::string const&); | 114 | void forcePDFVersion(std::string const&); |
| 107 | 115 | ||
| 108 | // Cause a static /ID value to be generated. Use only in test | 116 | // Cause a static /ID value to be generated. Use only in test |
| 109 | // suites. | 117 | // suites. |
| 118 | + DLL_EXPORT | ||
| 110 | void setStaticID(bool); | 119 | void setStaticID(bool); |
| 111 | 120 | ||
| 112 | // Use a fixed initialization vector for AES-CBC encryption. This | 121 | // Use a fixed initialization vector for AES-CBC encryption. This |
| 113 | // is not secure. It should be used only in test suites for | 122 | // is not secure. It should be used only in test suites for |
| 114 | // creating predictable encrypted output. | 123 | // creating predictable encrypted output. |
| 124 | + DLL_EXPORT | ||
| 115 | void setStaticAesIV(bool); | 125 | void setStaticAesIV(bool); |
| 116 | 126 | ||
| 117 | // Suppress inclusion of comments indicating original object IDs | 127 | // Suppress inclusion of comments indicating original object IDs |
| 118 | // when writing QDF files. This can also be useful for testing, | 128 | // when writing QDF files. This can also be useful for testing, |
| 119 | // particularly when using comparison of two qdf files to | 129 | // particularly when using comparison of two qdf files to |
| 120 | // determine whether two PDF files have identical content. | 130 | // determine whether two PDF files have identical content. |
| 131 | + DLL_EXPORT | ||
| 121 | void setSuppressOriginalObjectIDs(bool); | 132 | void setSuppressOriginalObjectIDs(bool); |
| 122 | 133 | ||
| 123 | // Preserve encryption. The default is true unless prefilering, | 134 | // Preserve encryption. The default is true unless prefilering, |
| 124 | // content normalization, or qdf mode has been selected in which | 135 | // content normalization, or qdf mode has been selected in which |
| 125 | // case encryption is never preserved. Encryption is also not | 136 | // case encryption is never preserved. Encryption is also not |
| 126 | // preserved if we explicitly set encryption parameters. | 137 | // preserved if we explicitly set encryption parameters. |
| 138 | + DLL_EXPORT | ||
| 127 | void setPreserveEncryption(bool); | 139 | void setPreserveEncryption(bool); |
| 128 | 140 | ||
| 129 | // Set up for encrypted output. Disables stream prefiltering and | 141 | // Set up for encrypted output. Disables stream prefiltering and |
| @@ -132,14 +144,17 @@ class DLL_EXPORT QPDFWriter | @@ -132,14 +144,17 @@ class DLL_EXPORT QPDFWriter | ||
| 132 | // encryption parameters pushes the PDF version number to at least | 144 | // encryption parameters pushes the PDF version number to at least |
| 133 | // 1.4, and setting R4 parameters pushes the version to at least | 145 | // 1.4, and setting R4 parameters pushes the version to at least |
| 134 | // 1.5, or if AES is used, 1.6. | 146 | // 1.5, or if AES is used, 1.6. |
| 147 | + DLL_EXPORT | ||
| 135 | void setR2EncryptionParameters( | 148 | void setR2EncryptionParameters( |
| 136 | char const* user_password, char const* owner_password, | 149 | char const* user_password, char const* owner_password, |
| 137 | bool allow_print, bool allow_modify, | 150 | bool allow_print, bool allow_modify, |
| 138 | bool allow_extract, bool allow_annotate); | 151 | bool allow_extract, bool allow_annotate); |
| 152 | + DLL_EXPORT | ||
| 139 | void setR3EncryptionParameters( | 153 | void setR3EncryptionParameters( |
| 140 | char const* user_password, char const* owner_password, | 154 | char const* user_password, char const* owner_password, |
| 141 | bool allow_accessibility, bool allow_extract, | 155 | bool allow_accessibility, bool allow_extract, |
| 142 | qpdf_r3_print_e print, qpdf_r3_modify_e modify); | 156 | qpdf_r3_print_e print, qpdf_r3_modify_e modify); |
| 157 | + DLL_EXPORT | ||
| 143 | void setR4EncryptionParameters( | 158 | void setR4EncryptionParameters( |
| 144 | char const* user_password, char const* owner_password, | 159 | char const* user_password, char const* owner_password, |
| 145 | bool allow_accessibility, bool allow_extract, | 160 | bool allow_accessibility, bool allow_extract, |
| @@ -148,11 +163,16 @@ class DLL_EXPORT QPDFWriter | @@ -148,11 +163,16 @@ class DLL_EXPORT QPDFWriter | ||
| 148 | 163 | ||
| 149 | // Create linearized output. Disables qdf mode, content | 164 | // Create linearized output. Disables qdf mode, content |
| 150 | // normalization, and stream prefiltering. | 165 | // normalization, and stream prefiltering. |
| 166 | + DLL_EXPORT | ||
| 151 | void setLinearization(bool); | 167 | void setLinearization(bool); |
| 152 | 168 | ||
| 169 | + DLL_EXPORT | ||
| 153 | void write(); | 170 | void write(); |
| 154 | 171 | ||
| 155 | private: | 172 | private: |
| 173 | + QPDFWriter(QPDFWriter const&); | ||
| 174 | + QPDFWriter& operator=(QPDFWriter const&); | ||
| 175 | + | ||
| 156 | // flags used by unparseObject | 176 | // flags used by unparseObject |
| 157 | static int const f_stream = 1 << 0; | 177 | static int const f_stream = 1 << 0; |
| 158 | static int const f_filtered = 1 << 1; | 178 | static int const f_filtered = 1 << 1; |
include/qpdf/QPDFXRefEntry.hh
| @@ -10,7 +10,7 @@ | @@ -10,7 +10,7 @@ | ||
| 10 | 10 | ||
| 11 | #include <qpdf/DLL.h> | 11 | #include <qpdf/DLL.h> |
| 12 | 12 | ||
| 13 | -class DLL_EXPORT QPDFXRefEntry | 13 | +class QPDFXRefEntry |
| 14 | { | 14 | { |
| 15 | public: | 15 | public: |
| 16 | // Type constants are from the PDF spec section | 16 | // Type constants are from the PDF spec section |
| @@ -19,12 +19,18 @@ class DLL_EXPORT QPDFXRefEntry | @@ -19,12 +19,18 @@ class DLL_EXPORT QPDFXRefEntry | ||
| 19 | // 1 = "uncompressed"; field 1 = offset | 19 | // 1 = "uncompressed"; field 1 = offset |
| 20 | // 2 = "compressed"; field 1 = object stream number, field 2 = index | 20 | // 2 = "compressed"; field 1 = object stream number, field 2 = index |
| 21 | 21 | ||
| 22 | + DLL_EXPORT | ||
| 22 | QPDFXRefEntry(); | 23 | QPDFXRefEntry(); |
| 24 | + DLL_EXPORT | ||
| 23 | QPDFXRefEntry(int type, int field1, int field2); | 25 | QPDFXRefEntry(int type, int field1, int field2); |
| 24 | 26 | ||
| 27 | + DLL_EXPORT | ||
| 25 | int getType() const; | 28 | int getType() const; |
| 29 | + DLL_EXPORT | ||
| 26 | int getOffset() const; // only for type 1 | 30 | int getOffset() const; // only for type 1 |
| 31 | + DLL_EXPORT | ||
| 27 | int getObjStreamNumber() const; // only for type 2 | 32 | int getObjStreamNumber() const; // only for type 2 |
| 33 | + DLL_EXPORT | ||
| 28 | int getObjStreamIndex() const; // only for type 2 | 34 | int getObjStreamIndex() const; // only for type 2 |
| 29 | 35 | ||
| 30 | private: | 36 | private: |
libqpdf/qpdf/BitStream.hh
| @@ -5,12 +5,16 @@ | @@ -5,12 +5,16 @@ | ||
| 5 | 5 | ||
| 6 | #include <qpdf/DLL.h> | 6 | #include <qpdf/DLL.h> |
| 7 | 7 | ||
| 8 | -class DLL_EXPORT BitStream | 8 | +class BitStream |
| 9 | { | 9 | { |
| 10 | public: | 10 | public: |
| 11 | + DLL_EXPORT | ||
| 11 | BitStream(unsigned char const* p, int nbytes); | 12 | BitStream(unsigned char const* p, int nbytes); |
| 13 | + DLL_EXPORT | ||
| 12 | void reset(); | 14 | void reset(); |
| 15 | + DLL_EXPORT | ||
| 13 | unsigned long getBits(int nbits); | 16 | unsigned long getBits(int nbits); |
| 17 | + DLL_EXPORT | ||
| 14 | void skipToNextByte(); | 18 | void skipToNextByte(); |
| 15 | 19 | ||
| 16 | private: | 20 | private: |
libqpdf/qpdf/BitWriter.hh
| @@ -7,14 +7,17 @@ | @@ -7,14 +7,17 @@ | ||
| 7 | 7 | ||
| 8 | class Pipeline; | 8 | class Pipeline; |
| 9 | 9 | ||
| 10 | -class DLL_EXPORT BitWriter | 10 | +class BitWriter |
| 11 | { | 11 | { |
| 12 | public: | 12 | public: |
| 13 | // Write bits to the pipeline. It is the caller's responsibility | 13 | // Write bits to the pipeline. It is the caller's responsibility |
| 14 | // to eventually call finish on the pipeline. | 14 | // to eventually call finish on the pipeline. |
| 15 | + DLL_EXPORT | ||
| 15 | BitWriter(Pipeline* pl); | 16 | BitWriter(Pipeline* pl); |
| 17 | + DLL_EXPORT | ||
| 16 | void writeBits(unsigned long val, int bits); | 18 | void writeBits(unsigned long val, int bits); |
| 17 | // Force any partial byte to be written to the pipeline. | 19 | // Force any partial byte to be written to the pipeline. |
| 20 | + DLL_EXPORT | ||
| 18 | void flush(); | 21 | void flush(); |
| 19 | 22 | ||
| 20 | private: | 23 | private: |
libqpdf/qpdf/MD5.hh
| @@ -8,41 +8,55 @@ | @@ -8,41 +8,55 @@ | ||
| 8 | # include <inttypes.h> | 8 | # include <inttypes.h> |
| 9 | #endif | 9 | #endif |
| 10 | 10 | ||
| 11 | -class DLL_EXPORT MD5 | 11 | +class MD5 |
| 12 | { | 12 | { |
| 13 | public: | 13 | public: |
| 14 | typedef unsigned char Digest[16]; | 14 | typedef unsigned char Digest[16]; |
| 15 | 15 | ||
| 16 | + DLL_EXPORT | ||
| 16 | MD5(); | 17 | MD5(); |
| 18 | + DLL_EXPORT | ||
| 17 | void reset(); | 19 | void reset(); |
| 18 | 20 | ||
| 19 | // encodes string and finalizes | 21 | // encodes string and finalizes |
| 22 | + DLL_EXPORT | ||
| 20 | void encodeString(char const* input_string); | 23 | void encodeString(char const* input_string); |
| 21 | 24 | ||
| 22 | // encodes file and finalizes | 25 | // encodes file and finalizes |
| 26 | + DLL_EXPORT | ||
| 23 | void encodeFile(char const* filename, int up_to_size = -1); | 27 | void encodeFile(char const* filename, int up_to_size = -1); |
| 24 | 28 | ||
| 25 | // appends string to current md5 object | 29 | // appends string to current md5 object |
| 30 | + DLL_EXPORT | ||
| 26 | void appendString(char const* input_string); | 31 | void appendString(char const* input_string); |
| 27 | 32 | ||
| 28 | // appends arbitrary data to current md5 object | 33 | // appends arbitrary data to current md5 object |
| 34 | + DLL_EXPORT | ||
| 29 | void encodeDataIncrementally(char const* input_data, int len); | 35 | void encodeDataIncrementally(char const* input_data, int len); |
| 30 | 36 | ||
| 31 | // computes a raw digest | 37 | // computes a raw digest |
| 38 | + DLL_EXPORT | ||
| 32 | void digest(Digest); | 39 | void digest(Digest); |
| 33 | 40 | ||
| 34 | // prints the digest to stdout terminated with \r\n (primarily for | 41 | // prints the digest to stdout terminated with \r\n (primarily for |
| 35 | // testing) | 42 | // testing) |
| 43 | + DLL_EXPORT | ||
| 36 | void print(); | 44 | void print(); |
| 37 | 45 | ||
| 38 | // returns the digest as a hexadecimal string | 46 | // returns the digest as a hexadecimal string |
| 47 | + DLL_EXPORT | ||
| 39 | std::string unparse(); | 48 | std::string unparse(); |
| 40 | 49 | ||
| 41 | // Convenience functions | 50 | // Convenience functions |
| 51 | + DLL_EXPORT | ||
| 42 | static std::string getDataChecksum(char const* buf, int len); | 52 | static std::string getDataChecksum(char const* buf, int len); |
| 43 | - static std::string getFileChecksum(char const* filename, int up_to_size = -1); | 53 | + DLL_EXPORT |
| 54 | + static std::string getFileChecksum(char const* filename, | ||
| 55 | + int up_to_size = -1); | ||
| 56 | + DLL_EXPORT | ||
| 44 | static bool checkDataChecksum(char const* const checksum, | 57 | static bool checkDataChecksum(char const* const checksum, |
| 45 | char const* buf, int len); | 58 | char const* buf, int len); |
| 59 | + DLL_EXPORT | ||
| 46 | static bool checkFileChecksum(char const* const checksum, | 60 | static bool checkFileChecksum(char const* const checksum, |
| 47 | char const* filename, int up_to_size = -1); | 61 | char const* filename, int up_to_size = -1); |
| 48 | 62 |
libqpdf/qpdf/PCRE.hh
| @@ -17,7 +17,7 @@ | @@ -17,7 +17,7 @@ | ||
| 17 | // Note: this class does not encapsulate all features of the PCRE | 17 | // Note: this class does not encapsulate all features of the PCRE |
| 18 | // package -- only those that I actually need right now are here. | 18 | // package -- only those that I actually need right now are here. |
| 19 | 19 | ||
| 20 | -class DLL_EXPORT PCRE | 20 | +class PCRE |
| 21 | { | 21 | { |
| 22 | public: | 22 | public: |
| 23 | // This is thrown when an attempt is made to access a non-existent | 23 | // This is thrown when an attempt is made to access a non-existent |
| @@ -25,6 +25,7 @@ class DLL_EXPORT PCRE | @@ -25,6 +25,7 @@ class DLL_EXPORT PCRE | ||
| 25 | class NoBackref: public std::logic_error | 25 | class NoBackref: public std::logic_error |
| 26 | { | 26 | { |
| 27 | public: | 27 | public: |
| 28 | + DLL_EXPORT | ||
| 28 | NoBackref(); | 29 | NoBackref(); |
| 29 | virtual ~NoBackref() throw() {} | 30 | virtual ~NoBackref() throw() {} |
| 30 | }; | 31 | }; |
| @@ -33,10 +34,15 @@ class DLL_EXPORT PCRE | @@ -33,10 +34,15 @@ class DLL_EXPORT PCRE | ||
| 33 | { | 34 | { |
| 34 | friend class PCRE; | 35 | friend class PCRE; |
| 35 | public: | 36 | public: |
| 37 | + DLL_EXPORT | ||
| 36 | Match(int nbackrefs, char const* subject); | 38 | Match(int nbackrefs, char const* subject); |
| 39 | + DLL_EXPORT | ||
| 37 | Match(Match const&); | 40 | Match(Match const&); |
| 41 | + DLL_EXPORT | ||
| 38 | Match& operator=(Match const&); | 42 | Match& operator=(Match const&); |
| 43 | + DLL_EXPORT | ||
| 39 | ~Match(); | 44 | ~Match(); |
| 45 | + DLL_EXPORT | ||
| 40 | operator bool(); | 46 | operator bool(); |
| 41 | 47 | ||
| 42 | // All the back reference accessing routines may throw the | 48 | // All the back reference accessing routines may throw the |
| @@ -48,9 +54,13 @@ class DLL_EXPORT PCRE | @@ -48,9 +54,13 @@ class DLL_EXPORT PCRE | ||
| 48 | // and not matching at all. | 54 | // and not matching at all. |
| 49 | 55 | ||
| 50 | // see getMatch flags below | 56 | // see getMatch flags below |
| 57 | + DLL_EXPORT | ||
| 51 | std::string getMatch(int n, int flags = 0); | 58 | std::string getMatch(int n, int flags = 0); |
| 59 | + DLL_EXPORT | ||
| 52 | void getOffsetLength(int n, int& offset, int& length); | 60 | void getOffsetLength(int n, int& offset, int& length); |
| 61 | + DLL_EXPORT | ||
| 53 | int getOffset(int n); | 62 | int getOffset(int n); |
| 63 | + DLL_EXPORT | ||
| 54 | int getLength(int n); | 64 | int getLength(int n); |
| 55 | 65 | ||
| 56 | // nMatches returns the number of available matches including | 66 | // nMatches returns the number of available matches including |
| @@ -60,6 +70,7 @@ class DLL_EXPORT PCRE | @@ -60,6 +70,7 @@ class DLL_EXPORT PCRE | ||
| 60 | // will return the whole string, getMatch(1) will return the | 70 | // will return the whole string, getMatch(1) will return the |
| 61 | // text that matched the backreference, and getMatch(2) will | 71 | // text that matched the backreference, and getMatch(2) will |
| 62 | // throw an exception because it is out of range. | 72 | // throw an exception because it is out of range. |
| 73 | + DLL_EXPORT | ||
| 63 | int nMatches() const; | 74 | int nMatches() const; |
| 64 | 75 | ||
| 65 | // Flags for getMatch | 76 | // Flags for getMatch |
| @@ -82,12 +93,16 @@ class DLL_EXPORT PCRE | @@ -82,12 +93,16 @@ class DLL_EXPORT PCRE | ||
| 82 | 93 | ||
| 83 | // The value passed in as options is passed to pcre_exec. See man | 94 | // The value passed in as options is passed to pcre_exec. See man |
| 84 | // pcreapi for details. | 95 | // pcreapi for details. |
| 96 | + DLL_EXPORT | ||
| 85 | PCRE(char const* pattern, int options = 0); | 97 | PCRE(char const* pattern, int options = 0); |
| 98 | + DLL_EXPORT | ||
| 86 | ~PCRE(); | 99 | ~PCRE(); |
| 87 | 100 | ||
| 101 | + DLL_EXPORT | ||
| 88 | Match match(char const* subject, int options = 0, int startoffset = 0, | 102 | Match match(char const* subject, int options = 0, int startoffset = 0, |
| 89 | int size = -1); | 103 | int size = -1); |
| 90 | 104 | ||
| 105 | + DLL_EXPORT | ||
| 91 | static void test(int n = 0); | 106 | static void test(int n = 0); |
| 92 | 107 | ||
| 93 | private: | 108 | private: |
libqpdf/qpdf/Pl_AES_PDF.hh
| @@ -7,21 +7,27 @@ | @@ -7,21 +7,27 @@ | ||
| 7 | // This pipeline implements AES-128 with CBC and block padding as | 7 | // This pipeline implements AES-128 with CBC and block padding as |
| 8 | // specified in the PDF specification. | 8 | // specified in the PDF specification. |
| 9 | 9 | ||
| 10 | -class DLL_EXPORT Pl_AES_PDF: public Pipeline | 10 | +class Pl_AES_PDF: public Pipeline |
| 11 | { | 11 | { |
| 12 | public: | 12 | public: |
| 13 | // key_data should be a pointer to key_size bytes of data | 13 | // key_data should be a pointer to key_size bytes of data |
| 14 | static unsigned int const key_size = 16; | 14 | static unsigned int const key_size = 16; |
| 15 | + DLL_EXPORT | ||
| 15 | Pl_AES_PDF(char const* identifier, Pipeline* next, | 16 | Pl_AES_PDF(char const* identifier, Pipeline* next, |
| 16 | bool encrypt, unsigned char const key[key_size]); | 17 | bool encrypt, unsigned char const key[key_size]); |
| 18 | + DLL_EXPORT | ||
| 17 | virtual ~Pl_AES_PDF(); | 19 | virtual ~Pl_AES_PDF(); |
| 18 | 20 | ||
| 21 | + DLL_EXPORT | ||
| 19 | virtual void write(unsigned char* data, int len); | 22 | virtual void write(unsigned char* data, int len); |
| 23 | + DLL_EXPORT | ||
| 20 | virtual void finish(); | 24 | virtual void finish(); |
| 21 | 25 | ||
| 22 | // For testing only; PDF always uses CBC | 26 | // For testing only; PDF always uses CBC |
| 27 | + DLL_EXPORT | ||
| 23 | void disableCBC(); | 28 | void disableCBC(); |
| 24 | // For testing only: use a fixed initialization vector for CBC | 29 | // For testing only: use a fixed initialization vector for CBC |
| 30 | + DLL_EXPORT | ||
| 25 | static void useStaticIV(); | 31 | static void useStaticIV(); |
| 26 | 32 | ||
| 27 | private: | 33 | private: |
libqpdf/qpdf/Pl_ASCII85Decoder.hh
| @@ -3,12 +3,16 @@ | @@ -3,12 +3,16 @@ | ||
| 3 | 3 | ||
| 4 | #include <qpdf/Pipeline.hh> | 4 | #include <qpdf/Pipeline.hh> |
| 5 | 5 | ||
| 6 | -class DLL_EXPORT Pl_ASCII85Decoder: public Pipeline | 6 | +class Pl_ASCII85Decoder: public Pipeline |
| 7 | { | 7 | { |
| 8 | public: | 8 | public: |
| 9 | + DLL_EXPORT | ||
| 9 | Pl_ASCII85Decoder(char const* identifier, Pipeline* next); | 10 | Pl_ASCII85Decoder(char const* identifier, Pipeline* next); |
| 11 | + DLL_EXPORT | ||
| 10 | virtual ~Pl_ASCII85Decoder(); | 12 | virtual ~Pl_ASCII85Decoder(); |
| 13 | + DLL_EXPORT | ||
| 11 | virtual void write(unsigned char* buf, int len); | 14 | virtual void write(unsigned char* buf, int len); |
| 15 | + DLL_EXPORT | ||
| 12 | virtual void finish(); | 16 | virtual void finish(); |
| 13 | 17 | ||
| 14 | private: | 18 | private: |
libqpdf/qpdf/Pl_ASCIIHexDecoder.hh
| @@ -3,12 +3,16 @@ | @@ -3,12 +3,16 @@ | ||
| 3 | 3 | ||
| 4 | #include <qpdf/Pipeline.hh> | 4 | #include <qpdf/Pipeline.hh> |
| 5 | 5 | ||
| 6 | -class DLL_EXPORT Pl_ASCIIHexDecoder: public Pipeline | 6 | +class Pl_ASCIIHexDecoder: public Pipeline |
| 7 | { | 7 | { |
| 8 | public: | 8 | public: |
| 9 | + DLL_EXPORT | ||
| 9 | Pl_ASCIIHexDecoder(char const* identifier, Pipeline* next); | 10 | Pl_ASCIIHexDecoder(char const* identifier, Pipeline* next); |
| 11 | + DLL_EXPORT | ||
| 10 | virtual ~Pl_ASCIIHexDecoder(); | 12 | virtual ~Pl_ASCIIHexDecoder(); |
| 13 | + DLL_EXPORT | ||
| 11 | virtual void write(unsigned char* buf, int len); | 14 | virtual void write(unsigned char* buf, int len); |
| 15 | + DLL_EXPORT | ||
| 12 | virtual void finish(); | 16 | virtual void finish(); |
| 13 | 17 | ||
| 14 | private: | 18 | private: |
libqpdf/qpdf/Pl_LZWDecoder.hh
| @@ -6,13 +6,17 @@ | @@ -6,13 +6,17 @@ | ||
| 6 | #include <qpdf/Buffer.hh> | 6 | #include <qpdf/Buffer.hh> |
| 7 | #include <vector> | 7 | #include <vector> |
| 8 | 8 | ||
| 9 | -class DLL_EXPORT Pl_LZWDecoder: public Pipeline | 9 | +class Pl_LZWDecoder: public Pipeline |
| 10 | { | 10 | { |
| 11 | public: | 11 | public: |
| 12 | + DLL_EXPORT | ||
| 12 | Pl_LZWDecoder(char const* identifier, Pipeline* next, | 13 | Pl_LZWDecoder(char const* identifier, Pipeline* next, |
| 13 | bool early_code_change); | 14 | bool early_code_change); |
| 15 | + DLL_EXPORT | ||
| 14 | virtual ~Pl_LZWDecoder(); | 16 | virtual ~Pl_LZWDecoder(); |
| 17 | + DLL_EXPORT | ||
| 15 | virtual void write(unsigned char* buf, int len); | 18 | virtual void write(unsigned char* buf, int len); |
| 19 | + DLL_EXPORT | ||
| 16 | virtual void finish(); | 20 | virtual void finish(); |
| 17 | 21 | ||
| 18 | private: | 22 | private: |
libqpdf/qpdf/Pl_MD5.hh
| @@ -12,13 +12,18 @@ | @@ -12,13 +12,18 @@ | ||
| 12 | #include <qpdf/Pipeline.hh> | 12 | #include <qpdf/Pipeline.hh> |
| 13 | #include <qpdf/MD5.hh> | 13 | #include <qpdf/MD5.hh> |
| 14 | 14 | ||
| 15 | -class DLL_EXPORT Pl_MD5: public Pipeline | 15 | +class Pl_MD5: public Pipeline |
| 16 | { | 16 | { |
| 17 | public: | 17 | public: |
| 18 | + DLL_EXPORT | ||
| 18 | Pl_MD5(char const* identifier, Pipeline* next); | 19 | Pl_MD5(char const* identifier, Pipeline* next); |
| 20 | + DLL_EXPORT | ||
| 19 | virtual ~Pl_MD5(); | 21 | virtual ~Pl_MD5(); |
| 22 | + DLL_EXPORT | ||
| 20 | virtual void write(unsigned char*, int); | 23 | virtual void write(unsigned char*, int); |
| 24 | + DLL_EXPORT | ||
| 21 | virtual void finish(); | 25 | virtual void finish(); |
| 26 | + DLL_EXPORT | ||
| 22 | std::string getHexDigest(); | 27 | std::string getHexDigest(); |
| 23 | 28 | ||
| 24 | private: | 29 | private: |
libqpdf/qpdf/Pl_PNGFilter.hh
| @@ -16,18 +16,22 @@ | @@ -16,18 +16,22 @@ | ||
| 16 | 16 | ||
| 17 | #include <qpdf/Pipeline.hh> | 17 | #include <qpdf/Pipeline.hh> |
| 18 | 18 | ||
| 19 | -class DLL_EXPORT Pl_PNGFilter: public Pipeline | 19 | +class Pl_PNGFilter: public Pipeline |
| 20 | { | 20 | { |
| 21 | public: | 21 | public: |
| 22 | // Encoding is not presently supported | 22 | // Encoding is not presently supported |
| 23 | enum action_e { a_encode, a_decode }; | 23 | enum action_e { a_encode, a_decode }; |
| 24 | 24 | ||
| 25 | + DLL_EXPORT | ||
| 25 | Pl_PNGFilter(char const* identifier, Pipeline* next, | 26 | Pl_PNGFilter(char const* identifier, Pipeline* next, |
| 26 | action_e action, unsigned int columns, | 27 | action_e action, unsigned int columns, |
| 27 | unsigned int bytes_per_pixel); | 28 | unsigned int bytes_per_pixel); |
| 29 | + DLL_EXPORT | ||
| 28 | virtual ~Pl_PNGFilter(); | 30 | virtual ~Pl_PNGFilter(); |
| 29 | 31 | ||
| 32 | + DLL_EXPORT | ||
| 30 | virtual void write(unsigned char* data, int len); | 33 | virtual void write(unsigned char* data, int len); |
| 34 | + DLL_EXPORT | ||
| 31 | virtual void finish(); | 35 | virtual void finish(); |
| 32 | 36 | ||
| 33 | private: | 37 | private: |
libqpdf/qpdf/Pl_RC4.hh
| @@ -5,18 +5,22 @@ | @@ -5,18 +5,22 @@ | ||
| 5 | 5 | ||
| 6 | #include <qpdf/RC4.hh> | 6 | #include <qpdf/RC4.hh> |
| 7 | 7 | ||
| 8 | -class DLL_EXPORT Pl_RC4: public Pipeline | 8 | +class Pl_RC4: public Pipeline |
| 9 | { | 9 | { |
| 10 | public: | 10 | public: |
| 11 | static int const def_bufsize = 65536; | 11 | static int const def_bufsize = 65536; |
| 12 | 12 | ||
| 13 | // key_len of -1 means treat key_data as a null-terminated string | 13 | // key_len of -1 means treat key_data as a null-terminated string |
| 14 | + DLL_EXPORT | ||
| 14 | Pl_RC4(char const* identifier, Pipeline* next, | 15 | Pl_RC4(char const* identifier, Pipeline* next, |
| 15 | unsigned char const* key_data, int key_len = -1, | 16 | unsigned char const* key_data, int key_len = -1, |
| 16 | int out_bufsize = def_bufsize); | 17 | int out_bufsize = def_bufsize); |
| 18 | + DLL_EXPORT | ||
| 17 | virtual ~Pl_RC4(); | 19 | virtual ~Pl_RC4(); |
| 18 | 20 | ||
| 21 | + DLL_EXPORT | ||
| 19 | virtual void write(unsigned char* data, int len); | 22 | virtual void write(unsigned char* data, int len); |
| 23 | + DLL_EXPORT | ||
| 20 | virtual void finish(); | 24 | virtual void finish(); |
| 21 | 25 | ||
| 22 | private: | 26 | private: |