aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/qpdf/Buffer.hh10
-rw-r--r--include/qpdf/Pipeline.hh8
-rw-r--r--include/qpdf/Pl_Count.hh6
-rw-r--r--include/qpdf/Pl_Discard.hh4
-rw-r--r--include/qpdf/Pl_Flate.hh6
-rw-r--r--include/qpdf/Pl_StdioFile.hh6
-rw-r--r--include/qpdf/QEXC.hh16
-rw-r--r--include/qpdf/QPDF.hh34
-rw-r--r--include/qpdf/QPDFExc.hh3
-rw-r--r--include/qpdf/QPDFObject.hh4
-rw-r--r--include/qpdf/QPDFObjectHandle.hh49
-rw-r--r--include/qpdf/QPDFTokenizer.hh16
-rw-r--r--include/qpdf/QPDFWriter.hh15
-rw-r--r--include/qpdf/QPDFXRefEntry.hh8
-rw-r--r--include/qpdf/QTC.hh3
-rw-r--r--include/qpdf/QUtil.hh11
-rw-r--r--libqpdf/Buffer.cc8
-rw-r--r--libqpdf/Pipeline.cc2
-rw-r--r--libqpdf/Pl_Count.cc6
-rw-r--r--libqpdf/Pl_Discard.cc4
-rw-r--r--libqpdf/Pl_Flate.cc4
-rw-r--r--libqpdf/Pl_StdioFile.cc4
-rw-r--r--libqpdf/QEXC.cc10
-rw-r--r--libqpdf/QPDF.cc19
-rw-r--r--libqpdf/QPDFExc.cc3
-rw-r--r--libqpdf/QPDFObjectHandle.cc46
-rw-r--r--libqpdf/QPDFTokenizer.cc6
-rw-r--r--libqpdf/QPDFXRefEntry.cc6
-rw-r--r--libqpdf/QPDF_encryption.cc5
-rw-r--r--libqpdf/QPDF_linearization.cc5
-rw-r--r--libqpdf/QPDF_optimization.cc2
-rw-r--r--libqpdf/QTC.cc1
-rw-r--r--libqpdf/QUtil.cc11
33 files changed, 341 insertions, 0 deletions
diff --git a/include/qpdf/Buffer.hh b/include/qpdf/Buffer.hh
index a7a7ceae..c4f03768 100644
--- a/include/qpdf/Buffer.hh
+++ b/include/qpdf/Buffer.hh
@@ -8,16 +8,26 @@
#ifndef __BUFFER_HH__
#define __BUFFER_HH__
+#include <qpdf/DLL.hh>
+
class Buffer
{
public:
+ DLL_EXPORT
Buffer();
+ DLL_EXPORT
Buffer(unsigned long size);
+ DLL_EXPORT
Buffer(Buffer const&);
+ DLL_EXPORT
Buffer& operator=(Buffer const&);
+ DLL_EXPORT
~Buffer();
+ DLL_EXPORT
unsigned long getSize() const;
+ DLL_EXPORT
unsigned char const* getBuffer() const;
+ DLL_EXPORT
unsigned char* getBuffer();
private:
diff --git a/include/qpdf/Pipeline.hh b/include/qpdf/Pipeline.hh
index d925d9c6..358bcb03 100644
--- a/include/qpdf/Pipeline.hh
+++ b/include/qpdf/Pipeline.hh
@@ -30,6 +30,8 @@
#ifndef __PIPELINE_HH__
#define __PIPELINE_HH__
+#include <qpdf/DLL.hh>
+
#include <qpdf/QEXC.hh>
class Pipeline
@@ -38,24 +40,30 @@ class Pipeline
class Exception: public QEXC::General
{
public:
+ DLL_EXPORT
Exception(std::string const& message) :
QEXC::General(message)
{
}
+ DLL_EXPORT
virtual ~Exception() throw()
{
}
};
+ DLL_EXPORT
Pipeline(char const* identifier, Pipeline* next);
+ DLL_EXPORT
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
virtual void write(unsigned char* data, int len) = 0;
+ DLL_EXPORT
virtual void finish() = 0;
protected:
diff --git a/include/qpdf/Pl_Count.hh b/include/qpdf/Pl_Count.hh
index 952447e9..1fd4c94a 100644
--- a/include/qpdf/Pl_Count.hh
+++ b/include/qpdf/Pl_Count.hh
@@ -16,14 +16,20 @@
class Pl_Count: public Pipeline
{
public:
+ DLL_EXPORT
Pl_Count(char const* identifier, Pipeline* next);
+ DLL_EXPORT
virtual ~Pl_Count();
+ DLL_EXPORT
virtual void write(unsigned char*, int);
+ DLL_EXPORT
virtual void finish();
// Returns the number of bytes written
+ DLL_EXPORT
int getCount() const;
// Returns the last character written, or '\0' if no characters
// have been written (in which case getCount() returns 0)
+ DLL_EXPORT
unsigned char getLastChar() const;
private:
diff --git a/include/qpdf/Pl_Discard.hh b/include/qpdf/Pl_Discard.hh
index 57bc491c..f99112b2 100644
--- a/include/qpdf/Pl_Discard.hh
+++ b/include/qpdf/Pl_Discard.hh
@@ -19,9 +19,13 @@
class Pl_Discard: public Pipeline
{
public:
+ DLL_EXPORT
Pl_Discard();
+ DLL_EXPORT
virtual ~Pl_Discard();
+ DLL_EXPORT
virtual void write(unsigned char*, int);
+ DLL_EXPORT
virtual void finish();
};
diff --git a/include/qpdf/Pl_Flate.hh b/include/qpdf/Pl_Flate.hh
index f9181319..60b3fd8a 100644
--- a/include/qpdf/Pl_Flate.hh
+++ b/include/qpdf/Pl_Flate.hh
@@ -18,11 +18,13 @@ class Pl_Flate: public Pipeline
class Exception: public Pipeline::Exception
{
public:
+ DLL_EXPORT
Exception(std::string const& message) :
Pipeline::Exception(message)
{
}
+ DLL_EXPORT
virtual ~Exception() throw ()
{
}
@@ -32,11 +34,15 @@ class Pl_Flate: public Pipeline
enum action_e { a_inflate, a_deflate };
+ DLL_EXPORT
Pl_Flate(char const* identifier, Pipeline* next,
action_e action, int out_bufsize = def_bufsize);
+ DLL_EXPORT
virtual ~Pl_Flate();
+ DLL_EXPORT
virtual void write(unsigned char* data, int len);
+ DLL_EXPORT
virtual void finish();
private:
diff --git a/include/qpdf/Pl_StdioFile.hh b/include/qpdf/Pl_StdioFile.hh
index 04e5d7d1..84324d54 100644
--- a/include/qpdf/Pl_StdioFile.hh
+++ b/include/qpdf/Pl_StdioFile.hh
@@ -24,11 +24,13 @@ class Pl_StdioFile: public Pipeline
class Exception: public Pipeline::Exception
{
public:
+ DLL_EXPORT
Exception(std::string const& message) :
Pipeline::Exception(message)
{
}
+ DLL_EXPORT
virtual ~Exception() throw ()
{
}
@@ -36,10 +38,14 @@ class Pl_StdioFile: public Pipeline
// f is externally maintained; this class just writes to and
// flushes it. It does not close it.
+ DLL_EXPORT
Pl_StdioFile(char const* identifier, FILE* f);
+ DLL_EXPORT
virtual ~Pl_StdioFile();
+ DLL_EXPORT
virtual void write(unsigned char* buf, int len);
+ DLL_EXPORT
virtual void finish();
private:
diff --git a/include/qpdf/QEXC.hh b/include/qpdf/QEXC.hh
index 314b084b..49be72a8 100644
--- a/include/qpdf/QEXC.hh
+++ b/include/qpdf/QEXC.hh
@@ -8,6 +8,8 @@
#ifndef __QEXC_HH__
#define __QEXC_HH__
+#include <qpdf/DLL.hh>
+
#include <string>
#include <exception>
#include <errno.h>
@@ -69,13 +71,19 @@ namespace QEXC
// Application/library code should not generally catch this
// directly. See above for caveats.
public:
+ DLL_EXPORT
Base();
+ DLL_EXPORT
Base(std::string const& message);
+ DLL_EXPORT
virtual ~Base() throw() {}
+ DLL_EXPORT
virtual std::string const& unparse() const;
+ DLL_EXPORT
virtual const char* what() const throw();
protected:
+ DLL_EXPORT
void setMessage(std::string const& message);
private:
@@ -87,8 +95,11 @@ namespace QEXC
// This is the base class for normal user/library-defined
// error conditions.
public:
+ DLL_EXPORT
General();
+ DLL_EXPORT
General(std::string const& message);
+ DLL_EXPORT
virtual ~General() throw() {};
};
@@ -100,15 +111,20 @@ namespace QEXC
class Internal: public Base
{
public:
+ DLL_EXPORT
Internal(std::string const& message);
+ DLL_EXPORT
virtual ~Internal() throw() {};
};
class System: public General
{
public:
+ DLL_EXPORT
System(std::string const& prefix, int sys_errno);
+ DLL_EXPORT
virtual ~System() throw() {};
+ DLL_EXPORT
int getErrno() const;
private:
diff --git a/include/qpdf/QPDF.hh b/include/qpdf/QPDF.hh
index 5868268b..400328d7 100644
--- a/include/qpdf/QPDF.hh
+++ b/include/qpdf/QPDF.hh
@@ -13,6 +13,8 @@
#include <map>
#include <list>
+#include <qpdf/DLL.hh>
+
#include <qpdf/QPDFXRefEntry.hh>
#include <qpdf/QPDFObjectHandle.hh>
#include <qpdf/QPDFTokenizer.hh>
@@ -26,7 +28,9 @@ class QPDFExc;
class QPDF
{
public:
+ DLL_EXPORT
QPDF();
+ DLL_EXPORT
~QPDF();
// Associate a file with a QPDF object and do initial parsing of
@@ -36,6 +40,7 @@ class QPDF
// potentially ask for information about the PDF file are called.
// Prior to calling this, the only methods that are allowed are
// those that set parameters.
+ DLL_EXPORT
void processFile(char const* filename, char const* password = "");
// Parameter settings
@@ -44,18 +49,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
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
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
void setAttemptRecovery(bool);
// Other public methods
@@ -65,19 +73,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
std::vector<std::string> getWarnings();
+ DLL_EXPORT
std::string getFilename() const;
+ DLL_EXPORT
std::string getPDFVersion() const;
+ DLL_EXPORT
QPDFObjectHandle getTrailer();
+ DLL_EXPORT
QPDFObjectHandle getRoot();
// Install this object handle as an indirect object and return an
// indirect reference to it.
+ DLL_EXPORT
QPDFObjectHandle makeIndirectObject(QPDFObjectHandle);
// Retrieve an object by object ID and generation. Returns an
// indirect reference to it.
+ DLL_EXPORT
QPDFObjectHandle getObjectByID(int objid, int generation);
// Encryption support
@@ -85,6 +100,7 @@ class QPDF
struct EncryptionData
{
// This class holds data read from the encryption dictionary.
+ DLL_EXPORT
EncryptionData(int V, int R, int Length_bytes, int P,
std::string const& O, std::string const& U,
std::string const& id1) :
@@ -107,28 +123,35 @@ class QPDF
std::string id1;
};
+ DLL_EXPORT
static void trim_user_password(std::string& user_password);
+ DLL_EXPORT
static std::string compute_data_key(
std::string const& encryption_key, int objid, int generation);
+ DLL_EXPORT
static std::string compute_encryption_key(
std::string const& password, EncryptionData const& data);
+ DLL_EXPORT
static void compute_encryption_O_U(
char const* user_password, char const* owner_password,
int V, int R, int key_len, int P,
std::string const& id1,
std::string& O, std::string& U);
+ DLL_EXPORT
std::string const& getUserPassword() const;
// Linearization support
// Returns true iff the file starts with a linearization parameter
// dictionary. Does no additional validation.
+ DLL_EXPORT
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
bool checkLinearization();
// Calls checkLinearization() and, if possible, prints normalized
@@ -136,9 +159,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
void showLinearizationData();
// Shows the contents of the cross-reference table
+ DLL_EXPORT
void showXRefTable();
// Optimization support -- see doc/optimization. Implemented in
@@ -152,26 +177,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
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
void flattenScalarReferences();
// Decode all streams, discarding the output. Used to check
// correctness of stream encoding.
+ DLL_EXPORT
void decodeStreams();
// For QPDFWriter:
// Remove /ID, /Encrypt, and /Prev keys from the trailer
// dictionary since these are regenerated during write.
+ DLL_EXPORT
void trimTrailerForWrite();
// Get lists of all objects in order according to the part of a
// linearized file that they belong to.
+ DLL_EXPORT
void getLinearizedParts(
std::map<int, int> const& object_stream_data,
std::vector<QPDFObjectHandle>& part4,
@@ -180,6 +210,7 @@ class QPDF
std::vector<QPDFObjectHandle>& part8,
std::vector<QPDFObjectHandle>& part9);
+ DLL_EXPORT
void generateHintStream(std::map<int, QPDFXRefEntry> const& xref,
std::map<int, size_t> const& lengths,
std::map<int, int> const& obj_renumber,
@@ -187,15 +218,18 @@ class QPDF
int& S, int& O);
// Map object to object stream that contains it
+ DLL_EXPORT
void getObjectStreamData(std::map<int, int>&);
// Get a list of objects that would be permitted in an object
// stream
+ DLL_EXPORT
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
std::vector<QPDFObjectHandle> const& getAllPages();
// Resolver class is restricted to QPDFObjectHandle so that only
diff --git a/include/qpdf/QPDFExc.hh b/include/qpdf/QPDFExc.hh
index 262a6a69..81e62cfd 100644
--- a/include/qpdf/QPDFExc.hh
+++ b/include/qpdf/QPDFExc.hh
@@ -13,9 +13,12 @@
class QPDFExc: public QEXC::General
{
public:
+ DLL_EXPORT
QPDFExc(std::string const& message);
+ DLL_EXPORT
QPDFExc(std::string const& filename, int offset,
std::string const& message);
+ DLL_EXPORT
virtual ~QPDFExc() throw ();
};
diff --git a/include/qpdf/QPDFObject.hh b/include/qpdf/QPDFObject.hh
index e6c78017..22c400a5 100644
--- a/include/qpdf/QPDFObject.hh
+++ b/include/qpdf/QPDFObject.hh
@@ -8,12 +8,16 @@
#ifndef __QPDFOBJECT_HH__
#define __QPDFOBJECT_HH__
+#include <qpdf/DLL.hh>
+
#include <string>
class QPDFObject
{
public:
+ DLL_EXPORT
virtual ~QPDFObject() {}
+ DLL_EXPORT
virtual std::string unparse() = 0;
};
diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh
index f6889925..b9aeaf59 100644
--- a/include/qpdf/QPDFObjectHandle.hh
+++ b/include/qpdf/QPDFObjectHandle.hh
@@ -13,6 +13,8 @@
#include <set>
#include <map>
+#include <qpdf/DLL.hh>
+
#include <qpdf/PointerHolder.hh>
#include <qpdf/Buffer.hh>
@@ -24,37 +26,58 @@ class QPDF;
class QPDFObjectHandle
{
public:
+ DLL_EXPORT
QPDFObjectHandle();
+ DLL_EXPORT
bool isInitialized() const;
// Exactly one of these will return true for any object.
+ DLL_EXPORT
bool isBool();
+ DLL_EXPORT
bool isNull();
+ DLL_EXPORT
bool isInteger();
+ DLL_EXPORT
bool isReal();
+ DLL_EXPORT
bool isName();
+ DLL_EXPORT
bool isString();
+ DLL_EXPORT
bool isArray();
+ DLL_EXPORT
bool isDictionary();
+ DLL_EXPORT
bool isStream();
// This returns true in addition to the query for the specific
// type for indirect objects.
+ DLL_EXPORT
bool isIndirect();
// True for everything except array, dictionary, and stream
+ DLL_EXPORT
bool isScalar();
// Public factory methods
+ DLL_EXPORT
static QPDFObjectHandle newNull();
+ DLL_EXPORT
static QPDFObjectHandle newBool(bool value);
+ DLL_EXPORT
static QPDFObjectHandle newInteger(int value);
+ DLL_EXPORT
static QPDFObjectHandle newReal(std::string const& value);
+ DLL_EXPORT
static QPDFObjectHandle newName(std::string const& name);
+ DLL_EXPORT
static QPDFObjectHandle newString(std::string const& str);
+ DLL_EXPORT
static QPDFObjectHandle newArray(
std::vector<QPDFObjectHandle> const& items);
+ DLL_EXPORT
static QPDFObjectHandle newDictionary(
std::map<std::string, QPDFObjectHandle> const& items);
@@ -63,55 +86,74 @@ class QPDFObjectHandle
// type, an exception is thrown.
// Methods for bool objects
+ DLL_EXPORT
bool getBoolValue();
// Methods for integer objects
+ DLL_EXPORT
int getIntValue();
// Methods for real objects
+ DLL_EXPORT
std::string getRealValue();
// Methods that work for both integer and real objects
+ DLL_EXPORT
bool isNumber();
+ DLL_EXPORT
double getNumericValue();
// Methods for name objects
+ DLL_EXPORT
std::string getName();
// Methods for string objects
+ DLL_EXPORT
std::string getStringValue();
+ DLL_EXPORT
std::string getUTF8Value();
// Methods for array objects
+ DLL_EXPORT
int getArrayNItems();
+ DLL_EXPORT
QPDFObjectHandle getArrayItem(int n);
// Methods for dictionary objects
+ DLL_EXPORT
bool hasKey(std::string const&);
+ DLL_EXPORT
QPDFObjectHandle getKey(std::string const&);
+ DLL_EXPORT
std::set<std::string> getKeys();
// 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
void makeDirect();
// Mutator methods for array objects
+ DLL_EXPORT
void setArrayItem(int, QPDFObjectHandle const&);
// Mutator methods for dictionary objects
// Replace value of key, adding it if it does not exist
+ DLL_EXPORT
void replaceKey(std::string const& key, QPDFObjectHandle const&);
// Remove key, doing nothing if key does not exist
+ DLL_EXPORT
void removeKey(std::string const& key);
// Methods for stream objects
+ DLL_EXPORT
QPDFObjectHandle getDict();
// Returns filtered (uncompressed) stream data. Throws an
// exception if the stream is filtered and we can't decode it.
+ DLL_EXPORT
PointerHolder<Buffer> getStreamData();
// Write stream data through the given pipeline. A null pipeline
@@ -131,14 +173,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
bool pipeStreamData(Pipeline*, bool filter,
bool normalize, bool compress);
// return 0 for direct objects
+ DLL_EXPORT
int getObjectID() const;
+ DLL_EXPORT
int getGeneration() const;
+ DLL_EXPORT
std::string unparse();
+ DLL_EXPORT
std::string unparseResolved();
// Convenience routines for commonly performed functions
@@ -148,6 +195,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
std::map<std::string, QPDFObjectHandle> getPageImages();
// Throws an exception if this is not a Page object. Returns a
@@ -155,6 +203,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
std::vector<QPDFObjectHandle> getPageContents();
// Initializers for objects. This Factory class gives the QPDF
diff --git a/include/qpdf/QPDFTokenizer.hh b/include/qpdf/QPDFTokenizer.hh
index ec2a971f..17885469 100644
--- a/include/qpdf/QPDFTokenizer.hh
+++ b/include/qpdf/QPDFTokenizer.hh
@@ -8,6 +8,8 @@
#ifndef __QPDFTOKENIZER_HH__
#define __QPDFTOKENIZER_HH__
+#include <qpdf/DLL.hh>
+
#include <string>
#include <stdio.h>
@@ -35,14 +37,17 @@ class QPDFTokenizer
class Token
{
public:
+ DLL_EXPORT
Token() : type(tt_bad) {}
+ DLL_EXPORT
Token(token_type_e type, std::string const& value) :
type(type),
value(value)
{
}
+ DLL_EXPORT
Token(token_type_e type, std::string const& value,
std::string raw_value, std::string error_message) :
type(type),
@@ -51,22 +56,27 @@ class QPDFTokenizer
error_message(error_message)
{
}
+ DLL_EXPORT
token_type_e getType() const
{
return this->type;
}
+ DLL_EXPORT
std::string const& getValue() const
{
return this->value;
}
+ DLL_EXPORT
std::string const& getRawValue() const
{
return this->raw_value;
}
+ DLL_EXPORT
std::string const& getErrorMessage() const
{
return this->error_message;
}
+ DLL_EXPORT
bool operator==(Token const& rhs)
{
// Ignore fields other than type and value
@@ -82,6 +92,7 @@ class QPDFTokenizer
std::string error_message;
};
+ DLL_EXPORT
QPDFTokenizer();
// PDF files with version < 1.2 allowed the pound character
@@ -89,6 +100,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
void allowPoundAnywhereInName();
// Mode of operation:
@@ -99,19 +111,23 @@ class QPDFTokenizer
// It these are called when a token is available, an exception
// will be thrown.
+ DLL_EXPORT
void presentCharacter(char ch);
+ DLL_EXPORT
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
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
bool betweenTokens();
private:
diff --git a/include/qpdf/QPDFWriter.hh b/include/qpdf/QPDFWriter.hh
index c354ec30..7d62e476 100644
--- a/include/qpdf/QPDFWriter.hh
+++ b/include/qpdf/QPDFWriter.hh
@@ -19,6 +19,8 @@
#include <set>
#include <map>
+#include <qpdf/DLL.hh>
+
#include <qpdf/QPDFXRefEntry.hh>
#include <qpdf/PointerHolder.hh>
@@ -33,7 +35,9 @@ class QPDFWriter
{
public:
// Passing null as filename means write to stdout
+ DLL_EXPORT
QPDFWriter(QPDF& pdf, char const* filename);
+ DLL_EXPORT
~QPDFWriter();
// Set the value of object stream mode. In disable mode, we never
@@ -44,6 +48,7 @@ class QPDFWriter
// object streams and a cross-reference stream if there are object
// streams. The default is o_preserve.
enum object_stream_e { o_disable, o_preserve, o_generate };
+ DLL_EXPORT
void setObjectStreamMode(object_stream_e);
// Set value of stream data mode. In uncompress mode, we attempt
@@ -52,6 +57,7 @@ class QPDFWriter
// if we can apply all filters and the stream is not already
// optimally compressed, recompress the stream.
enum stream_data_e { s_uncompress, s_preserve, s_compress };
+ DLL_EXPORT
void setStreamDataMode(stream_data_e);
// Set value of content stream normalization. The default is
@@ -61,6 +67,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
void setContentNormalization(bool);
// Set QDF mode. QDF mode causes special "pretty printing" of
@@ -68,22 +75,26 @@ 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
void setQDFMode(bool);
// Cause a static /ID value to be generated. Use only in test
// suites.
+ DLL_EXPORT
void setStaticID(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
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
void setPreserveEncryption(bool);
// Set up for encrypted output. Disables stream prefiltering and
@@ -91,6 +102,7 @@ class QPDFWriter
// parameters sets the PDF version to at least 1.3, and setting R3
// encryption parameters pushes the PDF version number to at least
// 1.4.
+ DLL_EXPORT
void setR2EncryptionParameters(
char const* user_password, char const* owner_password,
bool allow_print, bool allow_modify,
@@ -109,6 +121,7 @@ class QPDFWriter
r3m_assembly, // allow only document assembly
r3m_none // allow no modification
};
+ DLL_EXPORT
void setR3EncryptionParameters(
char const* user_password, char const* owner_password,
bool allow_accessibility, bool allow_extract,
@@ -116,8 +129,10 @@ class QPDFWriter
// Create linearized output. Disables qdf mode, content
// normalization, and stream prefiltering.
+ DLL_EXPORT
void setLinearization(bool);
+ DLL_EXPORT
void write();
private:
diff --git a/include/qpdf/QPDFXRefEntry.hh b/include/qpdf/QPDFXRefEntry.hh
index 83d44770..26a047b2 100644
--- a/include/qpdf/QPDFXRefEntry.hh
+++ b/include/qpdf/QPDFXRefEntry.hh
@@ -8,6 +8,8 @@
#ifndef __QPDFXREFENTRY_HH__
#define __QPDFXREFENTRY_HH__
+#include <qpdf/DLL.hh>
+
class QPDFXRefEntry
{
public:
@@ -17,12 +19,18 @@ class QPDFXRefEntry
// 1 = "uncompressed"; field 1 = offset
// 2 = "compressed"; field 1 = object stream number, field 2 = index
+ DLL_EXPORT
QPDFXRefEntry();
+ DLL_EXPORT
QPDFXRefEntry(int type, int field1, int field2);
+ DLL_EXPORT
int getType() const;
+ DLL_EXPORT
int getOffset() const; // only for type 1
+ DLL_EXPORT
int getObjStreamNumber() const; // only for type 2
+ DLL_EXPORT
int getObjStreamIndex() const; // only for type 2
private:
diff --git a/include/qpdf/QTC.hh b/include/qpdf/QTC.hh
index b9ed7f93..6e7e4a90 100644
--- a/include/qpdf/QTC.hh
+++ b/include/qpdf/QTC.hh
@@ -8,8 +8,11 @@
#ifndef __QTC_HH__
#define __QTC_HH__
+#include <qpdf/DLL.hh>
+
namespace QTC
{
+ DLL_EXPORT
void TC(char const* const scope, char const* const ccase, int n = 0);
};
diff --git a/include/qpdf/QUtil.hh b/include/qpdf/QUtil.hh
index a70db0bd..1d2b2b1b 100644
--- a/include/qpdf/QUtil.hh
+++ b/include/qpdf/QUtil.hh
@@ -19,35 +19,46 @@ namespace QUtil
{
// This is a collection of useful utility functions that don't
// really go anywhere else.
+ DLL_EXPORT
std::string int_to_string(int, int length = 0);
+ DLL_EXPORT
std::string double_to_string(double, int decimal_places = 0);
// If status is -1, convert the current value of errno to a
// QEXC::System exception. Otherwise, return status.
+ DLL_EXPORT
int os_wrapper(std::string const& description, int status)
throw (QEXC::System);
+ DLL_EXPORT
FILE* fopen_wrapper(std::string const&, FILE*)
throw (QEXC::System);
+ DLL_EXPORT
char* copy_string(std::string const&);
// Set stdin, stdout to binary mode
+ DLL_EXPORT
void binary_stdout();
+ DLL_EXPORT
void binary_stdin();
// May modify argv0
+ DLL_EXPORT
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
bool get_env(std::string const& var, std::string* value = 0);
+ DLL_EXPORT
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
std::string toUTF8(unsigned long uval);
};
diff --git a/libqpdf/Buffer.cc b/libqpdf/Buffer.cc
index 3dde1f90..dfed6010 100644
--- a/libqpdf/Buffer.cc
+++ b/libqpdf/Buffer.cc
@@ -3,22 +3,26 @@
#include <string.h>
+DLL_EXPORT
Buffer::Buffer()
{
init(0);
}
+DLL_EXPORT
Buffer::Buffer(unsigned long size)
{
init(size);
}
+DLL_EXPORT
Buffer::Buffer(Buffer const& rhs)
{
init(0);
copy(rhs);
}
+DLL_EXPORT
Buffer&
Buffer::operator=(Buffer const& rhs)
{
@@ -26,6 +30,7 @@ Buffer::operator=(Buffer const& rhs)
return *this;
}
+DLL_EXPORT
Buffer::~Buffer()
{
destroy();
@@ -60,18 +65,21 @@ Buffer::destroy()
this->buf = 0;
}
+DLL_EXPORT
unsigned long
Buffer::getSize() const
{
return this->size;
}
+DLL_EXPORT
unsigned char const*
Buffer::getBuffer() const
{
return this->buf;
}
+DLL_EXPORT
unsigned char*
Buffer::getBuffer()
{
diff --git a/libqpdf/Pipeline.cc b/libqpdf/Pipeline.cc
index 17c0c8b2..d9f70b67 100644
--- a/libqpdf/Pipeline.cc
+++ b/libqpdf/Pipeline.cc
@@ -2,12 +2,14 @@
#include <qpdf/Pipeline.hh>
+DLL_EXPORT
Pipeline::Pipeline(char const* identifier, Pipeline* next) :
identifier(identifier),
next(next)
{
}
+DLL_EXPORT
Pipeline::~Pipeline()
{
}
diff --git a/libqpdf/Pl_Count.cc b/libqpdf/Pl_Count.cc
index 8a361ad5..81ef7033 100644
--- a/libqpdf/Pl_Count.cc
+++ b/libqpdf/Pl_Count.cc
@@ -1,6 +1,7 @@
#include <qpdf/Pl_Count.hh>
+DLL_EXPORT
Pl_Count::Pl_Count(char const* identifier, Pipeline* next) :
Pipeline(identifier, next),
count(0),
@@ -8,10 +9,12 @@ Pl_Count::Pl_Count(char const* identifier, Pipeline* next) :
{
}
+DLL_EXPORT
Pl_Count::~Pl_Count()
{
}
+DLL_EXPORT
void
Pl_Count::write(unsigned char* buf, int len)
{
@@ -23,18 +26,21 @@ Pl_Count::write(unsigned char* buf, int len)
}
}
+DLL_EXPORT
void
Pl_Count::finish()
{
getNext()->finish();
}
+DLL_EXPORT
int
Pl_Count::getCount() const
{
return this->count;
}
+DLL_EXPORT
unsigned char
Pl_Count::getLastChar() const
{
diff --git a/libqpdf/Pl_Discard.cc b/libqpdf/Pl_Discard.cc
index 1632ea23..22c1a14e 100644
--- a/libqpdf/Pl_Discard.cc
+++ b/libqpdf/Pl_Discard.cc
@@ -3,20 +3,24 @@
// Exercised in md5 test suite
+DLL_EXPORT
Pl_Discard::Pl_Discard() :
Pipeline("discard", 0)
{
}
+DLL_EXPORT
Pl_Discard::~Pl_Discard()
{
}
+DLL_EXPORT
void
Pl_Discard::write(unsigned char* buf, int len)
{
}
+DLL_EXPORT
void
Pl_Discard::finish()
{
diff --git a/libqpdf/Pl_Flate.cc b/libqpdf/Pl_Flate.cc
index ba60c472..ff3331fc 100644
--- a/libqpdf/Pl_Flate.cc
+++ b/libqpdf/Pl_Flate.cc
@@ -3,6 +3,7 @@
#include <qpdf/QUtil.hh>
+DLL_EXPORT
Pl_Flate::Pl_Flate(char const* identifier, Pipeline* next,
action_e action, int out_bufsize) :
Pipeline(identifier, next),
@@ -21,6 +22,7 @@ Pl_Flate::Pl_Flate(char const* identifier, Pipeline* next,
zstream.avail_out = out_bufsize;
}
+DLL_EXPORT
Pl_Flate::~Pl_Flate()
{
if (this->outbuf)
@@ -30,6 +32,7 @@ Pl_Flate::~Pl_Flate()
}
}
+DLL_EXPORT
void
Pl_Flate::write(unsigned char* data, int len)
{
@@ -117,6 +120,7 @@ Pl_Flate::handleData(unsigned char* data, int len, int flush)
}
}
+DLL_EXPORT
void
Pl_Flate::finish()
{
diff --git a/libqpdf/Pl_StdioFile.cc b/libqpdf/Pl_StdioFile.cc
index c0f42afd..37ae5333 100644
--- a/libqpdf/Pl_StdioFile.cc
+++ b/libqpdf/Pl_StdioFile.cc
@@ -3,16 +3,19 @@
#include <errno.h>
+DLL_EXPORT
Pl_StdioFile::Pl_StdioFile(char const* identifier, FILE* f) :
Pipeline(identifier, 0),
file(f)
{
}
+DLL_EXPORT
Pl_StdioFile::~Pl_StdioFile()
{
}
+DLL_EXPORT
void
Pl_StdioFile::write(unsigned char* buf, int len)
{
@@ -33,6 +36,7 @@ Pl_StdioFile::write(unsigned char* buf, int len)
}
}
+DLL_EXPORT
void
Pl_StdioFile::finish()
{
diff --git a/libqpdf/QEXC.cc b/libqpdf/QEXC.cc
index c65afbb6..d8154f33 100644
--- a/libqpdf/QEXC.cc
+++ b/libqpdf/QEXC.cc
@@ -3,29 +3,34 @@
#include <string.h>
#include <errno.h>
+DLL_EXPORT
QEXC::Base::Base()
{
// nothing needed
}
+DLL_EXPORT
QEXC::Base::Base(std::string const& message) :
message(message)
{
// nothing needed
}
+DLL_EXPORT
std::string const&
QEXC::Base::unparse() const
{
return this->message;
}
+DLL_EXPORT
void
QEXC::Base::setMessage(std::string const& message)
{
this->message = message;
}
+DLL_EXPORT
const char*
QEXC::Base::what() const throw()
{
@@ -36,17 +41,20 @@ QEXC::Base::what() const throw()
return this->unparse().c_str();
}
+DLL_EXPORT
QEXC::General::General()
{
// nothing needed
}
+DLL_EXPORT
QEXC::General::General(std::string const& message) :
Base(message)
{
// nothing needed
}
+DLL_EXPORT
QEXC::System::System(std::string const& prefix, int sys_errno)
{
// Note: using sys_errno in case errno is a macro.
@@ -54,12 +62,14 @@ QEXC::System::System(std::string const& prefix, int sys_errno)
this->setMessage(prefix + ": " + strerror(sys_errno));
}
+DLL_EXPORT
int
QEXC::System::getErrno() const
{
return this->sys_errno;
}
+DLL_EXPORT
QEXC::Internal::Internal(std::string const& message) :
Base("INTERNAL ERROR: " + message)
{
diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc
index 399d68e1..ba71e629 100644
--- a/libqpdf/QPDF.cc
+++ b/libqpdf/QPDF.cc
@@ -247,6 +247,7 @@ QPDF::ObjGen::operator<(ObjGen const& rhs) const
((this->obj == rhs.obj) && (this->gen < rhs.gen)));
}
+DLL_EXPORT
QPDF::QPDF() :
encrypted(false),
encryption_initialized(false),
@@ -260,10 +261,12 @@ QPDF::QPDF() :
{
}
+DLL_EXPORT
QPDF::~QPDF()
{
}
+DLL_EXPORT
void
QPDF::processFile(char const* filename, char const* password)
{
@@ -272,24 +275,28 @@ QPDF::processFile(char const* filename, char const* password)
parse();
}
+DLL_EXPORT
void
QPDF::setIgnoreXRefStreams(bool val)
{
this->ignore_xref_streams = val;
}
+DLL_EXPORT
void
QPDF::setSuppressWarnings(bool val)
{
this->suppress_warnings = val;
}
+DLL_EXPORT
void
QPDF::setAttemptRecovery(bool val)
{
this->attempt_recovery = val;
}
+DLL_EXPORT
std::vector<std::string>
QPDF::getWarnings()
{
@@ -926,6 +933,7 @@ QPDF::insertXrefEntry(int obj, int f0, int f1, int f2, bool overwrite)
}
}
+DLL_EXPORT
void
QPDF::showXRefTable()
{
@@ -1610,6 +1618,7 @@ QPDF::resolveObjectsInStream(int obj_stream_number)
}
}
+DLL_EXPORT
QPDFObjectHandle
QPDF::makeIndirectObject(QPDFObjectHandle oh)
{
@@ -1624,12 +1633,14 @@ QPDF::makeIndirectObject(QPDFObjectHandle oh)
return QPDFObjectHandle::Factory::newIndirect(this, next.obj, next.gen);
}
+DLL_EXPORT
QPDFObjectHandle
QPDF::getObjectByID(int objid, int generation)
{
return QPDFObjectHandle::Factory::newIndirect(this, objid, generation);
}
+DLL_EXPORT
void
QPDF::trimTrailerForWrite()
{
@@ -1652,30 +1663,35 @@ QPDF::trimTrailerForWrite()
this->trailer.removeKey("/XRefStm");
}
+DLL_EXPORT
std::string
QPDF::getFilename() const
{
return this->file.getName();
}
+DLL_EXPORT
std::string
QPDF::getPDFVersion() const
{
return this->pdf_version;
}
+DLL_EXPORT
QPDFObjectHandle
QPDF::getTrailer()
{
return this->trailer;
}
+DLL_EXPORT
QPDFObjectHandle
QPDF::getRoot()
{
return this->trailer.getKey("/Root");
}
+DLL_EXPORT
void
QPDF::getObjectStreamData(std::map<int, int>& omap)
{
@@ -1692,6 +1708,7 @@ QPDF::getObjectStreamData(std::map<int, int>& omap)
}
}
+DLL_EXPORT
std::vector<int>
QPDF::getCompressibleObjects()
{
@@ -1840,6 +1857,7 @@ QPDF::pipeStreamData(int objid, int generation,
pipeline->finish();
}
+DLL_EXPORT
void
QPDF::decodeStreams()
{
@@ -1857,6 +1875,7 @@ QPDF::decodeStreams()
}
}
+DLL_EXPORT
std::vector<QPDFObjectHandle> const&
QPDF::getAllPages()
{
diff --git a/libqpdf/QPDFExc.cc b/libqpdf/QPDFExc.cc
index c7270677..bac52e03 100644
--- a/libqpdf/QPDFExc.cc
+++ b/libqpdf/QPDFExc.cc
@@ -3,11 +3,13 @@
#include <qpdf/QUtil.hh>
+DLL_EXPORT
QPDFExc::QPDFExc(std::string const& message) :
QEXC::General(message)
{
}
+DLL_EXPORT
QPDFExc::QPDFExc(std::string const& filename, int offset,
std::string const& message) :
QEXC::General(filename + ": offset " + QUtil::int_to_string(offset) +
@@ -15,6 +17,7 @@ QPDFExc::QPDFExc(std::string const& filename, int offset,
{
}
+DLL_EXPORT
QPDFExc::~QPDFExc() throw ()
{
}
diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc
index 03ef2fe4..f1c9db23 100644
--- a/libqpdf/QPDFObjectHandle.cc
+++ b/libqpdf/QPDFObjectHandle.cc
@@ -18,6 +18,7 @@
#include <stdlib.h>
+DLL_EXPORT
QPDFObjectHandle::QPDFObjectHandle() :
initialized(false),
objid(0),
@@ -42,6 +43,7 @@ QPDFObjectHandle::QPDFObjectHandle(QPDFObject* data) :
{
}
+DLL_EXPORT
bool
QPDFObjectHandle::isInitialized() const
{
@@ -58,6 +60,7 @@ class QPDFObjectTypeAccessor
}
};
+DLL_EXPORT
bool
QPDFObjectHandle::isBool()
{
@@ -65,6 +68,7 @@ QPDFObjectHandle::isBool()
return QPDFObjectTypeAccessor<QPDF_Bool>::check(obj.getPointer());
}
+DLL_EXPORT
bool
QPDFObjectHandle::isNull()
{
@@ -72,6 +76,7 @@ QPDFObjectHandle::isNull()
return QPDFObjectTypeAccessor<QPDF_Null>::check(obj.getPointer());
}
+DLL_EXPORT
bool
QPDFObjectHandle::isInteger()
{
@@ -79,6 +84,7 @@ QPDFObjectHandle::isInteger()
return QPDFObjectTypeAccessor<QPDF_Integer>::check(obj.getPointer());
}
+DLL_EXPORT
bool
QPDFObjectHandle::isReal()
{
@@ -86,12 +92,14 @@ QPDFObjectHandle::isReal()
return QPDFObjectTypeAccessor<QPDF_Real>::check(obj.getPointer());
}
+DLL_EXPORT
bool
QPDFObjectHandle::isNumber()
{
return (isInteger() || isReal());
}
+DLL_EXPORT
double
QPDFObjectHandle::getNumericValue()
{
@@ -111,6 +119,7 @@ QPDFObjectHandle::getNumericValue()
return result;
}
+DLL_EXPORT
bool
QPDFObjectHandle::isName()
{
@@ -118,6 +127,7 @@ QPDFObjectHandle::isName()
return QPDFObjectTypeAccessor<QPDF_Name>::check(obj.getPointer());
}
+DLL_EXPORT
bool
QPDFObjectHandle::isString()
{
@@ -125,6 +135,7 @@ QPDFObjectHandle::isString()
return QPDFObjectTypeAccessor<QPDF_String>::check(obj.getPointer());
}
+DLL_EXPORT
bool
QPDFObjectHandle::isArray()
{
@@ -132,6 +143,7 @@ QPDFObjectHandle::isArray()
return QPDFObjectTypeAccessor<QPDF_Array>::check(obj.getPointer());
}
+DLL_EXPORT
bool
QPDFObjectHandle::isDictionary()
{
@@ -139,6 +151,7 @@ QPDFObjectHandle::isDictionary()
return QPDFObjectTypeAccessor<QPDF_Dictionary>::check(obj.getPointer());
}
+DLL_EXPORT
bool
QPDFObjectHandle::isStream()
{
@@ -146,6 +159,7 @@ QPDFObjectHandle::isStream()
return QPDFObjectTypeAccessor<QPDF_Stream>::check(obj.getPointer());
}
+DLL_EXPORT
bool
QPDFObjectHandle::isIndirect()
{
@@ -153,6 +167,7 @@ QPDFObjectHandle::isIndirect()
return (this->objid != 0);
}
+DLL_EXPORT
bool
QPDFObjectHandle::isScalar()
{
@@ -161,6 +176,7 @@ QPDFObjectHandle::isScalar()
// Bool accessors
+DLL_EXPORT
bool
QPDFObjectHandle::getBoolValue()
{
@@ -170,6 +186,7 @@ QPDFObjectHandle::getBoolValue()
// Integer accessors
+DLL_EXPORT
int
QPDFObjectHandle::getIntValue()
{
@@ -179,6 +196,7 @@ QPDFObjectHandle::getIntValue()
// Real accessors
+DLL_EXPORT
std::string
QPDFObjectHandle::getRealValue()
{
@@ -188,6 +206,7 @@ QPDFObjectHandle::getRealValue()
// Name accessors
+DLL_EXPORT
std::string
QPDFObjectHandle::getName()
{
@@ -197,6 +216,7 @@ QPDFObjectHandle::getName()
// String accessors
+DLL_EXPORT
std::string
QPDFObjectHandle::getStringValue()
{
@@ -204,6 +224,7 @@ QPDFObjectHandle::getStringValue()
return dynamic_cast<QPDF_String*>(obj.getPointer())->getVal();
}
+DLL_EXPORT
std::string
QPDFObjectHandle::getUTF8Value()
{
@@ -213,6 +234,7 @@ QPDFObjectHandle::getUTF8Value()
// Array accessors
+DLL_EXPORT
int
QPDFObjectHandle::getArrayNItems()
{
@@ -220,6 +242,7 @@ QPDFObjectHandle::getArrayNItems()
return dynamic_cast<QPDF_Array*>(obj.getPointer())->getNItems();
}
+DLL_EXPORT
QPDFObjectHandle
QPDFObjectHandle::getArrayItem(int n)
{
@@ -229,6 +252,7 @@ QPDFObjectHandle::getArrayItem(int n)
// Array mutators
+DLL_EXPORT
void
QPDFObjectHandle::setArrayItem(int n, QPDFObjectHandle const& item)
{
@@ -238,6 +262,7 @@ QPDFObjectHandle::setArrayItem(int n, QPDFObjectHandle const& item)
// Dictionary accessors
+DLL_EXPORT
bool
QPDFObjectHandle::hasKey(std::string const& key)
{
@@ -245,6 +270,7 @@ QPDFObjectHandle::hasKey(std::string const& key)
return dynamic_cast<QPDF_Dictionary*>(obj.getPointer())->hasKey(key);
}
+DLL_EXPORT
QPDFObjectHandle
QPDFObjectHandle::getKey(std::string const& key)
{
@@ -252,6 +278,7 @@ QPDFObjectHandle::getKey(std::string const& key)
return dynamic_cast<QPDF_Dictionary*>(obj.getPointer())->getKey(key);
}
+DLL_EXPORT
std::set<std::string>
QPDFObjectHandle::getKeys()
{
@@ -261,6 +288,7 @@ QPDFObjectHandle::getKeys()
// Dictionary mutators
+DLL_EXPORT
void
QPDFObjectHandle::replaceKey(std::string const& key,
QPDFObjectHandle const& value)
@@ -270,6 +298,7 @@ QPDFObjectHandle::replaceKey(std::string const& key,
obj.getPointer())->replaceKey(key, value);
}
+DLL_EXPORT
void
QPDFObjectHandle::removeKey(std::string const& key)
{
@@ -278,6 +307,7 @@ QPDFObjectHandle::removeKey(std::string const& key)
}
// Stream accessors
+DLL_EXPORT
QPDFObjectHandle
QPDFObjectHandle::getDict()
{
@@ -285,6 +315,7 @@ QPDFObjectHandle::getDict()
return dynamic_cast<QPDF_Stream*>(obj.getPointer())->getDict();
}
+DLL_EXPORT
PointerHolder<Buffer>
QPDFObjectHandle::getStreamData()
{
@@ -292,6 +323,7 @@ QPDFObjectHandle::getStreamData()
return dynamic_cast<QPDF_Stream*>(obj.getPointer())->getStreamData();
}
+DLL_EXPORT
bool
QPDFObjectHandle::pipeStreamData(Pipeline* p, bool filter,
bool normalize, bool compress)
@@ -301,18 +333,21 @@ QPDFObjectHandle::pipeStreamData(Pipeline* p, bool filter,
p, filter, normalize, compress);
}
+DLL_EXPORT
int
QPDFObjectHandle::getObjectID() const
{
return this->objid;
}
+DLL_EXPORT
int
QPDFObjectHandle::getGeneration() const
{
return this->generation;
}
+DLL_EXPORT
std::map<std::string, QPDFObjectHandle>
QPDFObjectHandle::getPageImages()
{
@@ -361,6 +396,7 @@ QPDFObjectHandle::getPageImages()
return result;
}
+DLL_EXPORT
std::vector<QPDFObjectHandle>
QPDFObjectHandle::getPageContents()
{
@@ -399,6 +435,7 @@ QPDFObjectHandle::getPageContents()
return result;
}
+DLL_EXPORT
std::string
QPDFObjectHandle::unparse()
{
@@ -415,6 +452,7 @@ QPDFObjectHandle::unparse()
return result;
}
+DLL_EXPORT
std::string
QPDFObjectHandle::unparseResolved()
{
@@ -428,48 +466,56 @@ QPDFObjectHandle::newIndirect(QPDF* qpdf, int objid, int generation)
return QPDFObjectHandle(qpdf, objid, generation);
}
+DLL_EXPORT
QPDFObjectHandle
QPDFObjectHandle::newBool(bool value)
{
return QPDFObjectHandle(new QPDF_Bool(value));
}
+DLL_EXPORT
QPDFObjectHandle
QPDFObjectHandle::newNull()
{
return QPDFObjectHandle(new QPDF_Null());
}
+DLL_EXPORT
QPDFObjectHandle
QPDFObjectHandle::newInteger(int value)
{
return QPDFObjectHandle(new QPDF_Integer(value));
}
+DLL_EXPORT
QPDFObjectHandle
QPDFObjectHandle::newReal(std::string const& value)
{
return QPDFObjectHandle(new QPDF_Real(value));
}
+DLL_EXPORT
QPDFObjectHandle
QPDFObjectHandle::newName(std::string const& name)
{
return QPDFObjectHandle(new QPDF_Name(name));
}
+DLL_EXPORT
QPDFObjectHandle
QPDFObjectHandle::newString(std::string const& str)
{
return QPDFObjectHandle(new QPDF_String(str));
}
+DLL_EXPORT
QPDFObjectHandle
QPDFObjectHandle::newArray(std::vector<QPDFObjectHandle> const& items)
{
return QPDFObjectHandle(new QPDF_Array(items));
}
+DLL_EXPORT
QPDFObjectHandle
QPDFObjectHandle::newDictionary(
std::map<std::string, QPDFObjectHandle> const& items)
diff --git a/libqpdf/QPDFTokenizer.cc b/libqpdf/QPDFTokenizer.cc
index 1d3d153f..4b6e7848 100644
--- a/libqpdf/QPDFTokenizer.cc
+++ b/libqpdf/QPDFTokenizer.cc
@@ -17,12 +17,14 @@ static bool is_hex_digit(char ch)
return (strchr("0123456789abcdefABCDEF", ch) != 0);
}
+DLL_EXPORT
QPDFTokenizer::QPDFTokenizer() :
pound_special_in_name(true)
{
reset();
}
+DLL_EXPORT
void
QPDFTokenizer::allowPoundAnywhereInName()
{
@@ -45,6 +47,7 @@ QPDFTokenizer::reset()
last_char_was_bs = false;
}
+DLL_EXPORT
void
QPDFTokenizer::presentCharacter(char ch)
{
@@ -418,6 +421,7 @@ QPDFTokenizer::presentCharacter(char ch)
}
}
+DLL_EXPORT
void
QPDFTokenizer::presentEOF()
{
@@ -439,6 +443,7 @@ QPDFTokenizer::presentEOF()
}
}
+DLL_EXPORT
bool
QPDFTokenizer::getToken(Token& token, bool& unread_char, char& ch)
{
@@ -453,6 +458,7 @@ QPDFTokenizer::getToken(Token& token, bool& unread_char, char& ch)
return ready;
}
+DLL_EXPORT
bool
QPDFTokenizer::betweenTokens()
{
diff --git a/libqpdf/QPDFXRefEntry.cc b/libqpdf/QPDFXRefEntry.cc
index 669a2f13..68c58689 100644
--- a/libqpdf/QPDFXRefEntry.cc
+++ b/libqpdf/QPDFXRefEntry.cc
@@ -3,6 +3,7 @@
#include <qpdf/QPDFExc.hh>
#include <qpdf/QUtil.hh>
+DLL_EXPORT
QPDFXRefEntry::QPDFXRefEntry() :
type(0),
field1(0),
@@ -10,6 +11,7 @@ QPDFXRefEntry::QPDFXRefEntry() :
{
}
+DLL_EXPORT
QPDFXRefEntry::QPDFXRefEntry(int type, int field1, int field2) :
type(type),
field1(field1),
@@ -21,12 +23,14 @@ QPDFXRefEntry::QPDFXRefEntry(int type, int field1, int field2) :
}
}
+DLL_EXPORT
int
QPDFXRefEntry::getType() const
{
return this->type;
}
+DLL_EXPORT
int
QPDFXRefEntry::getOffset() const
{
@@ -38,6 +42,7 @@ QPDFXRefEntry::getOffset() const
return this->field1;
}
+DLL_EXPORT
int
QPDFXRefEntry::getObjStreamNumber() const
{
@@ -49,6 +54,7 @@ QPDFXRefEntry::getObjStreamNumber() const
return this->field1;
}
+DLL_EXPORT
int
QPDFXRefEntry::getObjStreamIndex() const
{
diff --git a/libqpdf/QPDF_encryption.cc b/libqpdf/QPDF_encryption.cc
index bd7ef7a6..02517aed 100644
--- a/libqpdf/QPDF_encryption.cc
+++ b/libqpdf/QPDF_encryption.cc
@@ -32,6 +32,7 @@ pad_or_truncate_password(std::string const& password, char k1[key_bytes])
memcpy(k1 + password_bytes, padding_string, pad_bytes);
}
+DLL_EXPORT
void
QPDF::trim_user_password(std::string& user_password)
{
@@ -97,6 +98,7 @@ iterate_rc4(unsigned char* data, int data_len,
delete [] key;
}
+DLL_EXPORT
std::string
QPDF::compute_data_key(std::string const& encryption_key,
int objid, int generation)
@@ -120,6 +122,7 @@ QPDF::compute_data_key(std::string const& encryption_key,
std::min(result.length(), (size_t) 16));
}
+DLL_EXPORT
std::string
QPDF::compute_encryption_key(
std::string const& password, EncryptionData const& data)
@@ -424,6 +427,7 @@ QPDF::decryptStream(Pipeline*& pipeline, int objid, int generation,
heap.push_back(pipeline);
}
+DLL_EXPORT
void
QPDF::compute_encryption_O_U(
char const* user_password, char const* owner_password,
@@ -436,6 +440,7 @@ QPDF::compute_encryption_O_U(
U = compute_U_value(user_password, data);
}
+DLL_EXPORT
std::string const&
QPDF::getUserPassword() const
{
diff --git a/libqpdf/QPDF_linearization.cc b/libqpdf/QPDF_linearization.cc
index 5739b3a9..2a81856e 100644
--- a/libqpdf/QPDF_linearization.cc
+++ b/libqpdf/QPDF_linearization.cc
@@ -53,6 +53,7 @@ load_vector_vector(BitStream& bit_stream,
bit_stream.skipToNextByte();
}
+DLL_EXPORT
bool
QPDF::checkLinearization()
{
@@ -69,6 +70,7 @@ QPDF::checkLinearization()
return result;
}
+DLL_EXPORT
bool
QPDF::isLinearized()
{
@@ -982,6 +984,7 @@ QPDF::checkHOutlines(std::list<std::string>& warnings)
}
}
+DLL_EXPORT
void
QPDF::showLinearizationData()
{
@@ -1739,6 +1742,7 @@ QPDF::pushOutlinesToPart(
}
}
+DLL_EXPORT
void
QPDF::getLinearizedParts(
std::map<int, int> const& object_stream_data,
@@ -2070,6 +2074,7 @@ QPDF::writeHGeneric(BitWriter& w, HGeneric& t)
w.writeBits(t.group_length, 32); // 4
}
+DLL_EXPORT
void
QPDF::generateHintStream(std::map<int, QPDFXRefEntry> const& xref,
std::map<int, size_t> const& lengths,
diff --git a/libqpdf/QPDF_optimization.cc b/libqpdf/QPDF_optimization.cc
index 8797445c..edd9bba9 100644
--- a/libqpdf/QPDF_optimization.cc
+++ b/libqpdf/QPDF_optimization.cc
@@ -58,6 +58,7 @@ QPDF::ObjUser::operator<(ObjUser const& rhs) const
return false;
}
+DLL_EXPORT
void
QPDF::flattenScalarReferences()
{
@@ -140,6 +141,7 @@ QPDF::flattenScalarReferences()
}
}
+DLL_EXPORT
void
QPDF::optimize(std::map<int, int> const& object_stream_data,
bool allow_changes)
diff --git a/libqpdf/QTC.cc b/libqpdf/QTC.cc
index b8328b2e..eea7c514 100644
--- a/libqpdf/QTC.cc
+++ b/libqpdf/QTC.cc
@@ -11,6 +11,7 @@ static bool tc_active(char const* const scope)
return (QUtil::get_env("TC_SCOPE", &value) && (value == scope));
}
+DLL_EXPORT
void QTC::TC(char const* const scope, char const* const ccase, int n)
{
static std::set<std::pair<std::string, int> > cache;
diff --git a/libqpdf/QUtil.cc b/libqpdf/QUtil.cc
index a000d82e..0d0b4667 100644
--- a/libqpdf/QUtil.cc
+++ b/libqpdf/QUtil.cc
@@ -14,6 +14,7 @@
#include <unistd.h>
#endif
+DLL_EXPORT
std::string
QUtil::int_to_string(int num, int fullpad)
{
@@ -41,6 +42,7 @@ QUtil::int_to_string(int num, int fullpad)
return std::string(t);
}
+DLL_EXPORT
std::string
QUtil::double_to_string(double num, int decimal_places)
{
@@ -76,6 +78,7 @@ QUtil::double_to_string(double num, int decimal_places)
return std::string(t);
}
+DLL_EXPORT
int
QUtil::os_wrapper(std::string const& description, int status) throw (QEXC::System)
{
@@ -86,6 +89,7 @@ QUtil::os_wrapper(std::string const& description, int status) throw (QEXC::Syste
return status;
}
+DLL_EXPORT
FILE*
QUtil::fopen_wrapper(std::string const& description, FILE* f) throw (QEXC::System)
{
@@ -96,6 +100,7 @@ QUtil::fopen_wrapper(std::string const& description, FILE* f) throw (QEXC::Syste
return f;
}
+DLL_EXPORT
char*
QUtil::copy_string(std::string const& str)
{
@@ -106,6 +111,7 @@ QUtil::copy_string(std::string const& str)
return result;
}
+DLL_EXPORT
void
QUtil::binary_stdout()
{
@@ -114,6 +120,7 @@ QUtil::binary_stdout()
#endif
}
+DLL_EXPORT
void
QUtil::binary_stdin()
{
@@ -122,6 +129,7 @@ QUtil::binary_stdin()
#endif
}
+DLL_EXPORT
char*
QUtil::getWhoami(char* argv0)
{
@@ -149,6 +157,7 @@ QUtil::getWhoami(char* argv0)
return whoami;
}
+DLL_EXPORT
bool
QUtil::get_env(std::string const& var, std::string* value)
{
@@ -186,6 +195,7 @@ QUtil::get_env(std::string const& var, std::string* value)
#endif
}
+DLL_EXPORT
time_t
QUtil::get_current_time()
{
@@ -212,6 +222,7 @@ QUtil::get_current_time()
#endif
}
+DLL_EXPORT
std::string
QUtil::toUTF8(unsigned long uval)
{