mirror of
https://github.com/qpdf/qpdf.git
synced 2025-01-22 22:58:33 +00:00
tweak dll stuff again
git-svn-id: svn+q:///qpdf/trunk@851 71b93d88-0707-0410-a8cf-f5a4172ac649
This commit is contained in:
parent
95753c6b53
commit
27ee889c0e
@ -13,21 +13,21 @@
|
||||
class Buffer
|
||||
{
|
||||
public:
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
Buffer();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
Buffer(unsigned long size);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
Buffer(Buffer const&);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
Buffer& operator=(Buffer const&);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
~Buffer();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
unsigned long getSize() const;
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
unsigned char const* getBuffer() const;
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
unsigned char* getBuffer();
|
||||
|
||||
private:
|
||||
|
@ -1,10 +1,10 @@
|
||||
#ifndef __QPDF_DLL_HH__
|
||||
#define __QPDF_DLL_HH__
|
||||
|
||||
#ifdef _WIN32
|
||||
# define DLL_EXPORT __declspec(dllexport)
|
||||
#if defined(_WIN32) && defined(DLL_EXPORT)
|
||||
# define QPDF_DLL __declspec(dllexport)
|
||||
#else
|
||||
# define DLL_EXPORT
|
||||
# define QPDF_DLL
|
||||
#endif
|
||||
|
||||
#endif /* __QPDF_DLL_HH__ */
|
||||
|
@ -36,22 +36,21 @@
|
||||
class Pipeline
|
||||
{
|
||||
public:
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
Pipeline(char const* identifier, Pipeline* next);
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual ~Pipeline();
|
||||
|
||||
// Subclasses should implement write and finish to do their jobs
|
||||
// and then, if they are not end-of-line pipelines, call
|
||||
// getNext()->write or getNext()->finish.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual void write(unsigned char* data, int len) = 0;
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual void finish() = 0;
|
||||
|
||||
protected:
|
||||
DLL_EXPORT
|
||||
Pipeline* getNext(bool allow_null = false);
|
||||
std::string identifier;
|
||||
|
||||
|
@ -27,19 +27,19 @@
|
||||
class Pl_Buffer: public Pipeline
|
||||
{
|
||||
public:
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
Pl_Buffer(char const* identifier, Pipeline* next = 0);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual ~Pl_Buffer();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual void write(unsigned char*, int);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual void finish();
|
||||
|
||||
// Each call to getBuffer() resets this object -- see notes above.
|
||||
// The caller is responsible for deleting the returned Buffer
|
||||
// object.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
Buffer* getBuffer();
|
||||
|
||||
private:
|
||||
|
@ -16,20 +16,20 @@
|
||||
class Pl_Count: public Pipeline
|
||||
{
|
||||
public:
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
Pl_Count(char const* identifier, Pipeline* next);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual ~Pl_Count();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual void write(unsigned char*, int);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual void finish();
|
||||
// Returns the number of bytes written
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
int getCount() const;
|
||||
// Returns the last character written, or '\0' if no characters
|
||||
// have been written (in which case getCount() returns 0)
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
unsigned char getLastChar() const;
|
||||
|
||||
private:
|
||||
|
@ -19,13 +19,13 @@
|
||||
class Pl_Discard: public Pipeline
|
||||
{
|
||||
public:
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
Pl_Discard();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual ~Pl_Discard();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual void write(unsigned char*, int);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual void finish();
|
||||
};
|
||||
|
||||
|
@ -19,15 +19,15 @@ class Pl_Flate: public Pipeline
|
||||
|
||||
enum action_e { a_inflate, a_deflate };
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
Pl_Flate(char const* identifier, Pipeline* next,
|
||||
action_e action, int out_bufsize = def_bufsize);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual ~Pl_Flate();
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual void write(unsigned char* data, int len);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual void finish();
|
||||
|
||||
private:
|
||||
|
@ -23,14 +23,14 @@ class Pl_StdioFile: public Pipeline
|
||||
public:
|
||||
// f is externally maintained; this class just writes to and
|
||||
// flushes it. It does not close it.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
Pl_StdioFile(char const* identifier, FILE* f);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual ~Pl_StdioFile();
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual void write(unsigned char* buf, int len);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual void finish();
|
||||
|
||||
private:
|
||||
|
@ -28,9 +28,9 @@ class QPDFExc;
|
||||
class QPDF
|
||||
{
|
||||
public:
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
QPDF();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
~QPDF();
|
||||
|
||||
// Associate a file with a QPDF object and do initial parsing of
|
||||
@ -43,7 +43,7 @@ class QPDF
|
||||
// encrypted,either a null password or an empty password can be
|
||||
// used. If the file is encrypted, either the user password or
|
||||
// the owner password may be supplied.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void processFile(char const* filename, char const* password = 0);
|
||||
|
||||
// Parameter settings
|
||||
@ -52,21 +52,21 @@ class QPDF
|
||||
// (one that contains both cross-reference streams and
|
||||
// cross-reference tables). This can be useful for testing to
|
||||
// ensure that a hybrid file would work with an older reader.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void setIgnoreXRefStreams(bool);
|
||||
|
||||
// By default, any warnings are issued to stderr as they are
|
||||
// encountered. If this is called with a true value, reporting of
|
||||
// warnings is suppressed. You may still retrieve warnings by
|
||||
// calling getWarnings.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void setSuppressWarnings(bool);
|
||||
|
||||
// By default, QPDF will try to recover if it finds certain types
|
||||
// of errors in PDF files. If turned off, it will throw an
|
||||
// exception on the first such problem it finds without attempting
|
||||
// recovery.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void setAttemptRecovery(bool);
|
||||
|
||||
// Other public methods
|
||||
@ -76,26 +76,26 @@ class QPDF
|
||||
// throws an exception. Note that if setSuppressWarnings was not
|
||||
// called or was called with a false value, any warnings retrieved
|
||||
// here will have already been issued to stderr.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
std::vector<QPDFExc> getWarnings();
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
std::string getFilename() const;
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
std::string getPDFVersion() const;
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
QPDFObjectHandle getTrailer();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
QPDFObjectHandle getRoot();
|
||||
|
||||
// Install this object handle as an indirect object and return an
|
||||
// indirect reference to it.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
QPDFObjectHandle makeIndirectObject(QPDFObjectHandle);
|
||||
|
||||
// Retrieve an object by object ID and generation. Returns an
|
||||
// indirect reference to it.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
QPDFObjectHandle getObjectByID(int objid, int generation);
|
||||
|
||||
// Encryption support
|
||||
@ -128,46 +128,46 @@ class QPDF
|
||||
bool encrypt_metadata;
|
||||
};
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
bool isEncrypted() const;
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
bool isEncrypted(int& R, int& P);
|
||||
|
||||
// Encryption permissions -- not enforced by QPDF
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
bool allowAccessibility();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
bool allowExtractAll();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
bool allowPrintLowRes();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
bool allowPrintHighRes();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
bool allowModifyAssembly();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
bool allowModifyForm();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
bool allowModifyAnnotation();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
bool allowModifyOther();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
bool allowModifyAll();
|
||||
|
||||
// Helper function to trim padding from user password. Calling
|
||||
// trim_user_password on the result of getPaddedUserPassword gives
|
||||
// getTrimmedUserPassword's result.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
static void trim_user_password(std::string& user_password);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
static std::string compute_data_key(
|
||||
std::string const& encryption_key, int objid, int generation,
|
||||
bool use_aes);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
static std::string compute_encryption_key(
|
||||
std::string const& password, EncryptionData const& data);
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
static void compute_encryption_O_U(
|
||||
char const* user_password, char const* owner_password,
|
||||
int V, int R, int key_len, int P, bool encrypt_metadata,
|
||||
@ -176,23 +176,23 @@ class QPDF
|
||||
// Return the full user password as stored in the PDF file. If
|
||||
// you are attempting to recover the user password in a
|
||||
// user-presentable form, call getTrimmedUserPassword() instead.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
std::string const& getPaddedUserPassword() const;
|
||||
// Return human-readable form of user password.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
std::string getTrimmedUserPassword() const;
|
||||
|
||||
// Linearization support
|
||||
|
||||
// Returns true iff the file starts with a linearization parameter
|
||||
// dictionary. Does no additional validation.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
bool isLinearized();
|
||||
|
||||
// Performs various sanity checks on a linearized file. Return
|
||||
// true if no errors or warnings. Otherwise, return false and
|
||||
// output errors and warnings to stdout.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
bool checkLinearization();
|
||||
|
||||
// Calls checkLinearization() and, if possible, prints normalized
|
||||
@ -200,11 +200,11 @@ class QPDF
|
||||
// includes adding min values to delta values and adjusting
|
||||
// offsets based on the location and size of the primary hint
|
||||
// stream.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void showLinearizationData();
|
||||
|
||||
// Shows the contents of the cross-reference table
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void showXRefTable();
|
||||
|
||||
// Optimization support -- see doc/optimization. Implemented in
|
||||
@ -218,31 +218,31 @@ class QPDF
|
||||
// This is available so that the test suite can make sure that a
|
||||
// linearized file is already optimized. When called in this way,
|
||||
// optimize() still populates the object <-> user maps
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void optimize(std::map<int, int> const& object_stream_data,
|
||||
bool allow_changes = true);
|
||||
|
||||
// Replace all references to indirect objects that are "scalars"
|
||||
// (i.e., things that don't have children: not arrays, streams, or
|
||||
// dictionaries) with direct objects.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void flattenScalarReferences();
|
||||
|
||||
// Decode all streams, discarding the output. Used to check
|
||||
// correctness of stream encoding.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void decodeStreams();
|
||||
|
||||
// For QPDFWriter:
|
||||
|
||||
// Remove /ID, /Encrypt, and /Prev keys from the trailer
|
||||
// dictionary since these are regenerated during write.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void trimTrailerForWrite();
|
||||
|
||||
// Get lists of all objects in order according to the part of a
|
||||
// linearized file that they belong to.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void getLinearizedParts(
|
||||
std::map<int, int> const& object_stream_data,
|
||||
std::vector<QPDFObjectHandle>& part4,
|
||||
@ -251,7 +251,7 @@ class QPDF
|
||||
std::vector<QPDFObjectHandle>& part8,
|
||||
std::vector<QPDFObjectHandle>& part9);
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void generateHintStream(std::map<int, QPDFXRefEntry> const& xref,
|
||||
std::map<int, size_t> const& lengths,
|
||||
std::map<int, int> const& obj_renumber,
|
||||
@ -259,18 +259,18 @@ class QPDF
|
||||
int& S, int& O);
|
||||
|
||||
// Map object to object stream that contains it
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void getObjectStreamData(std::map<int, int>&);
|
||||
// Get a list of objects that would be permitted in an object
|
||||
// stream
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
std::vector<int> getCompressibleObjects();
|
||||
|
||||
// Convenience routines for common functions. See also
|
||||
// QPDFObjectHandle.hh for additional convenience routines.
|
||||
|
||||
// Traverse page tree return all /Page objects.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
std::vector<QPDFObjectHandle> const& getAllPages();
|
||||
|
||||
// Resolver class is restricted to QPDFObjectHandle so that only
|
||||
|
@ -15,13 +15,13 @@
|
||||
class QPDFExc: public std::runtime_error
|
||||
{
|
||||
public:
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
QPDFExc(qpdf_error_code_e error_code,
|
||||
std::string const& filename,
|
||||
std::string const& object,
|
||||
off_t offset,
|
||||
std::string const& message);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual ~QPDFExc() throw ();
|
||||
|
||||
// To get a complete error string, call what(), provided by
|
||||
@ -34,15 +34,15 @@ class QPDFExc: public std::runtime_error
|
||||
// the underlying issue, but it is more programmer-friendly than
|
||||
// trying to parse a string that is subject to change.
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
qpdf_error_code_e getErrorCode() const;
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
std::string const& getFilename() const;
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
std::string const& getObject() const;
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
off_t getFilePosition() const;
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
std::string const& getMessageDetail() const;
|
||||
|
||||
private:
|
||||
|
@ -26,58 +26,58 @@ class QPDF;
|
||||
class QPDFObjectHandle
|
||||
{
|
||||
public:
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
QPDFObjectHandle();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
bool isInitialized() const;
|
||||
|
||||
// Exactly one of these will return true for any object.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
bool isBool();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
bool isNull();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
bool isInteger();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
bool isReal();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
bool isName();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
bool isString();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
bool isArray();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
bool isDictionary();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
bool isStream();
|
||||
|
||||
// This returns true in addition to the query for the specific
|
||||
// type for indirect objects.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
bool isIndirect();
|
||||
|
||||
// True for everything except array, dictionary, and stream
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
bool isScalar();
|
||||
|
||||
// Public factory methods
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
static QPDFObjectHandle newNull();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
static QPDFObjectHandle newBool(bool value);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
static QPDFObjectHandle newInteger(int value);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
static QPDFObjectHandle newReal(std::string const& value);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
static QPDFObjectHandle newName(std::string const& name);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
static QPDFObjectHandle newString(std::string const& str);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
static QPDFObjectHandle newArray(
|
||||
std::vector<QPDFObjectHandle> const& items);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
static QPDFObjectHandle newDictionary(
|
||||
std::map<std::string, QPDFObjectHandle> const& items);
|
||||
|
||||
@ -86,78 +86,78 @@ class QPDFObjectHandle
|
||||
// type, an exception is thrown.
|
||||
|
||||
// Methods for bool objects
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
bool getBoolValue();
|
||||
|
||||
// Methods for integer objects
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
int getIntValue();
|
||||
|
||||
// Methods for real objects
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
std::string getRealValue();
|
||||
|
||||
// Methods that work for both integer and real objects
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
bool isNumber();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
double getNumericValue();
|
||||
|
||||
// Methods for name objects; see also name and array objects
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
std::string getName();
|
||||
|
||||
// Methods for string objects
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
std::string getStringValue();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
std::string getUTF8Value();
|
||||
|
||||
// Methods for array objects; see also name and array objects
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
int getArrayNItems();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
QPDFObjectHandle getArrayItem(int n);
|
||||
|
||||
// Methods for dictionary objects
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
bool hasKey(std::string const&);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
QPDFObjectHandle getKey(std::string const&);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
std::set<std::string> getKeys();
|
||||
|
||||
// Methods for name and array objects
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
bool isOrHasName(std::string const&);
|
||||
|
||||
// Mutator methods. Use with caution.
|
||||
|
||||
// Recursively copy this object, making it direct. Throws an
|
||||
// exception if a loop is detected or any sub-object is a stream.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void makeDirect();
|
||||
|
||||
// Mutator methods for array objects
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void setArrayItem(int, QPDFObjectHandle const&);
|
||||
|
||||
// Mutator methods for dictionary objects
|
||||
|
||||
// Replace value of key, adding it if it does not exist
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void replaceKey(std::string const& key, QPDFObjectHandle const&);
|
||||
// Remove key, doing nothing if key does not exist
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void removeKey(std::string const& key);
|
||||
|
||||
// Methods for stream objects
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
QPDFObjectHandle getDict();
|
||||
|
||||
// Returns filtered (uncompressed) stream data. Throws an
|
||||
// exception if the stream is filtered and we can't decode it.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
PointerHolder<Buffer> getStreamData();
|
||||
|
||||
// Write stream data through the given pipeline. A null pipeline
|
||||
@ -177,19 +177,19 @@ class QPDFObjectHandle
|
||||
// value of this function to determine whether or not the /Filter
|
||||
// and /DecodeParms keys in the stream dictionary should be
|
||||
// replaced if writing a new stream object.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
bool pipeStreamData(Pipeline*, bool filter,
|
||||
bool normalize, bool compress);
|
||||
|
||||
// return 0 for direct objects
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
int getObjectID() const;
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
int getGeneration() const;
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
std::string unparse();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
std::string unparseResolved();
|
||||
|
||||
// Convenience routines for commonly performed functions
|
||||
@ -199,7 +199,7 @@ class QPDFObjectHandle
|
||||
// function does not presently support inherited resources. See
|
||||
// comment in the source for details. Return value is a map from
|
||||
// XObject name to the image object, which is always a stream.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
std::map<std::string, QPDFObjectHandle> getPageImages();
|
||||
|
||||
// Throws an exception if this is not a Page object. Returns a
|
||||
@ -207,7 +207,7 @@ class QPDFObjectHandle
|
||||
// the given page. This routine allows the caller to not care
|
||||
// whether there are one or more than one content streams for a
|
||||
// page.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
std::vector<QPDFObjectHandle> getPageContents();
|
||||
|
||||
// Initializers for objects. This Factory class gives the QPDF
|
||||
|
@ -84,7 +84,7 @@ class QPDFTokenizer
|
||||
std::string error_message;
|
||||
};
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
QPDFTokenizer();
|
||||
|
||||
// PDF files with version < 1.2 allowed the pound character
|
||||
@ -92,7 +92,7 @@ class QPDFTokenizer
|
||||
// character was allowed only when followed by two hexadecimal
|
||||
// digits. This method should be called when parsing a PDF file
|
||||
// whose version is older than 1.2.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void allowPoundAnywhereInName();
|
||||
|
||||
// Mode of operation:
|
||||
@ -103,23 +103,23 @@ class QPDFTokenizer
|
||||
|
||||
// It these are called when a token is available, an exception
|
||||
// will be thrown.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void presentCharacter(char ch);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void presentEOF();
|
||||
|
||||
// If a token is available, return true and initialize token with
|
||||
// the token, unread_char with whether or not we have to unread
|
||||
// the last character, and if unread_char, ch with the character
|
||||
// to unread.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
bool getToken(Token& token, bool& unread_char, char& ch);
|
||||
|
||||
// This function returns true of the current character is between
|
||||
// tokens (i.e., white space that is not part of a string) or is
|
||||
// part of a comment. A tokenizing filter can call this to
|
||||
// determine whether to output the character.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
bool betweenTokens();
|
||||
|
||||
private:
|
||||
|
@ -42,9 +42,9 @@ class QPDFWriter
|
||||
// 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
|
||||
QPDF_DLL
|
||||
QPDFWriter(QPDF& pdf, char const* filename);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
~QPDFWriter();
|
||||
|
||||
// Set the value of object stream mode. In disable mode, we never
|
||||
@ -54,7 +54,7 @@ class QPDFWriter
|
||||
// generate a conventional cross-reference table if there are no
|
||||
// object streams and a cross-reference stream if there are object
|
||||
// streams. The default is o_preserve.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void setObjectStreamMode(qpdf_object_stream_e);
|
||||
|
||||
// Set value of stream data mode. In uncompress mode, we attempt
|
||||
@ -62,7 +62,7 @@ class QPDFWriter
|
||||
// preserve any filtering applied to streams. In compress mode,
|
||||
// if we can apply all filters and the stream is not already
|
||||
// optimally compressed, recompress the stream.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void setStreamDataMode(qpdf_stream_data_e);
|
||||
|
||||
// Set value of content stream normalization. The default is
|
||||
@ -72,7 +72,7 @@ class QPDFWriter
|
||||
// damage the content stream. This flag should be used only for
|
||||
// debugging and experimenting with PDF content streams. Never
|
||||
// use it for production files.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void setContentNormalization(bool);
|
||||
|
||||
// Set QDF mode. QDF mode causes special "pretty printing" of
|
||||
@ -80,7 +80,7 @@ class QPDFWriter
|
||||
// Resulting PDF files can be edited in a text editor and then run
|
||||
// through fix-qdf to update cross reference tables and stream
|
||||
// lengths.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void setQDFMode(bool);
|
||||
|
||||
// Set the minimum PDF version. If the PDF version of the input
|
||||
@ -92,7 +92,7 @@ class QPDFWriter
|
||||
// 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
|
||||
QPDF_DLL
|
||||
void setMinimumPDFVersion(std::string const&);
|
||||
|
||||
// Force the PDF version of the output file to be a given version.
|
||||
@ -110,32 +110,32 @@ class QPDFWriter
|
||||
// that type of encryption will explicitly disable decryption.
|
||||
// Additionally, forcing to a version below 1.5 will disable
|
||||
// object streams.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void forcePDFVersion(std::string const&);
|
||||
|
||||
// Cause a static /ID value to be generated. Use only in test
|
||||
// suites.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void setStaticID(bool);
|
||||
|
||||
// Use a fixed initialization vector for AES-CBC encryption. This
|
||||
// is not secure. It should be used only in test suites for
|
||||
// creating predictable encrypted output.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void setStaticAesIV(bool);
|
||||
|
||||
// Suppress inclusion of comments indicating original object IDs
|
||||
// when writing QDF files. This can also be useful for testing,
|
||||
// particularly when using comparison of two qdf files to
|
||||
// determine whether two PDF files have identical content.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void setSuppressOriginalObjectIDs(bool);
|
||||
|
||||
// Preserve encryption. The default is true unless prefilering,
|
||||
// content normalization, or qdf mode has been selected in which
|
||||
// case encryption is never preserved. Encryption is also not
|
||||
// preserved if we explicitly set encryption parameters.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void setPreserveEncryption(bool);
|
||||
|
||||
// Set up for encrypted output. Disables stream prefiltering and
|
||||
@ -144,17 +144,17 @@ class QPDFWriter
|
||||
// encryption parameters pushes the PDF version number to at least
|
||||
// 1.4, and setting R4 parameters pushes the version to at least
|
||||
// 1.5, or if AES is used, 1.6.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void setR2EncryptionParameters(
|
||||
char const* user_password, char const* owner_password,
|
||||
bool allow_print, bool allow_modify,
|
||||
bool allow_extract, bool allow_annotate);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void setR3EncryptionParameters(
|
||||
char const* user_password, char const* owner_password,
|
||||
bool allow_accessibility, bool allow_extract,
|
||||
qpdf_r3_print_e print, qpdf_r3_modify_e modify);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void setR4EncryptionParameters(
|
||||
char const* user_password, char const* owner_password,
|
||||
bool allow_accessibility, bool allow_extract,
|
||||
@ -163,16 +163,13 @@ class QPDFWriter
|
||||
|
||||
// Create linearized output. Disables qdf mode, content
|
||||
// normalization, and stream prefiltering.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void setLinearization(bool);
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void write();
|
||||
|
||||
private:
|
||||
QPDFWriter(QPDFWriter const&);
|
||||
QPDFWriter& operator=(QPDFWriter const&);
|
||||
|
||||
// flags used by unparseObject
|
||||
static int const f_stream = 1 << 0;
|
||||
static int const f_filtered = 1 << 1;
|
||||
|
@ -19,18 +19,18 @@ class QPDFXRefEntry
|
||||
// 1 = "uncompressed"; field 1 = offset
|
||||
// 2 = "compressed"; field 1 = object stream number, field 2 = index
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
QPDFXRefEntry();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
QPDFXRefEntry(int type, int field1, int field2);
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
int getType() const;
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
int getOffset() const; // only for type 1
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
int getObjStreamNumber() const; // only for type 2
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
int getObjStreamIndex() const; // only for type 2
|
||||
|
||||
private:
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
namespace QTC
|
||||
{
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void TC(char const* const scope, char const* const ccase, int n = 0);
|
||||
};
|
||||
|
||||
|
@ -19,15 +19,15 @@ namespace QUtil
|
||||
{
|
||||
// This is a collection of useful utility functions that don't
|
||||
// really go anywhere else.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
std::string int_to_string(int, int length = 0);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
std::string double_to_string(double, int decimal_places = 0);
|
||||
|
||||
// Throw std::runtime_error with a string formed by appending to
|
||||
// "description: " the standard string corresponding to the
|
||||
// current value of errno.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void throw_system_error(std::string const& description);
|
||||
|
||||
// The status argument is assumed to be the return value of a
|
||||
@ -35,40 +35,40 @@ namespace QUtil
|
||||
// is -1, convert the current value of errno to a
|
||||
// std::runtime_error that includes the standard error string.
|
||||
// Otherwise, return status.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
int os_wrapper(std::string const& description, int status);
|
||||
|
||||
// The FILE* argument is assumed to be the return of fopen. If
|
||||
// null, throw std::runtime_error. Otherwise, return the FILE*
|
||||
// argument.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
FILE* fopen_wrapper(std::string const&, FILE*);
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
char* copy_string(std::string const&);
|
||||
|
||||
// Set stdin, stdout to binary mode
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void binary_stdout();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void binary_stdin();
|
||||
|
||||
// May modify argv0
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
char* getWhoami(char* argv0);
|
||||
|
||||
// Get the value of an environment variable in a portable fashion.
|
||||
// Returns true iff the variable is defined. If `value' is
|
||||
// non-null, initializes it with the value of the variable.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
bool get_env(std::string const& var, std::string* value = 0);
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
time_t get_current_time();
|
||||
|
||||
// Return a string containing the byte representation of the UTF-8
|
||||
// encoding for the unicode value passed in.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
std::string toUTF8(unsigned long uval);
|
||||
};
|
||||
|
||||
|
@ -87,13 +87,13 @@ extern "C" {
|
||||
/* Returns dynamically allocated qpdf_data pointer; must be freed
|
||||
* by calling qpdf_cleanup.
|
||||
*/
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
qpdf_data qpdf_init();
|
||||
|
||||
/* Pass a pointer to the qpdf_data pointer created by qpdf_init to
|
||||
* clean up resources.
|
||||
*/
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void qpdf_cleanup(qpdf_data* qpdf);
|
||||
|
||||
/* ERROR REPORTING */
|
||||
@ -102,37 +102,37 @@ extern "C" {
|
||||
* pointer to data that will become invalid the next time an error
|
||||
* occurs or after this function is called gain.
|
||||
*/
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
qpdf_error qpdf_get_error(qpdf_data qpdf);
|
||||
|
||||
/* Returns 1 if there are any unretrieved warnings, and zero
|
||||
* otherwise.
|
||||
*/
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
QPDF_BOOL qpdf_more_warnings(qpdf_data qpdf);
|
||||
|
||||
/* If there are any warnings, returns a pointer to the next
|
||||
* warning. Otherwise returns a null pointer.
|
||||
*/
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
qpdf_error qpdf_next_warning(qpdf_data qpdf);
|
||||
|
||||
/* Extract fields of the error. */
|
||||
|
||||
/* Use this function to get a full error message suitable for
|
||||
* showing to the user. */
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
char const* qpdf_get_error_full_text(qpdf_data q, qpdf_error e);
|
||||
|
||||
/* Use these functions to extract individual fields from the
|
||||
* error; see QPDFExc.hh for details. */
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
enum qpdf_error_code_e qpdf_get_error_code(qpdf_data q, qpdf_error e);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
char const* qpdf_get_error_filename(qpdf_data q, qpdf_error e);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
unsigned long qpdf_get_error_file_position(qpdf_data q, qpdf_error e);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
char const* qpdf_get_error_message_detail(qpdf_data q, qpdf_error e);
|
||||
|
||||
/* By default, warnings are written to stderr. Passing true to
|
||||
@ -140,17 +140,17 @@ extern "C" {
|
||||
* stderr. They will still be available by calls to
|
||||
* qpdf_next_warning.
|
||||
*/
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void qpdf_set_suppress_warnings(qpdf_data qpdf, QPDF_BOOL value);
|
||||
|
||||
/* READ FUNCTIONS */
|
||||
|
||||
/* READ PARAMETER FUNCTIONS -- must be called before qpdf_read */
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void qpdf_set_ignore_xref_streams(qpdf_data qpdf, QPDF_BOOL value);
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void qpdf_set_attempt_recovery(qpdf_data qpdf, QPDF_BOOL value);
|
||||
|
||||
/* Calling qpdf_read causes processFile to be called in the C++
|
||||
@ -158,14 +158,14 @@ extern "C" {
|
||||
* only read as needed. For files without passwords, pass a null
|
||||
* pointer as the password.
|
||||
*/
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
QPDF_ERROR_CODE qpdf_read(qpdf_data qpdf, char const* filename,
|
||||
char const* password);
|
||||
|
||||
/* Read functions below must be called after qpdf_read. */
|
||||
|
||||
/* Return the version of the PDF file. */
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
char const* qpdf_get_pdf_version(qpdf_data qpdf);
|
||||
|
||||
/* Return the user password. If the file is opened using the
|
||||
@ -173,34 +173,34 @@ extern "C" {
|
||||
* function. If the file is opened using the user password, this
|
||||
* function will return that user password.
|
||||
*/
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
char const* qpdf_get_user_password(qpdf_data qpdf);
|
||||
|
||||
/* Indicate whether the input file is linearized. */
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
QPDF_BOOL qpdf_is_linearized(qpdf_data qpdf);
|
||||
|
||||
/* Indicate whether the input file is encrypted. */
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
QPDF_BOOL qpdf_is_encrypted(qpdf_data qpdf);
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
QPDF_BOOL qpdf_allow_accessibility(qpdf_data qpdf);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
QPDF_BOOL qpdf_allow_extract_all(qpdf_data qpdf);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
QPDF_BOOL qpdf_allow_print_low_res(qpdf_data qpdf);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
QPDF_BOOL qpdf_allow_print_high_res(qpdf_data qpdf);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
QPDF_BOOL qpdf_allow_modify_assembly(qpdf_data qpdf);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
QPDF_BOOL qpdf_allow_modify_form(qpdf_data qpdf);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
QPDF_BOOL qpdf_allow_modify_annotation(qpdf_data qpdf);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
QPDF_BOOL qpdf_allow_modify_other(qpdf_data qpdf);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
QPDF_BOOL qpdf_allow_modify_all(qpdf_data qpdf);
|
||||
|
||||
/* WRITE FUNCTIONS */
|
||||
@ -219,72 +219,72 @@ extern "C" {
|
||||
* etc.) is lost, so any write parameter functions must be called
|
||||
* again.
|
||||
*/
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
QPDF_ERROR_CODE qpdf_init_write(qpdf_data qpdf, char const* filename);
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void qpdf_set_object_stream_mode(qpdf_data qpdf,
|
||||
enum qpdf_object_stream_e mode);
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void qpdf_set_stream_data_mode(qpdf_data qpdf,
|
||||
enum qpdf_stream_data_e mode);
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void qpdf_set_content_normalization(qpdf_data qpdf, QPDF_BOOL value);
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void qpdf_set_qdf_mode(qpdf_data qpdf, QPDF_BOOL value);
|
||||
|
||||
/* Never use qpdf_set_static_ID except in test suites to suppress
|
||||
* generation of a random /ID.
|
||||
*/
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void qpdf_set_static_ID(qpdf_data qpdf, QPDF_BOOL value);
|
||||
|
||||
/* Never use qpdf_set_static_aes_IV except in test suites to
|
||||
* create predictable AES encrypted output.
|
||||
*/
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void qpdf_set_static_aes_IV(qpdf_data qpdf, QPDF_BOOL value);
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void qpdf_set_suppress_original_object_IDs(
|
||||
qpdf_data qpdf, QPDF_BOOL value);
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void qpdf_set_preserve_encryption(qpdf_data qpdf, QPDF_BOOL value);
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void qpdf_set_r2_encryption_parameters(
|
||||
qpdf_data qpdf, char const* user_password, char const* owner_password,
|
||||
QPDF_BOOL allow_print, QPDF_BOOL allow_modify,
|
||||
QPDF_BOOL allow_extract, QPDF_BOOL allow_annotate);
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void qpdf_set_r3_encryption_parameters(
|
||||
qpdf_data qpdf, char const* user_password, char const* owner_password,
|
||||
QPDF_BOOL allow_accessibility, QPDF_BOOL allow_extract,
|
||||
enum qpdf_r3_print_e print, enum qpdf_r3_modify_e modify);
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void qpdf_set_r4_encryption_parameters(
|
||||
qpdf_data qpdf, char const* user_password, char const* owner_password,
|
||||
QPDF_BOOL allow_accessibility, QPDF_BOOL allow_extract,
|
||||
enum qpdf_r3_print_e print, enum qpdf_r3_modify_e modify,
|
||||
QPDF_BOOL encrypt_metadata, QPDF_BOOL use_aes);
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void qpdf_set_linearization(qpdf_data qpdf, QPDF_BOOL value);
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void qpdf_set_minimum_pdf_version(qpdf_data qpdf, char const* version);
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void qpdf_force_pdf_version(qpdf_data qpdf, char const* version);
|
||||
|
||||
/* Do actual write operation. */
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
QPDF_ERROR_CODE qpdf_write(qpdf_data qpdf);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -8,13 +8,13 @@
|
||||
class BitStream
|
||||
{
|
||||
public:
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
BitStream(unsigned char const* p, int nbytes);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void reset();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
unsigned long getBits(int nbits);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void skipToNextByte();
|
||||
|
||||
private:
|
||||
|
@ -12,12 +12,12 @@ class BitWriter
|
||||
public:
|
||||
// Write bits to the pipeline. It is the caller's responsibility
|
||||
// to eventually call finish on the pipeline.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
BitWriter(Pipeline* pl);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void writeBits(unsigned long val, int bits);
|
||||
// Force any partial byte to be written to the pipeline.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void flush();
|
||||
|
||||
private:
|
||||
|
@ -13,50 +13,50 @@ class MD5
|
||||
public:
|
||||
typedef unsigned char Digest[16];
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
MD5();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void reset();
|
||||
|
||||
// encodes string and finalizes
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void encodeString(char const* input_string);
|
||||
|
||||
// encodes file and finalizes
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void encodeFile(char const* filename, int up_to_size = -1);
|
||||
|
||||
// appends string to current md5 object
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void appendString(char const* input_string);
|
||||
|
||||
// appends arbitrary data to current md5 object
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void encodeDataIncrementally(char const* input_data, int len);
|
||||
|
||||
// computes a raw digest
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void digest(Digest);
|
||||
|
||||
// prints the digest to stdout terminated with \r\n (primarily for
|
||||
// testing)
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void print();
|
||||
|
||||
// returns the digest as a hexadecimal string
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
std::string unparse();
|
||||
|
||||
// Convenience functions
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
static std::string getDataChecksum(char const* buf, int len);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
static std::string getFileChecksum(char const* filename,
|
||||
int up_to_size = -1);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
static bool checkDataChecksum(char const* const checksum,
|
||||
char const* buf, int len);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
static bool checkFileChecksum(char const* const checksum,
|
||||
char const* filename, int up_to_size = -1);
|
||||
|
||||
|
@ -25,7 +25,7 @@ class PCRE
|
||||
class NoBackref: public std::logic_error
|
||||
{
|
||||
public:
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
NoBackref();
|
||||
virtual ~NoBackref() throw() {}
|
||||
};
|
||||
@ -34,15 +34,15 @@ class PCRE
|
||||
{
|
||||
friend class PCRE;
|
||||
public:
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
Match(int nbackrefs, char const* subject);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
Match(Match const&);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
Match& operator=(Match const&);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
~Match();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
operator bool();
|
||||
|
||||
// All the back reference accessing routines may throw the
|
||||
@ -54,13 +54,13 @@ class PCRE
|
||||
// and not matching at all.
|
||||
|
||||
// see getMatch flags below
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
std::string getMatch(int n, int flags = 0);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void getOffsetLength(int n, int& offset, int& length);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
int getOffset(int n);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
int getLength(int n);
|
||||
|
||||
// nMatches returns the number of available matches including
|
||||
@ -70,7 +70,7 @@ class PCRE
|
||||
// will return the whole string, getMatch(1) will return the
|
||||
// text that matched the backreference, and getMatch(2) will
|
||||
// throw an exception because it is out of range.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
int nMatches() const;
|
||||
|
||||
// Flags for getMatch
|
||||
@ -93,16 +93,16 @@ class PCRE
|
||||
|
||||
// The value passed in as options is passed to pcre_exec. See man
|
||||
// pcreapi for details.
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
PCRE(char const* pattern, int options = 0);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
~PCRE();
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
Match match(char const* subject, int options = 0, int startoffset = 0,
|
||||
int size = -1);
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
static void test(int n = 0);
|
||||
|
||||
private:
|
||||
|
@ -12,22 +12,22 @@ class Pl_AES_PDF: public Pipeline
|
||||
public:
|
||||
// key_data should be a pointer to key_size bytes of data
|
||||
static unsigned int const key_size = 16;
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
Pl_AES_PDF(char const* identifier, Pipeline* next,
|
||||
bool encrypt, unsigned char const key[key_size]);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual ~Pl_AES_PDF();
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual void write(unsigned char* data, int len);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual void finish();
|
||||
|
||||
// For testing only; PDF always uses CBC
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
void disableCBC();
|
||||
// For testing only: use a fixed initialization vector for CBC
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
static void useStaticIV();
|
||||
|
||||
private:
|
||||
|
@ -6,13 +6,13 @@
|
||||
class Pl_ASCII85Decoder: public Pipeline
|
||||
{
|
||||
public:
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
Pl_ASCII85Decoder(char const* identifier, Pipeline* next);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual ~Pl_ASCII85Decoder();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual void write(unsigned char* buf, int len);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual void finish();
|
||||
|
||||
private:
|
||||
|
@ -6,13 +6,13 @@
|
||||
class Pl_ASCIIHexDecoder: public Pipeline
|
||||
{
|
||||
public:
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
Pl_ASCIIHexDecoder(char const* identifier, Pipeline* next);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual ~Pl_ASCIIHexDecoder();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual void write(unsigned char* buf, int len);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual void finish();
|
||||
|
||||
private:
|
||||
|
@ -9,14 +9,14 @@
|
||||
class Pl_LZWDecoder: public Pipeline
|
||||
{
|
||||
public:
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
Pl_LZWDecoder(char const* identifier, Pipeline* next,
|
||||
bool early_code_change);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual ~Pl_LZWDecoder();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual void write(unsigned char* buf, int len);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual void finish();
|
||||
|
||||
private:
|
||||
|
@ -15,15 +15,15 @@
|
||||
class Pl_MD5: public Pipeline
|
||||
{
|
||||
public:
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
Pl_MD5(char const* identifier, Pipeline* next);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual ~Pl_MD5();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual void write(unsigned char*, int);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual void finish();
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
std::string getHexDigest();
|
||||
|
||||
private:
|
||||
|
@ -22,16 +22,16 @@ class Pl_PNGFilter: public Pipeline
|
||||
// Encoding is not presently supported
|
||||
enum action_e { a_encode, a_decode };
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
Pl_PNGFilter(char const* identifier, Pipeline* next,
|
||||
action_e action, unsigned int columns,
|
||||
unsigned int bytes_per_pixel);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual ~Pl_PNGFilter();
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual void write(unsigned char* data, int len);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual void finish();
|
||||
|
||||
private:
|
||||
|
@ -11,16 +11,16 @@ class Pl_RC4: public Pipeline
|
||||
static int const def_bufsize = 65536;
|
||||
|
||||
// key_len of -1 means treat key_data as a null-terminated string
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
Pl_RC4(char const* identifier, Pipeline* next,
|
||||
unsigned char const* key_data, int key_len = -1,
|
||||
int out_bufsize = def_bufsize);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual ~Pl_RC4();
|
||||
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual void write(unsigned char* data, int len);
|
||||
DLL_EXPORT
|
||||
QPDF_DLL
|
||||
virtual void finish();
|
||||
|
||||
private:
|
||||
|
@ -33,8 +33,23 @@ define c_compile
|
||||
-c $(1) -o $(call c_src_to_obj,$(1))
|
||||
endef
|
||||
|
||||
libcompile = $(compile)
|
||||
c_libcompile = $(c_compile)
|
||||
# 1 2
|
||||
# Usage: $(call libcompile,src,includes)
|
||||
define libcompile
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -DDLL_EXPORT \
|
||||
$(call depflags,$(basename $(call src_to_obj,$(1)))) \
|
||||
$(foreach I,$(2),-I$(I)) \
|
||||
-c $(1) -o $(call src_to_obj,$(1))
|
||||
endef
|
||||
|
||||
# 1 2
|
||||
# Usage: $(call c_libcompile,src,includes)
|
||||
define c_libcompile
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) -DDLL_EXPORT \
|
||||
$(call depflags,$(basename $(call src_to_obj,$(1)))) \
|
||||
$(foreach I,$(2),-I$(I)) \
|
||||
-c $(1) -o $(call c_src_to_obj,$(1))
|
||||
endef
|
||||
|
||||
# 1 2
|
||||
# Usage: $(call makeslib,objs,library)
|
||||
|
17
make/msvc.mk
17
make/msvc.mk
@ -40,8 +40,21 @@ define c_compile
|
||||
/c $(1) /Fo$(call c_src_to_obj,$(1))
|
||||
endef
|
||||
|
||||
libcompile = $(compile)
|
||||
c_libcompile = $(c_compile)
|
||||
# 1 2
|
||||
# Usage: $(call libcompile,src,includes)
|
||||
define libcompile
|
||||
cl /nologo /Zi /Gy /EHsc /MD /TP /GR $(CPPFLAGS) $(CXXFLAGS) \
|
||||
-DDLL_EXPORT $(foreach I,$(2),-I$(I)) \
|
||||
/c $(1) /Fo$(call src_to_obj,$(1))
|
||||
endef
|
||||
|
||||
# 1 2
|
||||
# Usage: $(call c_libcompile,src,includes)
|
||||
define c_libcompile
|
||||
cl /nologo /Zi /Gy /EHsc /MD $(CPPFLAGS) $(CXXFLAGS) \
|
||||
-DDLL_EXPORT $(foreach I,$(2),-I$(I)) \
|
||||
/c $(1) /Fo$(call c_src_to_obj,$(1))
|
||||
endef
|
||||
|
||||
# 1 2
|
||||
# Usage: $(call makeslib,objs,library)
|
||||
|
Loading…
x
Reference in New Issue
Block a user