Pdf3rdPtyForwardDecl.h   Pdf3rdPtyForwardDecl.h 
#ifndef PDF_FT_FORWARD_DECL #ifndef PDF_FT_FORWARD_DECL
#define PDF_FT_FORWARD_DECL #define PDF_FT_FORWARD_DECL
/** /**
* \file Pdf3rdPartyForwardDecl.h * \page Pdf3rdPartyForwardDecl.h
* *
* Forward declare some types that we use in our public API but don't want to * Forward declare some types that we use in our public API but don't want to
* include the headers for directly. We can't do a nice simple forward * include the headers for directly. We can't do a nice simple forward
* declaration because most of these libraries have typedefs everywhere. * declaration because most of these libraries have typedefs everywhere.
* *
* We don't want to include things like freetype directly in our public hea ders * We don't want to include things like freetype directly in our public hea ders
* because: * because:
* *
* - They dump a huge amount of cruft into the top level namespace * - They dump a huge amount of cruft into the top level namespace
* *
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 PdfAction.h   PdfAction.h 
skipping to change at line 62 skipping to change at line 62
ePdfAction_Hide, ePdfAction_Hide,
ePdfAction_Named, ePdfAction_Named,
ePdfAction_SubmitForm, ePdfAction_SubmitForm,
ePdfAction_ResetForm, ePdfAction_ResetForm,
ePdfAction_ImportData, ePdfAction_ImportData,
ePdfAction_JavaScript, ePdfAction_JavaScript,
ePdfAction_SetOCGState, ePdfAction_SetOCGState,
ePdfAction_Rendition, ePdfAction_Rendition,
ePdfAction_Trans, ePdfAction_Trans,
ePdfAction_GoTo3DView, ePdfAction_GoTo3DView,
ePdfAction_RichMediaExecute,
ePdfAction_Unknown = 0xff ePdfAction_Unknown = 0xff
}; };
/** An action that can be performed in a PDF document /** An action that can be performed in a PDF document
*/ */
class PODOFO_DOC_API PdfAction : public PdfElement { class PODOFO_DOC_API PdfAction : public PdfElement {
friend class PdfAnnotation; friend class PdfAnnotation;
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 PdfCompilerCompat.h   PdfCompilerCompat.h 
skipping to change at line 163 skipping to change at line 163
# define PODOFO__FUNCTION__ __FUNCTION__ # define PODOFO__FUNCTION__ __FUNCTION__
#elif defined(__BORLANDC__) || defined(__TURBOC__) #elif defined(__BORLANDC__) || defined(__TURBOC__)
# define PODOFO__FUNCTION__ __FUNC__ # define PODOFO__FUNCTION__ __FUNC__
#elif defined(__GNUC__) #elif defined(__GNUC__)
# define PODOFO__FUNCTION__ __PRETTY_FUNCTION__ # define PODOFO__FUNCTION__ __PRETTY_FUNCTION__
#else #else
# define PODOFO__FUNCTION__ __FUNCTION__ # define PODOFO__FUNCTION__ __FUNCTION__
#endif #endif
/** /**
* \mainpage * \page PoDoFo PdfCompilerCompat Header
* *
* <b>PdfCompilerCompat.h</b> gathers up nastyness required for various * <b>PdfCompilerCompat.h</b> gathers up nastyness required for various
* compiler compatibility into a central place. All compiler-specific defin es, * compiler compatibility into a central place. All compiler-specific defin es,
* wrappers, and the like should be included here and (if necessary) in * wrappers, and the like should be included here and (if necessary) in
* PdfCompilerCompat.cpp if they must be visible to public users of the lib rary. * PdfCompilerCompat.cpp if they must be visible to public users of the lib rary.
* *
* If the nasty platform and compiler specific hacks can be kept to PoDoFo' s * If the nasty platform and compiler specific hacks can be kept to PoDoFo' s
* build and need not be visible to users of the library, put them in * build and need not be visible to users of the library, put them in
* PdfCompilerCompatPrivate.{cpp,h} instead. * PdfCompilerCompatPrivate.{cpp,h} instead.
* *
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 PdfCompilerCompatPrivate.h   PdfCompilerCompatPrivate.h 
skipping to change at line 214 skipping to change at line 214
void* operator new(size_t ai_NewSize, const char* ac_File_, int ai_Line); void* operator new(size_t ai_NewSize, const char* ac_File_, int ai_Line);
void operator delete(void* av_Ptr_, const char* ac_File_, int ai_Line); void operator delete(void* av_Ptr_, const char* ac_File_, int ai_Line);
#define DEBUG_NEW new(__FILE__, __LINE__) #define DEBUG_NEW new(__FILE__, __LINE__)
#define new DEBUG_NEW #define new DEBUG_NEW
// doesnt work: // doesnt work:
// // _NEW_CRT is defined in <xdebug> // // _NEW_CRT is defined in <xdebug>
// // #define new _NEW_CRT // // #define new _NEW_CRT
#endif // _DEBUG #endif // _DEBUG
#endif // _MSC_VER #endif // _MSC_VER
/* /**
* \mainpage * \page PoDoFo PdfCompilerCompatPrivate Header
*
* <b>PdfCompilerCompatPrivate.h</b> gathers up nastyness required for vari ous * <b>PdfCompilerCompatPrivate.h</b> gathers up nastyness required for vari ous
* compiler compatibility into a central place. All compiler-specific defin es, * compiler compatibility into a central place. All compiler-specific defin es,
* wrappers, and the like should be included here and (if necessary) in * wrappers, and the like should be included here and (if necessary) in
* PdfCompilerCompatPrivate.cpp. If the must be visible to library users * PdfCompilerCompatPrivate.cpp. If the must be visible to library users
* they're put in PdfCompilerCompat.{cpp,h} instead. * they're put in PdfCompilerCompat.{cpp,h} instead.
* *
* PdfCompilerCompatPrivate.h is private to PoDoFo's build process. It is n ot * PdfCompilerCompatPrivate.h is private to PoDoFo's build process. It is n ot
* used by library clients, the tools, or the unit tests. It is not install ed * used by library clients, the tools, or the unit tests. It is not install ed
* with PoDoFo and must never be visible in the public headers. * with PoDoFo and must never be visible in the public headers.
* *
 End of changes. 1 change blocks. 
3 lines changed or deleted 3 lines changed or added


 PdfDataType.h   PdfDataType.h 
skipping to change at line 135 skipping to change at line 135
return m_bImmutable; return m_bImmutable;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline void PdfDataType::AssertMutable() const inline void PdfDataType::AssertMutable() const
{ {
if(m_bImmutable) if(m_bImmutable)
{ {
throw new PdfError( ePdfError_ChangeOnImmutable ); throw PdfError( ePdfError_ChangeOnImmutable );
} }
} }
}; // namespace PoDoFo }; // namespace PoDoFo
#endif /* _PDF_DATATYPE_H_ */ #endif /* _PDF_DATATYPE_H_ */
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 PdfDate.h   PdfDate.h 
skipping to change at line 66 skipping to change at line 66
/** Create a PdfDate with a specified date and time /** Create a PdfDate with a specified date and time
* \param t the date and time of this object * \param t the date and time of this object
* *
* Use IsValid to check wether the time_t could be * Use IsValid to check wether the time_t could be
* converted to a valid PdfDate object. * converted to a valid PdfDate object.
* *
* \see IsValid() * \see IsValid()
*/ */
PdfDate( const time_t & t ); PdfDate( const time_t & t );
/* !Non-Doxygen comment because constructor is disabled! /** Create a PdfDate with a specified date and time
* Create a PdfDate with a specified date and time * \param szDate the date and time of this object
* \param zDate the date and time of this object
* in PDF format. It has to be a string of * in PDF format. It has to be a string of
* the format (D:YYYYMMDDHHmmSSOHH'mm'). * the format (D:YYYYMMDDHHmmSSOHH'mm').
* Otherwise IsValid will return false. * Otherwise IsValid will return false.
* *
* Use IsValid to check wether the string could be * Use IsValid to check wether the string could be
* converted to a valid PdfDate object. * converted to a valid PdfDate object.
* *
* \see IsValid() * \see IsValid()
*/ */
//PdfDate( const PdfString & sDate ); PdfDate( const PdfString & sDate );
/** Delete the PdfDate object /** Delete the PdfDate object
*/ */
virtual ~PdfDate(); virtual ~PdfDate();
/** You can use this function to check wether the date /** You can use this function to check wether the date
* you passed to the constructor could be converted to * you passed to the constructor could be converted to
* a valid pdf date string or a valid time_t. * a valid pdf date string or a valid time_t.
* *
* \returns true if the PdfDate object is valid * \returns true if the PdfDate object is valid
skipping to change at line 110 skipping to change at line 109
* \param rsString write the date to a PdfString * \param rsString write the date to a PdfString
*/ */
inline void ToString( PdfString & rsString ) const; inline void ToString( PdfString & rsString ) const;
private: private:
/** Creates the internal string representation from /** Creates the internal string representation from
* a time_t value and writes it to m_szDate. * a time_t value and writes it to m_szDate.
*/ */
void CreateStringRepresentation(); void CreateStringRepresentation();
/** Parse fixed length number from string
* \param in string to read number from
* \param length of number to read
* \param min minimal value of number
* \param max maximal value of number
* \param ret parsed number
*/
bool ParseFixLenNumber(const char *&in, unsigned int length, int min, i
nt max, int &ret);
private: private:
time_t m_time; time_t m_time;
char m_szDate[PDF_DATE_BUFFER_SIZE]; char m_szDate[PDF_DATE_BUFFER_SIZE];
bool m_bValid; bool m_bValid;
}; };
const time_t & PdfDate::GetTime() const const time_t & PdfDate::GetTime() const
{ {
return m_time; return m_time;
} }
void PdfDate::ToString( PdfString & rsString ) const void PdfDate::ToString( PdfString & rsString ) const
{ {
rsString = PdfString( m_szDate ); rsString = PdfString( m_szDate );
} }
bool PdfDate::IsValid() const
{
return m_bValid;
}
}; };
#endif // _PDF_DATE_H_ #endif // _PDF_DATE_H_
 End of changes. 4 change blocks. 
4 lines changed or deleted 18 lines changed or added


 PdfDefinesPrivate.h   PdfDefinesPrivate.h 
skipping to change at line 12 skipping to change at line 12
#define _PDF_DEFINES_PRIVATE_H_ #define _PDF_DEFINES_PRIVATE_H_
#ifndef BUILDING_PODOFO #ifndef BUILDING_PODOFO
#error PdfDefinesPrivate.h is only available for use in the core PoDoFo src / build .cpp files #error PdfDefinesPrivate.h is only available for use in the core PoDoFo src / build .cpp files
#endif #endif
// Right now, just pulls in the private parts of the compiler compat hacks. // Right now, just pulls in the private parts of the compiler compat hacks.
#include "PdfCompilerCompatPrivate.h" #include "PdfCompilerCompatPrivate.h"
/** /**
* \mainpage * \page <PoDoFo PdfDefinesPrivate Header>
* *
* <b>PdfDefinesPrivate.h</b> contains preprocessor definitions, inline fun ctions, templates, * <b>PdfDefinesPrivate.h</b> contains preprocessor definitions, inline fun ctions, templates,
* compile-time const variables, and other things that must be visible acro ss the entirety of * compile-time const variables, and other things that must be visible acro ss the entirety of
* the PoDoFo library code base but should not be visible to users of the l ibrary's headers. * the PoDoFo library code base but should not be visible to users of the l ibrary's headers.
* *
* This header is private to the library build. It is not installed with Po DoFo and must not be * This header is private to the library build. It is not installed with Po DoFo and must not be
* referenced in any way from any public, installed header. * referenced in any way from any public, installed header.
*/ */
#endif #endif
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 PdfDocument.h   PdfDocument.h 
skipping to change at line 40 skipping to change at line 40
#include "PdfAcroForm.h" #include "PdfAcroForm.h"
#include "PdfFontCache.h" #include "PdfFontCache.h"
#include "PdfInfo.h" #include "PdfInfo.h"
namespace PoDoFo { namespace PoDoFo {
class PdfDestination; class PdfDestination;
class PdfDictionary; class PdfDictionary;
class PdfFileSpec; class PdfFileSpec;
class PdfFont; class PdfFont;
class PdfFontConfigWrapper;
class PdfInfo; class PdfInfo;
class PdfMemDocument; class PdfMemDocument;
class PdfNamesTree; class PdfNamesTree;
class PdfOutlines; class PdfOutlines;
class PdfPage; class PdfPage;
class PdfPagesTree; class PdfPagesTree;
class PdfRect; class PdfRect;
class PdfXObject; class PdfXObject;
/** PdfDocument is the core interface for working with PDF documents. /** PdfDocument is the core interface for working with PDF documents.
skipping to change at line 294 skipping to change at line 295
/** Creates a new page object and inserts it into the internal /** Creates a new page object and inserts it into the internal
* page tree. * page tree.
* The returned page is owned by the PdfDocument * The returned page is owned by the PdfDocument
* and will get deleted along with it! * and will get deleted along with it!
* *
* \param rSize a PdfRect spezifying the size of the page (i.e the /Me diaBox key) in 1/1000th mm * \param rSize a PdfRect spezifying the size of the page (i.e the /Me diaBox key) in 1/1000th mm
* \returns a pointer to a PdfPage object * \returns a pointer to a PdfPage object
*/ */
PdfPage* CreatePage( const PdfRect & rSize ); PdfPage* CreatePage( const PdfRect & rSize );
/** Creates several new page objects and inserts them into the internal
* page tree.
* The created pages are owned by the PdfDocument
* and will get deleted along with it!
*
* \param vecSizes a vector PdfRect's specifying the size of the pages
(i.e the /MediaBox key) in PDF Units
*/
void CreatePages( const std::vector<PdfRect>& vecSizes );
/** Appends another PdfDocument to this document /** Appends another PdfDocument to this document
* \param rDoc the document to append * \param rDoc the document to append
* \param bAppendAll specifies whether pages and outlines are appended too * \param bAppendAll specifies whether pages and outlines are appended too
* \returns this document * \returns this document
*/ */
const PdfDocument & Append( const PdfMemDocument & rDoc, bool bAppendAl l = true ); const PdfDocument & Append( const PdfMemDocument & rDoc, bool bAppendAl l = true );
/** Fill an existing empty XObject from a page of another document /** Fill an existing empty XObject from a page of another document
* This will append the other document with this one
* \param pXObj pointer to the XOject * \param pXObj pointer to the XOject
* \param rDoc the document to embedd into XObject * \param rDoc the document to embedd into XObject
* \param nPage page-number to embedd into XObject * \param nPage page-number to embedd into XObject
* \param bUseTrimBox if true try to use trimbox for size of xo bject * \param bUseTrimBox if true try to use trimbox for size of xobject
* \returns the bounding box * \returns the bounding box
*/ */
PdfRect FillXObjectFromDocumentPage( PdfXObject * pXObj, const PdfMemDo cument & rDoc, int nPage, bool bUseTrimBox ); PdfRect FillXObjectFromDocumentPage( PdfXObject * pXObj, const PdfMemDo cument & rDoc, int nPage, bool bUseTrimBox );
/** Fill an existing empty XObject from an existing page from the curre
nt document
* If you need a page from another document use FillXObjectFromDocumen
tPage, or append the documents manually
* \param pXObj pointer to the XOject
* \param nPage page-number to embedd into XObject
* \param bUseTrimBox if true try to use trimbox for size of xobject
* \returns the bounding box
*/
PdfRect FillXObjectFromExistingPage( PdfXObject * pXObj, int nPage, boo
l bUseTrimBox );
/** Fill an existing empty XObject from an existing page pointer from t
he current document
* This is the implementation for FillXObjectFromDocumentPage and Fill
XObjectFromExistingPage, you should use those directly instead of this
* \param pXObj pointer to the XOject
* \param pPage pointer to the page to embedd into XObject
* \param bUseTrimBox if true try to use trimbox for size of xobject
* \returns the bounding box
*/
PdfRect FillXObjectFromPage( PdfXObject * pXObj, const PdfPage * pPage,
bool bUseTrimBox, unsigned int difference );
/** Attach a file to the document. /** Attach a file to the document.
* \param rFileSpec a file specification * \param rFileSpec a file specification
*/ */
void AttachFile( const PdfFileSpec & rFileSpec ); void AttachFile( const PdfFileSpec & rFileSpec );
/** Adds a PdfDestination into the global Names tree /** Adds a PdfDestination into the global Names tree
* with the specified name, optionally replacing one of the same name * with the specified name, optionally replacing one of the same name
* \param rDest the destination to be assigned * \param rDest the destination to be assigned
* \param rsName the name for the destination * \param rsName the name for the destination
*/ */
skipping to change at line 485 skipping to change at line 514
inline PdfVecObjects* GetObjects(); inline PdfVecObjects* GetObjects();
// Peter Petrov 26 April 2008 // Peter Petrov 26 April 2008
/** Get access to the internal vector of objects /** Get access to the internal vector of objects
* or root object. * or root object.
* *
* \returns the vector of objects * \returns the vector of objects
*/ */
inline const PdfVecObjects* GetObjects() const; inline const PdfVecObjects* GetObjects() const;
/**
* Set wrapper for the fontconfig library.
* Useful to avoid initializing Fontconfig multiple times.
*
* This setter can be called until first use of Fontconfig
* as the library is initialized at first use.
*/
inline void SetFontConfigWrapper(const PdfFontConfigWrapper & rFontConf
ig);
protected: protected:
/** Construct a new (empty) PdfDocument /** Construct a new (empty) PdfDocument
*/ */
PdfDocument(); PdfDocument();
/** Set the info object containing meta information. /** Set the info object containing meta information.
* Deletes any old info object. * Deletes any old info object.
* *
* @param pInfo the new info object (will be owned by PdfDocument) * @param pInfo the new info object (will be owned by PdfDocument)
*/ */
skipping to change at line 678 skipping to change at line 716
// Peter Petrov 26 April 2008 // Peter Petrov 26 April 2008
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline FT_Library PdfDocument::GetFontLibrary() const inline FT_Library PdfDocument::GetFontLibrary() const
{ {
return this->m_fontCache.GetFontLibrary(); return this->m_fontCache.GetFontLibrary();
} }
// -----------------------------------------------------
//
// -----------------------------------------------------
inline void PdfDocument::SetFontConfigWrapper(const PdfFontConfigWrapper &
rFontConfig)
{
m_fontCache.SetFontConfigWrapper(rFontConfig);
}
}; };
#endif // _PDF_DOCUMENT_H_ #endif // _PDF_DOCUMENT_H_
 End of changes. 7 change blocks. 
1 lines changed or deleted 56 lines changed or added


 PdfEncrypt.h   PdfEncrypt.h 
skipping to change at line 32 skipping to change at line 32
#define _PDFENCRYPT_H_ #define _PDFENCRYPT_H_
#include "PdfDefines.h" #include "PdfDefines.h"
#include "PdfString.h" #include "PdfString.h"
#include "PdfReference.h" #include "PdfReference.h"
namespace PoDoFo { namespace PoDoFo {
class PdfDictionary; class PdfDictionary;
class PdfInputStream; class PdfInputStream;
class PdfRijndael;
class PdfObject; class PdfObject;
class PdfOutputStream; class PdfOutputStream;
class AESCryptoEngine;
class RC4CryptoEngine;
/// Class representing PDF encryption methods. (For internal use only) /// Class representing PDF encryption methods. (For internal use only)
/// Based on code from Ulrich Telle: http://wxcode.sourceforge.net/componen ts/wxpdfdoc/ /// Based on code from Ulrich Telle: http://wxcode.sourceforge.net/componen ts/wxpdfdoc/
/// Original Copyright header: /// Original Copyright header:
/////////////////////////////////////////////////////////////////////////// //// /////////////////////////////////////////////////////////////////////////// ////
// Name: pdfencrypt.h // Name: pdfencrypt.h
// Purpose: // Purpose:
// Author: Ulrich Telle // Author: Ulrich Telle
// Modified by: // Modified by:
// Created: 2005-08-16 // Created: 2005-08-16
skipping to change at line 67 skipping to change at line 68
* *
*/ */
class PODOFO_API PdfEncrypt class PODOFO_API PdfEncrypt
{ {
public: public:
/** A enum specifying a valid keylength for a PDF encryption key. /** A enum specifying a valid keylength for a PDF encryption key.
* Keys must be in the range 40 to 128 bit and have to be a * Keys must be in the range 40 to 128 bit and have to be a
* multiple of 8. * multiple of 8.
* *
* Adobe Reader supports only keys with 40 or 128bit! * Adobe Reader supports only keys with 40, 128 or 256 bits!
*/ */
typedef enum { typedef enum {
ePdfKeyLength_40 = 40, ePdfKeyLength_40 = 40,
ePdfKeyLength_56 = 56, ePdfKeyLength_56 = 56,
ePdfKeyLength_80 = 80, ePdfKeyLength_80 = 80,
ePdfKeyLength_96 = 96, ePdfKeyLength_96 = 96,
ePdfKeyLength_128 = 128 ePdfKeyLength_128 = 128
#ifdef PODOFO_HAVE_LIBIDN
,ePdfKeyLength_256 = 256
#endif //PODOFO_HAVE_LIBIDN
} EPdfKeyLength; } EPdfKeyLength;
/** Set user permissions/restrictions on a document /** Set user permissions/restrictions on a document
*/ */
typedef enum { typedef enum {
ePdfPermissions_Print = 0x00000004, ///< Allow printing t he document ePdfPermissions_Print = 0x00000004, ///< Allow printing t he document
ePdfPermissions_Edit = 0x00000008, ///< Allow modifying the document besides annotations, form fields or chaning pages ePdfPermissions_Edit = 0x00000008, ///< Allow modifying the document besides annotations, form fields or chaning pages
ePdfPermissions_Copy = 0x00000010, ///< Allow text and g raphic extraction ePdfPermissions_Copy = 0x00000010, ///< Allow text and g raphic extraction
ePdfPermissions_EditNotes = 0x00000020, ///< Add or modify te xt annoations or form fields (if ePdfPermissions_Edit is set also allow to create interactive form fields including signature) ePdfPermissions_EditNotes = 0x00000020, ///< Add or modify te xt annoations or form fields (if ePdfPermissions_Edit is set also allow to create interactive form fields including signature)
ePdfPermissions_FillAndSign = 0x00000100, ///< Fill in existing form or signature fields ePdfPermissions_FillAndSign = 0x00000100, ///< Fill in existing form or signature fields
skipping to change at line 96 skipping to change at line 100
ePdfPermissions_DocAssembly = 0x00000400, ///< Assemble the doc ument: insert, create, rotate delete pages or add bookmarks ePdfPermissions_DocAssembly = 0x00000400, ///< Assemble the doc ument: insert, create, rotate delete pages or add bookmarks
ePdfPermissions_HighPrint = 0x00000800 ///< Print a high res olution version of the document ePdfPermissions_HighPrint = 0x00000800 ///< Print a high res olution version of the document
} EPdfPermissions; } EPdfPermissions;
/** /**
* The encryption algorithm. * The encryption algorithm.
*/ */
typedef enum { typedef enum {
ePdfEncryptAlgorithm_RC4V1 = 1, ///< RC4 Version 1 encryption using a 40bit key ePdfEncryptAlgorithm_RC4V1 = 1, ///< RC4 Version 1 encryption using a 40bit key
ePdfEncryptAlgorithm_RC4V2 = 2, ///< RC4 Version 2 encryption using a key with 40-128bit ePdfEncryptAlgorithm_RC4V2 = 2, ///< RC4 Version 2 encryption using a key with 40-128bit
ePdfEncryptAlgorithm_AESV2 = 4 ///< AES encryption with an 128 bit ePdfEncryptAlgorithm_AESV2 = 4 ///< AES encryption with a 128 bit
key (PDF1.6) key (PDF1.6)
#ifdef PODOFO_HAVE_LIBIDN
,ePdfEncryptAlgorithm_AESV3 = 8 ///< AES encryption with a 256 bit
key (PDF1.7 extension 3) - Support added by P. Zent
#endif //PODOFO_HAVE_LIBIDN
} EPdfEncryptAlgorithm; } EPdfEncryptAlgorithm;
/** Create a PdfEncrypt object which can be used to encrypt a PDF file. /** Create a PdfEncrypt object which can be used to encrypt a PDF file.
* *
* \param userPassword the user password (if empty the user does not h ave * \param userPassword the user password (if empty the user does not h ave
* to enter a password to open the document) * to enter a password to open the document)
* \param ownerPassword the owner password * \param ownerPassword the owner password
* \param protection several EPdfPermissions values or'ed together to set * \param protection several EPdfPermissions values or'ed together to set
* the users permissions for this document * the users permissions for this document
* \param eAlgorithm the revision of the encryption algorithm to be us ed * \param eAlgorithm the revision of the encryption algorithm to be us ed
skipping to change at line 181 skipping to change at line 188
* Test if a certain encryption algorithm is enabled for loading PDF do cuments. * Test if a certain encryption algorithm is enabled for loading PDF do cuments.
* *
* \returns ture if the encryption algorithm is enabled * \returns ture if the encryption algorithm is enabled
* \see GetEnabledEncryptionAlgorithms * \see GetEnabledEncryptionAlgorithms
* \see SetEnabledEncryptionAlgorithms * \see SetEnabledEncryptionAlgorithms
*/ */
static bool IsEncryptionEnabled(EPdfEncryptAlgorithm eAlgorithm); static bool IsEncryptionEnabled(EPdfEncryptAlgorithm eAlgorithm);
/** Destruct the PdfEncrypt object /** Destruct the PdfEncrypt object
*/ */
virtual ~PdfEncrypt(); virtual ~PdfEncrypt() = 0;
/** Assignment operator
*
* \param rhs another PdfEncrypt object which is copied
*/
const PdfEncrypt & operator=( const PdfEncrypt & rhs );
/** Generate encryption key from user and owner passwords and protectio n key /** Generate encryption key from user and owner passwords and protectio n key
* *
* \param documentId the documentId of the current document * \param documentId the documentId of the current document
*/ */
void GenerateEncryptionKey(const PdfString & documentId); virtual void GenerateEncryptionKey(const PdfString & documentId) = 0;
/** Fill all keys into a encryption dictionary. /** Fill all keys into a encryption dictionary.
* This dictionary is usually added to the PDF files trailer * This dictionary is usually added to the PDF files trailer
* under the /Encryption key. * under the /Encryption key.
* *
* \param rDictionary an empty dictionary which is filled with informa tion about * \param rDictionary an empty dictionary which is filled with informa tion about
* the used encryption algorithm * the used encryption algorithm
*/ */
virtual void CreateEncryptionDictionary( PdfDictionary & rDictionary ) const = 0; virtual void CreateEncryptionDictionary( PdfDictionary & rDictionary ) const = 0;
skipping to change at line 236 skipping to change at line 237
virtual PdfInputStream* CreateEncryptionInputStream( PdfInputStream* pI nputStream ) = 0; virtual PdfInputStream* CreateEncryptionInputStream( PdfInputStream* pI nputStream ) = 0;
/** /**
* Tries to authenticate a user using either the user or owner password * Tries to authenticate a user using either the user or owner password
* *
* \param password owner or user password * \param password owner or user password
* \param documentId the documentId of the PDF file * \param documentId the documentId of the PDF file
* *
* \returns true if either the owner or user password matches password * \returns true if either the owner or user password matches password
*/ */
bool Authenticate( const std::string & password, const PdfString & docu mentId ); virtual bool Authenticate( const std::string & password, const PdfStrin g & documentId ) = 0;
/** Get the encryption algorithm of this object. /** Get the encryption algorithm of this object.
* \returns the EPdfEncryptAlgorithm of this object * \returns the EPdfEncryptAlgorithm of this object
*/ */
inline EPdfEncryptAlgorithm GetEncryptAlgorithm() const; inline EPdfEncryptAlgorithm GetEncryptAlgorithm() const;
/** Checks if printing this document is allowed. /** Checks if printing this document is allowed.
* Every PDF consuming applications has to adhere this value! * Every PDF consuming applications has to adhere this value!
* *
* \returns true if you are allowed to print this document * \returns true if you are allowed to print this document
skipping to change at line 315 skipping to change at line 316
/** Checks if it is allowed to print a high quality version of this doc ument /** Checks if it is allowed to print a high quality version of this doc ument
* Every PDF consuming applications has to adhere this value! * Every PDF consuming applications has to adhere this value!
* *
* \returns true if you are allowed to print a high quality version of this document * \returns true if you are allowed to print a high quality version of this document
* *
* \see PdfEncrypt to set own document permissions. * \see PdfEncrypt to set own document permissions.
*/ */
inline bool IsHighPrintAllowed() const; inline bool IsHighPrintAllowed() const;
bool Authenticate(const std::string & documentID, const std::string & p
assword,
const std::string & uValue, const std::string & oValu
e,
int pValue, int lengthValue, int rValue);
/// Get the U object value (user) /// Get the U object value (user)
const unsigned char* GetUValue() const { return m_uValue; } const unsigned char* GetUValue() const { return m_uValue; }
/// Get the O object value (owner) /// Get the O object value (owner)
const unsigned char* GetOValue() const { return m_oValue; } const unsigned char* GetOValue() const { return m_oValue; }
/// Get the encryption key value (owner)
const unsigned char* GetEncryptionKey() const { return m_encryptionKey;
}
/// Get the P object value (protection) /// Get the P object value (protection)
int GetPValue() const { return m_pValue; } pdf_int32 GetPValue() const { return m_pValue; }
/// Get the revision number of the encryption method /// Get the revision number of the encryption method
int GetRevision() const { return m_rValue; } int GetRevision() const { return m_rValue; }
/// Get the key length of the encryption key in bits /// Get the key length of the encryption key in bits
int GetKeyLength() const { return m_keyLength*8; } int GetKeyLength() const { return m_keyLength*8; }
/// Encrypt a wxString /// Encrypt a wxString
void Encrypt( std::string & str, pdf_long inputLen ) const; //void Encrypt( std::string & str, pdf_long inputLen ) const;
/// Encrypt a character string /// Encrypt a character string
virtual void Encrypt(unsigned char* str, pdf_long len) const = 0; // inStr: the input buffer
// inLen: length of the input buffer
// outStr: the output buffer
// outLen: length of the output buffer
virtual void Encrypt(const unsigned char* inStr, pdf_long inLen,
unsigned char* outStr, pdf_long outLen) const = 0;
/// Decrypt a character string
// inStr: the input buffer
// inLen: length of the input buffer
// outStr: the output buffer
// outLen: length of the output buffer
virtual void Decrypt(const unsigned char* inStr, pdf_long inLen,
unsigned char* outStr, pdf_long outLen) const = 0;
/// Calculate stream size /// Calculate stream size
virtual pdf_long CalculateStreamLength(pdf_long length) const; virtual pdf_long CalculateStreamLength(pdf_long length) const = 0;
/// Calculate stream offset /// Calculate stream offset
virtual pdf_long CalculateStreamOffset() const; virtual pdf_long CalculateStreamOffset() const = 0;
/** Create a PdfString of MD5 data generated from a buffer in memory.
* \param pBuffer the buffer of which to calculate the MD5 sum
* \param nLength the length of the buffer
*
* \returns an MD5 sum as PdfString
*/
static PdfString GetMD5String( const unsigned char* pBuffer, int nLengt
h );
/** Set the reference of the object that is currently encrypted. /** Set the reference of the object that is currently encrypted.
* *
* This value will be used in following calls of Encrypt * This value will be used in following calls of Encrypt
* to encrypt the object. * to encrypt the object.
* *
* \see Encrypt * \see Encrypt
*/ */
inline void SetCurrentReference( const PdfReference & rRef ); inline void SetCurrentReference( const PdfReference & rRef );
protected: protected:
PdfEncrypt() {}; PdfEncrypt() {};
PdfEncrypt( const PdfEncrypt & rhs );
/// Check two keys for equality
bool CheckKey(unsigned char key1[32], unsigned char key2[32]);
EPdfEncryptAlgorithm m_eAlgorithm; ///< The used encryption algorithm
int m_keyLength; ///< Length of encryption key
int m_rValue; ///< Revision
pdf_int32 m_pValue; ///< P entry in pdf document
EPdfKeyLength m_eKeyLength; ///< The key length
std::string m_userPass; ///< User password
std::string m_ownerPass; ///< Owner password
unsigned char m_uValue[48]; ///< U entry in pdf document
unsigned char m_oValue[48]; ///< O entry in pdf document
unsigned char m_encryptionKey[32]; ///< Encryption key
PdfReference m_curReference; ///< Reference of the current PdfO
bject
std::string m_documentId; ///< DocumentID of the current doc
ument
private:
static int s_nEnabledEncryptionAlgorithms; ///< Or'ed int containin
g the enabled encryption algorithms
};
#ifdef PODOFO_HAVE_LIBIDN
/** A pure virtual class that is used to encrypt a PDF file (AES-256)
* This class is the base for classes that implement algorithms based on S
HA hashes
*
* Client code is working only with PdfEncrypt class and knows nothing
* about PdfEncrypt*, it is created through CreatePdfEncrypt factory me
thod
*
*/
class PdfEncryptSHABase : public PdfEncrypt {
public:
PdfEncryptSHABase() {};
// copy constructor // copy constructor
PdfEncrypt( const PdfEncrypt & rhs ); PdfEncryptSHABase(const PdfEncrypt &rhs);
/// Pad a password to 32 characters /*
void PadPassword(const std::string& password, unsigned char pswd[32]); * Destruct PdfEncryptAESV2 object
*/
virtual ~PdfEncryptSHABase() {};
virtual PdfInputStream* CreateEncryptionInputStream( PdfInputStream* pI
nputStream ) = 0;
virtual PdfOutputStream* CreateEncryptionOutputStream( PdfOutputStream*
pOutputStream ) = 0;
virtual void CreateEncryptionDictionary( PdfDictionary & rDictionary )
const;
virtual bool Authenticate( const std::string & password, const PdfStrin
g & documentId ) = 0;
/// Encrypt a character string
virtual void Encrypt(const unsigned char* inStr, pdf_long inLen,
unsigned char* outStr, pdf_long outLen) const = 0;
virtual void GenerateEncryptionKey(const PdfString & documentId) = 0;
/// Get the UE object value (user)
const unsigned char* GetUEValue() const { return m_ueValue; }
/// Get the OE object value (owner)
const unsigned char* GetOEValue() const { return m_oeValue; }
/// Get the Perms object value (encrypted protection)
const unsigned char* GetPermsValue() const { return m_permsValue; }
virtual pdf_long CalculateStreamOffset() const = 0;
virtual pdf_long CalculateStreamLength(pdf_long length) const = 0;
bool Authenticate(const std::string & documentID, const std::string & p
assword,
const std::string & uValue, const std::string & ueVal
ue,
const std::string & oValue, const std::string & oeVal
ue,
int pValue, const std::string & permsValue,
int lengthValue, int rValue);
protected:
/// Generate initial vector
virtual void GenerateInitialVector(unsigned char iv[16]);
/// Compute encryption key to be used with AES-256
void ComputeEncryptionKey();
/// Generate the U and UE entries
void ComputeUserKey(const unsigned char * userpswd, int len);
/// Generate the O and OE entries
void ComputeOwnerKey(const unsigned char * userpswd, int len);
/// Preprocess password for use in EAS-256 Algorithm
/// outBuf needs to be at least 127 bytes long
void PreprocessPassword( const std::string &password, unsigned char* ou
tBuf, int &len);
unsigned char m_ueValue[32]; ///< UE entry in pdf document
unsigned char m_oeValue[32]; ///< OE entry in pdf document
unsigned char m_permsValue[16]; ///< Perms entry in pdf document
};
/** A pure virtual class that is used to encrypt a PDF file (RC4, AES-128)
* This class is the base for classes that implement algorithms based on M
D5 hashes
*
* Client code is working only with PdfEncrypt class and knows nothing
* about PdfEncrypt*, it is created through CreatePdfEncrypt factory me
thod
*
*/
#endif // PODOFO_HAVE_LIBIDN
/** A pure virtual class that is used to encrypt a PDF file (AES-128/256)
* This class is the base for classes that implement algorithms based on A
ES
*
* Client code is working only with PdfEncrypt class and knows nothing
* about PdfEncrypt*, it is created through CreatePdfEncrypt factory me
thod
*
*/
class PdfEncryptAESBase {
public:
~PdfEncryptAESBase();
protected:
PdfEncryptAESBase();
/// AES encryption
void AES(const unsigned char* key, int keylen, const unsigned char* iv,
const unsigned char* textin, pdf_long textlen,
unsigned char* textout, pdf_long textoutlen);
AESCryptoEngine* m_aes; ///< AES encryptor
};
/** A pure virtual class that is used to encrypt a PDF file (RC4-40..128)
* This class is the base for classes that implement algorithms based on R
C4
*
* Client code is working only with PdfEncrypt class and knows nothing
* about PdfEncrypt*, it is created through CreatePdfEncrypt factory me
thod
*
*/
class PdfEncryptRC4Base {
public:
~PdfEncryptRC4Base();
protected:
PdfEncryptRC4Base();
/// AES encryption
void RC4(const unsigned char* key, int keylen,
const unsigned char* textin, pdf_long textlen,
unsigned char* textout, pdf_long textoutlen);
RC4CryptoEngine* m_rc4; ///< AES encryptor
};
class PdfEncryptMD5Base : public PdfEncrypt, public PdfEncryptRC4Base {
public:
PdfEncryptMD5Base() {};
// copy constructor
PdfEncryptMD5Base(const PdfEncrypt &rhs);
/*
* Destruct PdfEncryptAESV2 object
*/
virtual ~PdfEncryptMD5Base() {};
virtual PdfInputStream* CreateEncryptionInputStream( PdfInputStream* pI
nputStream ) = 0;
virtual PdfOutputStream* CreateEncryptionOutputStream( PdfOutputStream*
pOutputStream ) = 0;
virtual void CreateEncryptionDictionary( PdfDictionary & rDictionary )
const;
virtual bool Authenticate( const std::string & password, const PdfStrin
g & documentId ) = 0;
/// Encrypt a character string
virtual void Encrypt(const unsigned char* inStr, pdf_long inLen,
unsigned char* outStr, pdf_long outLen) const = 0;
virtual void GenerateEncryptionKey(const PdfString & documentId) = 0;
/** Create a PdfString of MD5 data generated from a buffer in memory.
* \param pBuffer the buffer of which to calculate the MD5 sum
* \param nLength the length of the buffer
*
* \returns an MD5 sum as PdfString
*/
static PdfString GetMD5String( const unsigned char* pBuffer, int nLengt
h );
virtual pdf_long CalculateStreamOffset() const = 0;
virtual pdf_long CalculateStreamLength(pdf_long length) const = 0;
/// Calculate the binary MD5 message digest of the given data
static void GetMD5Binary(const unsigned char* data, int length, unsigne
d char* digest);
bool Authenticate(const std::string & documentID, const std::string & p
assword,
const std::string & uValue, const std::string & oValu
e,
int pValue, int lengthValue, int rValue);
protected:
/// Generate initial vector
virtual void GenerateInitialVector(unsigned char iv[16]);
/// Compute owner key /// Compute owner key
void ComputeOwnerKey(unsigned char userPad[32], unsigned char ownerPad[ 32], void ComputeOwnerKey(unsigned char userPad[32], unsigned char ownerPad[ 32],
int keylength, int revision, bool authenticate, int keylength, int revision, bool authenticate,
unsigned char ownerKey[32]); unsigned char ownerKey[32]);
/// Pad a password to 32 characters
void PadPassword(const std::string& password, unsigned char pswd[32]);
/// Compute encryption key and user key /// Compute encryption key and user key
void ComputeEncryptionKey(const std::string & documentID, void ComputeEncryptionKey(const std::string & documentID,
unsigned char userPad[32], unsigned char owne rKey[32], unsigned char userPad[32], unsigned char owne rKey[32],
int pValue, int keyLength, int revision, int pValue, int keyLength, int revision,
unsigned char userKey[32]); unsigned char userKey[32]);
/// Check two keys for equality
bool CheckKey(unsigned char key1[32], unsigned char key2[32]);
/// RC4 encryption
void RC4(unsigned char* key, int keylen,
unsigned char* textin, pdf_long textlen,
unsigned char* textout);
/// Calculate the binary MD5 message digest of the given data
static void GetMD5Binary(const unsigned char* data, int length, unsigne
d char* digest);
/// Generate initial vector
void GenerateInitialVector(unsigned char iv[16]);
/** Create the encryption key for the current object. /** Create the encryption key for the current object.
* *
* \param objkey pointer to an array of at least MD5_HASHBYTES (=16) b ytes length * \param objkey pointer to an array of at least MD5_HASHBYTES (=16) b ytes length
* \param pnKeyLen pointer to an integer where the actual keylength is stored. * \param pnKeyLen pointer to an integer where the actual keylength is stored.
*/ */
void CreateObjKey( unsigned char objkey[16], int* pnKeyLen ) const; virtual void CreateObjKey( unsigned char objkey[16], int* pnKeyLen ) co nst;
EPdfEncryptAlgorithm m_eAlgorithm; ///< The used encryption algorith
m
int m_keyLength; ///< Length of encryption key
int m_rValue; ///< Revision
int m_pValue; ///< P entry in pdf document
EPdfKeyLength m_eKeyLength; ///< The key length
std::string m_userPass; ///< User password
std::string m_ownerPass; ///< Owner password
unsigned char m_rc4key[16]; ///< last RC4 key unsigned char m_rc4key[16]; ///< last RC4 key
unsigned char m_rc4last[256]; ///< last RC4 state table unsigned char m_rc4last[256]; ///< last RC4 state table
unsigned char m_uValue[32]; ///< U entry in pdf document
unsigned char m_oValue[32]; ///< O entry in pdf document
private:
static int s_nEnabledEncryptionAlgorithms; ///< Or'ed int containin
g the enabled encryption algorithms
unsigned char m_encryptionKey[16]; ///< Encryption key
PdfReference m_curReference; ///< Reference of the current PdfO
bject
std::string m_documentId; ///< DocumentID of the current doc
ument
}; };
/** A class that is used to encrypt a PDF file (AES-128) /** A class that is used to encrypt a PDF file (AES-128)
* *
* Client code is working only with PdfEncrypt class and knows nothing * Client code is working only with PdfEncrypt class and knows nothing
* about PdfEncryptAES, it is created through CreatePdfEncrypt factory method * about PdfEncryptAES*, it is created through CreatePdfEncrypt factory method
* *
*/ */
class PdfEncryptAES : public PdfEncrypt { class PdfEncryptAESV2 : public PdfEncryptMD5Base, public PdfEncryptAESBase {
public: public:
/* /*
* Constructors of PdfEncryptAES * Constructors of PdfEncryptAESV2
*/ */
PdfEncryptAES(PdfString oValue, PdfString uValue, int pValue); PdfEncryptAESV2(PdfString oValue, PdfString uValue, int pValue);
PdfEncryptAES(const PdfEncrypt & rhs); PdfEncryptAESV2( const PdfEncrypt & rhs ) : PdfEncryptMD5Base(rhs) {}
PdfEncryptAES( const std::string & userPassword, PdfEncryptAESV2( const std::string & userPassword,
const std::string & ownerPassword, const std::string & ownerPassword,
int protection = ePdfPermissions_Print | int protection = ePdfPermissions_Print |
ePdfPermissions_Edit | ePdfPermissions_Edit |
ePdfPermissions_Copy | ePdfPermissions_Copy |
ePdfPermissions_EditNotes | ePdfPermissions_EditNotes |
ePdfPermissions_FillAndSign | ePdfPermissions_FillAndSign |
ePdfPermissions_Accessible | ePdfPermissions_Accessible |
ePdfPermissions_DocAssembly | ePdfPermissions_DocAssembly |
ePdfPermissions_HighPrint ePdfPermissions_HighPrint
); );
/* /*
* Destruct PdfEncryptAES object * Destruct PdfEncryptAESV2 object
*/ */
~PdfEncryptAES(); virtual ~PdfEncryptAESV2() {};
void Encrypt(unsigned char* str, pdf_long len) const; virtual PdfInputStream* CreateEncryptionInputStream( PdfInputStream*
pInputStream );
virtual PdfOutputStream* CreateEncryptionOutputStream( PdfOutputStre
am* pOutputStream );
/// Calculate stream offset virtual bool Authenticate( const std::string & password, const PdfStrin
pdf_long CalculateStreamOffset() const; g & documentId );
PdfInputStream* CreateEncryptionInputStream( PdfInputStream* pInputS /// Encrypt a character string
tream ); virtual void Encrypt(const unsigned char* inStr, pdf_long inLen,
PdfOutputStream* CreateEncryptionOutputStream( PdfOutputStream* pOut unsigned char* outStr, pdf_long outLen) const;
putStream ); virtual void Decrypt(const unsigned char* inStr, pdf_long inLen,
unsigned char* outStr, pdf_long outLen) const;
pdf_long CalculateStreamLength(pdf_long length) const; virtual void GenerateEncryptionKey(const PdfString & documentId);
void CreateEncryptionDictionary( PdfDictionary & rDictionary ) const ; virtual pdf_long CalculateStreamOffset() const;
private: virtual pdf_long CalculateStreamLength(pdf_long length) const;
/// AES encryption };
void AES(unsigned char* key, int keylen,
unsigned char* textin, pdf_long textlen, #ifdef PODOFO_HAVE_LIBIDN
unsigned char* textout); /** A class that is used to encrypt a PDF file (AES-256)
*
* Client code is working only with PdfEncrypt class and knows nothing
* about PdfEncryptAES*, it is created through CreatePdfEncrypt factory
method
*
*/
class PdfEncryptAESV3 : public PdfEncryptSHABase, public PdfEncryptAESBase
{
public:
/*
* Constructors of PdfEncryptAESV3
*/
PdfEncryptAESV3(PdfString oValue, PdfString oeValue, PdfString uValue,
PdfString ueValue, int pValue, PdfString permsValue);
PdfEncryptAESV3( const PdfEncrypt & rhs ) : PdfEncryptSHABase(rhs) {}
PdfEncryptAESV3( const std::string & userPassword,
const std::string & ownerPassword,
int protection = ePdfPermissions_Print |
ePdfPermissions_Edit |
ePdfPermissions_Copy |
ePdfPermissions_EditNotes |
ePdfPermissions_FillAndSign |
ePdfPermissions_Accessible |
ePdfPermissions_DocAssembly |
ePdfPermissions_HighPrint
);
/*
* Destruct PdfEncryptAESV3 object
*/
virtual ~PdfEncryptAESV3() {};
virtual PdfInputStream* CreateEncryptionInputStream( PdfInputStream* pI
nputStream );
virtual PdfOutputStream* CreateEncryptionOutputStream( PdfOutputStream*
pOutputStream );
virtual bool Authenticate( const std::string & password, const PdfStrin
g & documentId );
PdfRijndael* m_aes; ///< AES encryptor /// Encrypt a character string
virtual void Encrypt(const unsigned char* inStr, pdf_long inLen,
unsigned char* outStr, pdf_long outLen) const;
virtual void Decrypt(const unsigned char* inStr, pdf_long inLen,
unsigned char* outStr, pdf_long outLen) const;
virtual void GenerateEncryptionKey(const PdfString & documentId);
virtual pdf_long CalculateStreamOffset() const;
virtual pdf_long CalculateStreamLength(pdf_long length) const;
}; };
#endif // PODOFO_HAVE_LIBIDN
/** A class that is used to encrypt a PDF file (RC4 40-bit and 128-bit) /** A class that is used to encrypt a PDF file (RC4 40-bit and 128-bit)
* *
* Client code is working only with PdfEncrypt class and knows nothing * Client code is working only with PdfEncrypt class and knows nothing
* about PdfEncryptRC4, it is created through CreatePdfEncrypt factory method * about PdfEncryptRC4, it is created through CreatePdfEncrypt factory method
* *
*/ */
class PdfEncryptRC4 : public PdfEncrypt { class PdfEncryptRC4 : public PdfEncryptMD5Base {
public: public:
/* /*
* Constructors of PdfEncryptRC4 objects * Constructors of PdfEncryptRC4 objects
*/ */
PdfEncryptRC4(PdfString oValue, PdfString uValue, PdfEncryptRC4(PdfString oValue, PdfString uValue,
int pValue, int rValue, EPdfEncryptAlgorithm eAlgorithm, lon g length); int pValue, int rValue, EPdfEncryptAlgorithm eAlgorithm, lon g length);
PdfEncryptRC4( const PdfEncrypt & rhs ) : PdfEncryptMD5Base(rhs) {}
PdfEncryptRC4( const std::string & userPassword, PdfEncryptRC4( const std::string & userPassword,
const std::string & ownerPassword, const std::string & ownerPassword,
int protection = ePdfPermissions_Print | int protection = ePdfPermissions_Print |
ePdfPermissions_Edit | ePdfPermissions_Edit |
ePdfPermissions_Copy | ePdfPermissions_Copy |
ePdfPermissions_EditNotes | ePdfPermissions_EditNotes |
ePdfPermissions_FillAndSign | ePdfPermissions_FillAndSign |
ePdfPermissions_Accessible | ePdfPermissions_Accessible |
ePdfPermissions_DocAssembly | ePdfPermissions_DocAssembly |
ePdfPermissions_HighPrint, ePdfPermissions_HighPrint,
EPdfEncryptAlgorithm eAlgorithm = ePdfEncryptAlgorithm_RC 4V1, EPdfEncryptAlgorithm eAlgorithm = ePdfEncryptAlgorithm_RC 4V1,
EPdfKeyLength eKeyLength = ePdfKeyLength_40 ); EPdfKeyLength eKeyLength = ePdfKeyLength_40 );
PdfEncryptRC4(const PdfEncrypt & rhs) : PdfEncrypt(rhs) {}
void Encrypt(unsigned char* str, pdf_long len) const; /*
* Destruct PdfEncryptRC4 object
*/
virtual ~PdfEncryptRC4() {}
virtual bool Authenticate( const std::string & password, const PdfStrin
g & documentId );
PdfInputStream* CreateEncryptionInputStream( PdfInputStream* pInputS /// Encrypt a character string
tream ); virtual void Encrypt(const unsigned char* inStr, pdf_long inLen,
PdfOutputStream* CreateEncryptionOutputStream( PdfOutputStream* pOut unsigned char* outStr, pdf_long outLen) const;
putStream ); virtual void Decrypt(const unsigned char* inStr, pdf_long inLen,
unsigned char* outStr, pdf_long outLen) const;
void CreateEncryptionDictionary( PdfDictionary & rDictionary ) const virtual PdfInputStream* CreateEncryptionInputStream( PdfInputStream*
; pInputStream );
virtual PdfOutputStream* CreateEncryptionOutputStream( PdfOutputStre
am* pOutputStream );
virtual void GenerateEncryptionKey(const PdfString & documentId);
virtual pdf_long CalculateStreamOffset() const;
virtual pdf_long CalculateStreamLength(pdf_long length) const;
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
PdfEncrypt::EPdfEncryptAlgorithm PdfEncrypt::GetEncryptAlgorithm() const PdfEncrypt::EPdfEncryptAlgorithm PdfEncrypt::GetEncryptAlgorithm() const
{ {
return m_eAlgorithm; return m_eAlgorithm;
} }
skipping to change at line 536 skipping to change at line 771
void PdfEncrypt::SetCurrentReference( const PdfReference & rRef ) void PdfEncrypt::SetCurrentReference( const PdfReference & rRef )
{ {
m_curReference = rRef; m_curReference = rRef;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
bool PdfEncrypt::IsPrintAllowed() const bool PdfEncrypt::IsPrintAllowed() const
{ {
// TODO: Check is this is correct (+/- 1 required ???)
return (m_pValue & ePdfPermissions_Print) == ePdfPermissions_Print; return (m_pValue & ePdfPermissions_Print) == ePdfPermissions_Print;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
bool PdfEncrypt::IsEditAllowed() const bool PdfEncrypt::IsEditAllowed() const
{ {
return (m_pValue & ePdfPermissions_Edit) == ePdfPermissions_Edit; return (m_pValue & ePdfPermissions_Edit) == ePdfPermissions_Edit;
} }
 End of changes. 47 change blocks. 
106 lines changed or deleted 368 lines changed or added


 PdfFileSpec.h   PdfFileSpec.h 
skipping to change at line 49 skipping to change at line 49
class PODOFO_DOC_API PdfFileSpec : public PdfElement { class PODOFO_DOC_API PdfFileSpec : public PdfElement {
public: public:
PdfFileSpec( const char* pszFilename, bool bEmbedd, PdfDocument* pParen t ); PdfFileSpec( const char* pszFilename, bool bEmbedd, PdfDocument* pParen t );
PdfFileSpec( const char* pszFilename, bool bEmbedd, PdfVecObjects* pPar ent ); PdfFileSpec( const char* pszFilename, bool bEmbedd, PdfVecObjects* pPar ent );
/* Petr P. Petrov 17 September 2009*/ /* Petr P. Petrov 17 September 2009*/
/** Embeds the file in memory from "data" buffer under "pszFileName" fi e name. /** Embeds the file in memory from "data" buffer under "pszFileName" fi e name.
*/ */
PdfFileSpec( const char* pszFilename, const unsigned char* data, ptrdif f_t size, PdfVecObjects* pParent); PdfFileSpec( const char* pszFilename, const unsigned char* data, ptrdif f_t size, PdfVecObjects* pParent);
PdfFileSpec( const char* pszFilename, const unsigned char* data, ptrdif f_t size, PdfDocument* pParent);
PdfFileSpec( PdfObject* pObject ); PdfFileSpec( PdfObject* pObject );
/** \returns the filename of this file specification. /** \returns the filename of this file specification.
* if no general name is available * if no general name is available
* it will try the Unix, Mac and DOS keys too. * it will try the Unix, Mac and DOS keys too.
*/ */
const PdfString & GetFilename() const; const PdfString & GetFilename() const;
private: private:
/** Initialize a filespecification from a filename
* \param pszFilename filename
* \param bEmbedd embedd the file data into the PDF file
*/
void Init( const char* pszFilename, bool bEmbedd );
/** Initialize a filespecification from an in-memory buffer
* \param pszFilename filename
* \param data Data of the file
* \param size size of the data buffer
*/
void Init( const char* pszFilename, const unsigned char* data, ptrdiff_
t size );
/** Create a file specification string from a filename /** Create a file specification string from a filename
* \param pszFilename filename * \param pszFilename filename
* \returns a file specification string * \returns a file specification string
*/ */
PdfString CreateFileSpecification( const char* pszFilename ) const; PdfString CreateFileSpecification( const char* pszFilename ) const;
/** Embedd a file into a stream object /** Embedd a file into a stream object
* \param pStream write the file to this objects stream * \param pStream write the file to this objects stream
* \param pszFilename the file to embedd * \param pszFilename the file to embedd
*/ */
 End of changes. 2 change blocks. 
0 lines changed or deleted 15 lines changed or added


 PdfFont.h   PdfFont.h 
skipping to change at line 59 skipping to change at line 59
public: public:
/** Create a new PdfFont object which will introduce itself /** Create a new PdfFont object which will introduce itself
* automatically to every page object it is used on. * automatically to every page object it is used on.
* *
* The font has a default font size of 12.0pt. * The font has a default font size of 12.0pt.
* *
* \param pMetrics pointer to a font metrics object. The font in the P DF * \param pMetrics pointer to a font metrics object. The font in the P DF
* file will match this fontmetrics object. The metrics object is * file will match this fontmetrics object. The metrics object is
* deleted along with the font. * deleted along with the font.
* \param pEncoding the encoding of this font. The font will not take * \param pEncoding the encoding of this font. The font will take owne
ownership of this object. rship of this object
* depending on pEncoding->IsAutoDelete()
* \param pParent parent of the font object * \param pParent parent of the font object
* *
*/ */
PdfFont( PdfFontMetrics* pMetrics, const PdfEncoding* const pEncoding, PdfVecObjects* pParent ); PdfFont( PdfFontMetrics* pMetrics, const PdfEncoding* const pEncoding, PdfVecObjects* pParent );
/** Create a PdfFont based on an existing PdfObject /** Create a PdfFont based on an existing PdfObject
* \param pMetrics pointer to a font metrics object. The font in the P DF * \param pMetrics pointer to a font metrics object. The font in the P DF
* file will match this fontmetrics object. The metrics object is * file will match this fontmetrics object. The metrics object is
* deleted along with the font. * deleted along with the font.
* \param pEncoding the encoding of this font. The font will not take * \param pEncoding the encoding of this font. The font will take owne
ownership of this object. rship of this object
* depending on pEncoding->IsAutoDelete()
* \param pObject an existing PdfObject * \param pObject an existing PdfObject
*/ */
PdfFont( PdfFontMetrics* pMetrics, const PdfEncoding* const pEncoding, PdfObject* pObject ); PdfFont( PdfFontMetrics* pMetrics, const PdfEncoding* const pEncoding, PdfObject* pObject );
virtual ~PdfFont(); virtual ~PdfFont();
/** Set the font size before drawing with this font. /** Set the font size before drawing with this font.
* \param fSize font size in points * \param fSize font size in points
*/ */
inline void SetFontSize( float fSize ); inline void SetFontSize( float fSize );
skipping to change at line 106 skipping to change at line 108
/** Set the character spacing of the font /** Set the character spacing of the font
* \param fCharSpace character spacing in percent * \param fCharSpace character spacing in percent
*/ */
inline void SetFontCharSpace( float fCharSpace ); inline void SetFontCharSpace( float fCharSpace );
/** Retrieve the current character spacing of this font object /** Retrieve the current character spacing of this font object
* \returns the current font character spacing * \returns the current font character spacing
*/ */
inline float GetFontCharSpace() const; inline float GetFontCharSpace() const;
/** Set the word spacing of the font
* \param fWordSpace word spacing in PDF units
*/
inline void SetWordSpace( float fWordSpace );
/** Retrieve the current word spacing of this font object
* \returns the current font word spacing in PDF units
*/
inline float GetWordSpace() const;
/** Set the underlined property of the font /** Set the underlined property of the font
* \param bUnder if true any text drawn with this font * \param bUnder if true any text drawn with this font
* by a PdfPainter will be underlined. * by a PdfPainter will be underlined.
* Default is false * Default is false
*/ */
inline void SetUnderlined( bool bUnder ); inline void SetUnderlined( bool bUnder );
/** \returns true if the font is underlined /** \returns true if the font is underlined
* \see IsBold * \see IsBold
* \see IsItalic * \see IsItalic
skipping to change at line 185 skipping to change at line 197
* or following whitespaces. * or following whitespaces.
*/ */
virtual void WriteStringToStream( const PdfString & rsString, PdfStream * pStream ); virtual void WriteStringToStream( const PdfString & rsString, PdfStream * pStream );
// Peter Petrov 24 September 2008 // Peter Petrov 24 September 2008
/** Embeds the font into PDF page /** Embeds the font into PDF page
* *
*/ */
virtual void EmbedFont(); virtual void EmbedFont();
/** Remember the glyphs used in the string in case of subsetting /** Remember the glyphs used in the string in case of subsetting
* *
* \param sText the text string which should be printed (is not allowe d to be NULL!) * \param sText the text string which should be printed (is not allowe d to be NULL!)
* \param lStringLen draw only lLen characters of pszText * \param lStringLen draw only lLen characters of pszText
* *
* Only call if IsSubsetting() returns true. Might throw an exception otherwise. * Only call if IsSubsetting() returns true. Might throw an exception otherwise.
* *
* \see IsSubsetting * \see IsSubsetting
*/ */
virtual void AddUsedSubsettingGlyphs( const PdfString & sText, long virtual void AddUsedSubsettingGlyphs( const PdfString & sText, long lSt
lStringLen ); ringLen );
/** Remember the glyphname in case of subsetting /** Remember the glyphname in case of subsetting
* *
* \param pszGlyphName Name of the glyph to remember * \param pszGlyphName Name of the glyph to remember
*/ */
virtual void AddUsedGlyphname( const char * pszGlyphName ); virtual void AddUsedGlyphname( const char * pszGlyphName );
/** Embeds pending subset-font into PDF page /** Embeds pending subset-font into PDF page
* Only call if IsSubsetting() returns true. Might throw an exception otherwise. * Only call if IsSubsetting() returns true. Might throw an exception otherwise.
* *
* \see IsSubsetting * \see IsSubsetting
*/ */
virtual void EmbedSubsetFont(); virtual void EmbedSubsetFont();
/** Check if this is a subsetting font. /** Check if this is a subsetting font.
* \returns true if this is a subsetting font * \returns true if this is a subsetting font
*/ */
inline bool IsSubsetting() const; inline bool IsSubsetting() const;
protected: protected:
/** Get the base font name of this font /** Get the base font name of this font
* *
* \returns the base font name * \returns the base font name
*/ */
inline const PdfName& GetBaseFont() const; inline const PdfName& GetBaseFont() const;
void InitBase14Font(); void InitBase14Font();
const PdfEncoding* const m_pEncoding; const PdfEncoding* const m_pEncoding;
PdfFontMetrics* m_pMetrics; PdfFontMetrics* m_pMetrics;
bool m_bBold; bool m_bBold;
bool m_bItalic; bool m_bItalic;
bool m_bUnderlined; bool m_bUnderlined;
bool m_bStrikedOut; bool m_bStrikedOut;
bool m_bWasEmbedded; bool m_bWasEmbedded;
bool m_isBase14; bool m_isBase14;
bool m_bIsSubsetting; bool m_bIsSubsetting;
PdfName m_Identifier; PdfName m_Identifier;
private: private:
/** default constructor, not implemented /** default constructor, not implemented
*/ */
PdfFont(void); PdfFont(void);
/** copy constructor, not implemented /** copy constructor, not implemented
*/ */
PdfFont(const PdfFont& rhs); PdfFont(const PdfFont& rhs);
/** assignment operator, not implemented /** assignment operator, not implemented
skipping to change at line 359 skipping to change at line 371
// //
// ----------------------------------------------------- // -----------------------------------------------------
float PdfFont::GetFontCharSpace() const float PdfFont::GetFontCharSpace() const
{ {
return m_pMetrics->GetFontCharSpace(); return m_pMetrics->GetFontCharSpace();
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline void PdfFont::SetWordSpace( float fWordSpace )
{
m_pMetrics->SetWordSpace( fWordSpace );
}
// -----------------------------------------------------
//
// -----------------------------------------------------
inline float PdfFont::GetWordSpace() const
{
return m_pMetrics->GetWordSpace();
}
// -----------------------------------------------------
//
// -----------------------------------------------------
const PdfEncoding* PdfFont::GetEncoding() const const PdfEncoding* PdfFont::GetEncoding() const
{ {
return m_pEncoding; return m_pEncoding;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
PdfFontMetrics* PdfFont::GetFontMetrics2() PdfFontMetrics* PdfFont::GetFontMetrics2()
skipping to change at line 418 skipping to change at line 446
bool PdfFont::IsStrikeOut() const bool PdfFont::IsStrikeOut() const
{ {
return m_bStrikedOut; return m_bStrikedOut;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
bool PdfFont::IsBold() const bool PdfFont::IsBold() const
{ {
return m_bBold; return m_bBold;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
bool PdfFont::IsItalic() const bool PdfFont::IsItalic() const
{ {
return m_bItalic; return m_bItalic;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
bool PdfFont::IsSubsetting() const bool PdfFont::IsSubsetting() const
{ {
return m_bIsSubsetting; return m_bIsSubsetting;
} }
 End of changes. 12 change blocks. 
18 lines changed or deleted 46 lines changed or added


 PdfFontCID.h   PdfFontCID.h 
skipping to change at line 41 skipping to change at line 41
/** A PdfFont that represents a CID font. /** A PdfFont that represents a CID font.
*/ */
class PdfFontCID : public PdfFont { class PdfFontCID : public PdfFont {
public: public:
/** Create a new CID font. /** Create a new CID font.
* *
* \param pMetrics pointer to a font metrics object. The font in the P DF * \param pMetrics pointer to a font metrics object. The font in the P DF
* file will match this fontmetrics object. The metrics object is * file will match this fontmetrics object. The metrics object is
* deleted along with the font. * deleted along with the font.
* \param pEncoding the encoding of this font. The font will not take * \param pEncoding the encoding of this font. The font will take owne
ownership of this object. rship of this object
* depending on pEncoding->IsAutoDelete()
* \param pParent parent of the font object * \param pParent parent of the font object
* \param bEmbed specifies the embedding of font * \param bEmbed specifies the embedding of font
* *
*/ */
PdfFontCID( PdfFontMetrics* pMetrics, const PdfEncoding* const pEncodin g, PdfFontCID( PdfFontMetrics* pMetrics, const PdfEncoding* const pEncodin g,
PdfVecObjects* pParent, bool bEmbed = true ); PdfVecObjects* pParent, bool bEmbed = true );
// Peter Petrov 30 April 2008 // Peter Petrov 30 April 2008
/** Create a PdfFont based on an existing PdfObject /** Create a PdfFont based on an existing PdfObject
* \param pMetrics pointer to a font metrics object. The font in the P DF * \param pMetrics pointer to a font metrics object. The font in the P DF
* file will match this fontmetrics object. The metrics object is * file will match this fontmetrics object. The metrics object is
* deleted along with the font. * deleted along with the font.
* \param pEncoding the encoding of this font. The font will not take * \param pEncoding the encoding of this font. The font will take owne
ownership of this object. rship of this object
* depending on pEncoding->IsAutoDelete()
* \param pObject an existing PdfObject * \param pObject an existing PdfObject
* \param bEmbed specifies the embedding of font * \param bEmbed specifies the embedding of font
*/ */
PdfFontCID( PdfFontMetrics* pMetrics, const PdfEncoding* const pEncodin g, PdfObject* pObject, bool bEmbed ); PdfFontCID( PdfFontMetrics* pMetrics, const PdfEncoding* const pEncodin g, PdfObject* pObject, bool bEmbed );
// Peter Petrov 24 September 2008 // Peter Petrov 24 September 2008
/** Embeds the font into PDF page /** Embeds the font into PDF page
* *
*/ */
virtual void EmbedFont(); virtual void EmbedFont();
 End of changes. 2 change blocks. 
4 lines changed or deleted 6 lines changed or added


 PdfFontCache.h   PdfFontCache.h 
skipping to change at line 28 skipping to change at line 28
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
************************************************************************** */ ************************************************************************** */
#ifndef _PDF_FONT_CACHE_H_ #ifndef _PDF_FONT_CACHE_H_
#define _PDF_FONT_CACHE_H_ #define _PDF_FONT_CACHE_H_
#include "podofo/base/PdfDefines.h" #include "podofo/base/PdfDefines.h"
#include "podofo/base/Pdf3rdPtyForwardDecl.h" #include "podofo/base/Pdf3rdPtyForwardDecl.h"
#include "podofo/base/PdfEncoding.h" #include "podofo/base/PdfEncoding.h"
#include "podofo/base/PdfEncodingFactory.h" #include "podofo/base/PdfEncodingFactory.h"
#include "podofo/base/util/PdfMutex.h"
#include "PdfFont.h" #include "PdfFont.h"
#include "PdfFontConfigWrapper.h"
namespace PoDoFo { namespace PoDoFo {
class PdfFontMetrics; class PdfFontMetrics;
class PdfVecObjects; class PdfVecObjects;
/** A private structure, /** A private structure,
* which represents a font in the cache. * which represents a font in the cache.
*/ */
struct TFontCacheElement { struct TFontCacheElement {
skipping to change at line 132 skipping to change at line 133
* This class is an internal class of PoDoFo * This class is an internal class of PoDoFo
* and should not be used in user applications * and should not be used in user applications
* *
* \see PdfDocument * \see PdfDocument
*/ */
class PODOFO_DOC_API PdfFontCache { class PODOFO_DOC_API PdfFontCache {
typedef std::vector<TFontCacheElement> TSortedFontList; typedef std::vector<TFontCacheElement> TSortedFontList;
typedef TSortedFontList::iterator TISortedFontList; typedef TSortedFontList::iterator TISortedFontList;
typedef TSortedFontList::const_iterator TCISortedFontList; typedef TSortedFontList::const_iterator TCISortedFontList;
#if defined(PODOFO_HAVE_FONTCONFIG)
static Util::PdfMutex m_FcMutex;
#endif
public: public:
/** /**
* Flags to control font creation. * Flags to control font creation.
*/ */
enum EFontCreationFlags { enum EFontCreationFlags {
eFontCreationFlags_None = 0, ///< No spec ial settings eFontCreationFlags_None = 0, ///< No spec ial settings
eFontCreationFlags_AutoSelectBase14 = 1, ///< Create automati cally a base14 font if the fontname matches one of them eFontCreationFlags_AutoSelectBase14 = 1, ///< Create automati cally a base14 font if the fontname matches one of them
eFontCreationFlags_Type1Subsetting = 2 ///< Create subsette d type1-font, which includes only used characters eFontCreationFlags_Type1Subsetting = 2 ///< Create subsette d type1-font, which includes only used characters
}; };
/** Create an empty font cache /** Create an empty font cache
* *
* \param pParent a PdfVecObjects which is required * \param pParent a PdfVecObjects which is required
* to create new font objects * to create new font objects
*/ */
PdfFontCache( PdfVecObjects* pParent ); PdfFontCache( PdfVecObjects* pParent );
/** Create an empty font cache
*
* \param rFontConfig provide a handle to fontconfig, as initializing
a
* new fontconfig intance might be time consuming.
* \param pParent a PdfVecObjects which is required
* to create new font objects
*/
PdfFontCache( const PdfFontConfigWrapper & rFontConfig, PdfVecObjects*
pParent );
/** Destroy and empty the font cache /** Destroy and empty the font cache
*/ */
~PdfFontCache(); ~PdfFontCache();
/** /**
* Empty the internal font cache. * Empty the internal font cache.
* This should be done when ever a new document * This should be done when ever a new document
* is created or openened. * is created or openened.
*/ */
void EmptyCache(); void EmptyCache();
skipping to change at line 269 skipping to change at line 275
/** Embeds all pending subset-fonts /** Embeds all pending subset-fonts
* *
*/ */
void EmbedSubsetFonts(); void EmbedSubsetFonts();
#if defined(PODOFO_HAVE_FONTCONFIG) #if defined(PODOFO_HAVE_FONTCONFIG)
/** Get the path of a font file on a Unix system using fontconfig /** Get the path of a font file on a Unix system using fontconfig
* *
* This method is only available if PoDoFo was compiled with * This method is only available if PoDoFo was compiled with
* fontconfig support. * fontconfig support. Make sure to lock any FontConfig mutexes before
* calling this method by yourself!
* *
* \param pConfig a handle to an initialized fontconfig library * \param pConfig a handle to an initialized fontconfig library
* \param pszFontName name of the requested font * \param pszFontName name of the requested font
* \param bBold if true find a bold font * \param bBold if true find a bold font
* \param bItalic if true find an italic font * \param bItalic if true find an italic font
* \returns the path to the fontfile or an empty string * \returns the path to the fontfile or an empty string
*/ */
static std::string GetFontConfigFontPath( FcConfig* pConfig, const char * pszFontName, bool bBold, bool bItalic ); static std::string GetFontConfigFontPath( FcConfig* pConfig, const char * pszFontName, bool bBold, bool bItalic );
#endif // defined(PODOFO_HAVE_FONTCONFIG) #endif // defined(PODOFO_HAVE_FONTCONFIG)
// Peter Petrov: 26 April 2008 // Peter Petrov: 26 April 2008
/** Returns the font library from font cache /** Returns the font library from font cache
* *
* \returns the internal handle to the freetype library * \returns the internal handle to the freetype library
*/ */
inline FT_Library GetFontLibrary() const; inline FT_Library GetFontLibrary() const;
/**
* Set wrapper for the fontconfig library.
* Useful to avoid initializing Fontconfig multiple times.
*
* This setter can be called until first use of Fontconfig
* as the library is initialized at first use.
*/
inline void SetFontConfigWrapper(const PdfFontConfigWrapper & rFontConf
ig);
private: private:
/** /**
* Get the path to a font file for a certain fontname * Get the path to a font file for a certain fontname
* *
* \param pszFontName a valid fontname * \param pszFontName a valid fontname
* \param bBold if true search for a bold font * \param bBold if true search for a bold font
* \param bItalic if true search for an italic font * \param bItalic if true search for an italic font
* *
* \returns the path to the fonts file if it was found. * \returns the path to the fonts file if it was found.
*/ */
skipping to change at line 360 skipping to change at line 376
PdfFont* GetWin32Font( TISortedFontList itSorted, TSortedFontList & vec Container, const wchar_t* pszFontName, PdfFont* GetWin32Font( TISortedFontList itSorted, TSortedFontList & vec Container, const wchar_t* pszFontName,
bool bBold, bool bItalic, bool bEmbed d, const PdfEncoding * const pEncoding ); bool bBold, bool bItalic, bool bEmbed d, const PdfEncoding * const pEncoding );
#endif // _WIN32 #endif // _WIN32
private: private:
TSortedFontList m_vecFonts; ///< Sorted list of all fonts, currently in the cache TSortedFontList m_vecFonts; ///< Sorted list of all fonts, currently in the cache
TSortedFontList m_vecFontSubsets; TSortedFontList m_vecFontSubsets;
FT_Library m_ftLibrary; ///< Handle to the freetype li brary FT_Library m_ftLibrary; ///< Handle to the freetype li brary
void* m_pFcConfig; ///< Handle to fontconfig on u
nix systems
PdfVecObjects* m_pParent; ///< Handle to parent for crea ting new fonts and objects PdfVecObjects* m_pParent; ///< Handle to parent for crea ting new fonts and objects
PdfFontConfigWrapper m_fontConfig; ///< Handle to the fontconfig
library
}; };
// Peter Petrov: 26 April 2008 // Peter Petrov: 26 April 2008
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
FT_Library PdfFontCache::GetFontLibrary() const FT_Library PdfFontCache::GetFontLibrary() const
{ {
return this->m_ftLibrary; return this->m_ftLibrary;
} }
// -----------------------------------------------------
//
// -----------------------------------------------------
inline void PdfFontCache::SetFontConfigWrapper(const PdfFontConfigWrapper &
rFontConfig)
{
m_fontConfig = rFontConfig;
}
}; };
#endif /* _PDF_FONT_CACHE_H_ */ #endif /* _PDF_FONT_CACHE_H_ */
 End of changes. 9 change blocks. 
9 lines changed or deleted 37 lines changed or added


 PdfFontMetrics.h   PdfFontMetrics.h 
skipping to change at line 64 skipping to change at line 64
* \param nGlyphId id of the glyph * \param nGlyphId id of the glyph
* \returns the width of a single glyph id * \returns the width of a single glyph id
*/ */
virtual double GetGlyphWidth( int nGlyphId ) const = 0; virtual double GetGlyphWidth( int nGlyphId ) const = 0;
/** Get the width of a single named glyph /** Get the width of a single named glyph
* *
* \param pszGlyphname name of the glyph * \param pszGlyphname name of the glyph
* \returns the width of a single named glyph * \returns the width of a single named glyph
*/ */
virtual double GetGlyphWidth( const char* pszGlyphname ) const = 0; virtual double GetGlyphWidth( const char* pszGlyphname ) const = 0;
/** Create the bounding box array as required by the PDF reference /** Create the bounding box array as required by the PDF reference
* so that it can be written directly to a PDF file. * so that it can be written directly to a PDF file.
* *
* \param array write the bounding box to this array. * \param array write the bounding box to this array.
*/ */
virtual void GetBoundingBox( PdfArray & array ) const = 0; virtual void GetBoundingBox( PdfArray & array ) const = 0;
/** Retrieve the width of a given text string in PDF units when /** Retrieve the width of a given text string in PDF units when
* drawn with the current font * drawn with the current font
skipping to change at line 325 skipping to change at line 325
/** Set the character spacing of this metrics object /** Set the character spacing of this metrics object
* \param fCharSpace character spacing in percent * \param fCharSpace character spacing in percent
*/ */
inline void SetFontCharSpace( float fCharSpace ); inline void SetFontCharSpace( float fCharSpace );
/** Retrieve the current character spacing of this metrics object /** Retrieve the current character spacing of this metrics object
* \returns the current font character spacing * \returns the current font character spacing
*/ */
inline float GetFontCharSpace() const; inline float GetFontCharSpace() const;
/** Set the word spacing of this metrics object
* \param fWordSpace word spacing in PDF units
*/
inline void SetWordSpace( float fWordSpace );
/** Retrieve the current word spacing of this metrics object
* \returns the current font word spacing in PDF units
*/
inline float GetWordSpace() const;
/** /**
* \returns the fonttype of the loaded font * \returns the fonttype of the loaded font
*/ */
inline EPdfFontType GetFontType() const; inline EPdfFontType GetFontType() const;
/** Get the glyph id for a unicode character /** Get the glyph id for a unicode character
* in the current font. * in the current font.
* *
* \param lUnicode the unicode character value * \param lUnicode the unicode character value
* \returns the glyhph id for the character or 0 if the glyph was not found. * \returns the glyhph id for the character or 0 if the glyph was not found.
skipping to change at line 368 skipping to change at line 378
* Set the fonttype. * Set the fonttype.
* \param eFontType fonttype * \param eFontType fonttype
*/ */
inline void SetFontType(EPdfFontType eFontType); inline void SetFontType(EPdfFontType eFontType);
protected: protected:
std::string m_sFilename; std::string m_sFilename;
float m_fFontSize; float m_fFontSize;
float m_fFontScale; float m_fFontScale;
float m_fFontCharSpace; float m_fFontCharSpace;
float m_fWordSpace;
std::vector<double> m_vecWidth; std::vector<double> m_vecWidth;
EPdfFontType m_eFontType; EPdfFontType m_eFontType;
std::string m_sFontSubsetPrefix; std::string m_sFontSubsetPrefix;
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
skipping to change at line 441 skipping to change at line 452
long PdfFontMetrics::GetUnderlinePositionMM() const long PdfFontMetrics::GetUnderlinePositionMM() const
{ {
return static_cast<long>(this->GetUnderlinePosition() / PODOFO_CONVERS ION_CONSTANT); return static_cast<long>(this->GetUnderlinePosition() / PODOFO_CONVERS ION_CONSTANT);
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
unsigned long PdfFontMetrics::GetStrikeOutPositionMM() const unsigned long PdfFontMetrics::GetStrikeOutPositionMM() const
{ {
return static_cast<long>(this->GetStrikeOutPosition() / PODOFO_CONV ERSION_CONSTANT); return static_cast<long>(this->GetStrikeOutPosition() / PODOFO_CONVERS ION_CONSTANT);
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
unsigned long PdfFontMetrics::GetUnderlineThicknessMM() const unsigned long PdfFontMetrics::GetUnderlineThicknessMM() const
{ {
return static_cast<unsigned long>(this->GetUnderlineThickness() / PODOF O_CONVERSION_CONSTANT); return static_cast<unsigned long>(this->GetUnderlineThickness() / PODOF O_CONVERSION_CONSTANT);
} }
skipping to change at line 519 skipping to change at line 530
// //
// ----------------------------------------------------- // -----------------------------------------------------
float PdfFontMetrics::GetFontCharSpace() const float PdfFontMetrics::GetFontCharSpace() const
{ {
return m_fFontCharSpace; return m_fFontCharSpace;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline float PdfFontMetrics::GetWordSpace() const
{
return m_fWordSpace;
}
// -----------------------------------------------------
//
// -----------------------------------------------------
const char* PdfFontMetrics::GetSubsetFontnamePrefix() const const char* PdfFontMetrics::GetSubsetFontnamePrefix() const
{ {
return m_sFontSubsetPrefix.c_str(); return m_sFontSubsetPrefix.c_str();
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
void PdfFontMetrics::SetFontScale( float fScale ) void PdfFontMetrics::SetFontScale( float fScale )
{ {
skipping to change at line 540 skipping to change at line 559
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
void PdfFontMetrics::SetFontCharSpace( float fCharSpace ) void PdfFontMetrics::SetFontCharSpace( float fCharSpace )
{ {
m_fFontCharSpace = fCharSpace; m_fFontCharSpace = fCharSpace;
} }
// -----------------------------------------------------
//
// -----------------------------------------------------
inline void PdfFontMetrics::SetWordSpace( float fWordSpace )
{
m_fWordSpace = fWordSpace;
}
}; };
#endif // _PDF_FONT_METRICS_H_ #endif // _PDF_FONT_METRICS_H_
 End of changes. 6 change blocks. 
2 lines changed or deleted 29 lines changed or added


 PdfFontSimple.h   PdfFontSimple.h 
skipping to change at line 43 skipping to change at line 43
public: public:
/** Create a new PdfFont object which will introduce itself /** Create a new PdfFont object which will introduce itself
* automatically to every page object it is used on. * automatically to every page object it is used on.
* *
* The font has a default font size of 12.0pt. * The font has a default font size of 12.0pt.
* *
* \param pMetrics pointer to a font metrics object. The font in the P DF * \param pMetrics pointer to a font metrics object. The font in the P DF
* file will match this fontmetrics object. The metrics object is * file will match this fontmetrics object. The metrics object is
* deleted along with the font. * deleted along with the font.
* \param pEncoding the encoding of this font. The encoding will be ow * \param pEncoding the encoding of this font. The font will take owne
ned rship of this object
* by this font and will be deleted along with it. * depending on pEncoding->IsAutoDelete()
* \param pParent parent of the font object * \param pParent parent of the font object
* *
*/ */
PdfFontSimple( PdfFontMetrics* pMetrics, const PdfEncoding* const pEnco ding, PdfFontSimple( PdfFontMetrics* pMetrics, const PdfEncoding* const pEnco ding,
PdfVecObjects* pParent ); PdfVecObjects* pParent );
/** Create a PdfFont based on an existing PdfObject /** Create a PdfFont based on an existing PdfObject
* \param pMetrics pointer to a font metrics object. The font in the P DF * \param pMetrics pointer to a font metrics object. The font in the P DF
* file will match this fontmetrics object. The metrics object is * file will match this fontmetrics object. The metrics object is
* deleted along with the font. * deleted along with the font.
* \param pEncoding the encoding of this font. The encoding will be ow * \param pEncoding the encoding of this font. The font will take owne
ned rship of this object
* by this font and will be deleted along with it. * depending on pEncoding->IsAutoDelete()
* \param pObject an existing PdfObject * \param pObject an existing PdfObject
*/ */
PdfFontSimple( PdfFontMetrics* pMetrics, const PdfEncoding* const pEnco ding, PdfFontSimple( PdfFontMetrics* pMetrics, const PdfEncoding* const pEnco ding,
PdfObject* pObject ); PdfObject* pObject );
// Peter Petrov 24 September 2008 // Peter Petrov 24 September 2008
/** Embeds the font into PDF page /** Embeds the font into PDF page
* *
*/ */
virtual void EmbedFont(); virtual void EmbedFont();
 End of changes. 2 change blocks. 
6 lines changed or deleted 6 lines changed or added


 PdfFontTrueType.h   PdfFontTrueType.h 
skipping to change at line 45 skipping to change at line 45
class PdfFontTrueType : public PdfFontSimple { class PdfFontTrueType : public PdfFontSimple {
public: public:
/** Create a new TrueType font. /** Create a new TrueType font.
* *
* It will get embedded automatically. * It will get embedded automatically.
* *
* \param pMetrics pointer to a font metrics object. The font in the P DF * \param pMetrics pointer to a font metrics object. The font in the P DF
* file will match this fontmetrics object. The metrics object is * file will match this fontmetrics object. The metrics object is
* deleted along with the font. * deleted along with the font.
* \param pEncoding the encoding of this font. The font will not take * \param pEncoding the encoding of this font. The font will take owne
ownership of this object. rship of this object
* depending on pEncoding->IsAutoDelete()
* \param pParent parent of the font object * \param pParent parent of the font object
* \param bEmbed if true the font will get embedded. * \param bEmbed if true the font will get embedded.
* *
*/ */
PdfFontTrueType( PdfFontMetrics* pMetrics, const PdfEncoding* const pEn coding, PdfFontTrueType( PdfFontMetrics* pMetrics, const PdfEncoding* const pEn coding,
PdfVecObjects* pParent, bool bEmbed ); PdfVecObjects* pParent, bool bEmbed );
/** Create a PdfFont based on an existing PdfObject /** Create a PdfFont based on an existing PdfObject
* \param pMetrics pointer to a font metrics object. The font in the P DF * \param pMetrics pointer to a font metrics object. The font in the P DF
* file will match this fontmetrics object. The metrics object is * file will match this fontmetrics object. The metrics object is
* deleted along with the font. * deleted along with the font.
* \param pEncoding the encoding of this font. The font will not take * \param pEncoding the encoding of this font. The font will take owne
ownership of this object. rship of this object
* depending on pEncoding->IsAutoDelete()
* \param pObject an existing PdfObject * \param pObject an existing PdfObject
*/ */
PdfFontTrueType( PdfFontMetrics* pMetrics, const PdfEncoding* const pEn coding, PdfFontTrueType( PdfFontMetrics* pMetrics, const PdfEncoding* const pEn coding,
PdfObject* pObject ); PdfObject* pObject );
private: private:
/** Embed the font file directly into the PDF file. /** Embed the font file directly into the PDF file.
* *
* \param pDescriptor font descriptor object * \param pDescriptor font descriptor object
 End of changes. 2 change blocks. 
4 lines changed or deleted 6 lines changed or added


 PdfFontType1.h   PdfFontType1.h 
skipping to change at line 41 skipping to change at line 41
* or to draw with type1 fonts. * or to draw with type1 fonts.
*/ */
class PdfFontType1 : public PdfFontSimple { class PdfFontType1 : public PdfFontSimple {
public: public:
/** Create a new Type1 font object. /** Create a new Type1 font object.
* *
* \param pMetrics pointer to a font metrics object. The font in the P DF * \param pMetrics pointer to a font metrics object. The font in the P DF
* file will match this fontmetrics object. The metrics object is * file will match this fontmetrics object. The metrics object is
* deleted along with the font. * deleted along with the font.
* \param pEncoding the encoding of this font. The font will not take * \param pEncoding the encoding of this font. The font will take owne
ownership of this object. rship of this object
* depending on pEncoding->IsAutoDelete()
* \param pParent parent of the font object * \param pParent parent of the font object
* \param bEmbed if true the font will get embedded. * \param bEmbed if true the font will get embedded.
* \param bSubsetting if true the font will use subsetting. * \param bSubsetting if true the font will use subsetting.
* *
*/ */
PdfFontType1( PdfFontMetrics* pMetrics, const PdfEncoding* const pEncod ing, PdfFontType1( PdfFontMetrics* pMetrics, const PdfEncoding* const pEncod ing,
PdfVecObjects* pParent, bool bEmbed, bool bSubsetting = f alse ); PdfVecObjects* pParent, bool bEmbed, bool bSubsetting = f alse );
/** Create a PdfFont based on an existing PdfObject /** Create a PdfFont based on an existing PdfObject
* \param pMetrics pointer to a font metrics object. The font in the P DF * \param pMetrics pointer to a font metrics object. The font in the P DF
* file will match this fontmetrics object. The metrics object is * file will match this fontmetrics object. The metrics object is
* deleted along with the font. * deleted along with the font.
* \param pEncoding the encoding of this font. The font will not take * \param pEncoding the encoding of this font. The font will take owne
ownership of this object. rship of this object
* depending on pEncoding->IsAutoDelete()
* \param pObject an existing PdfObject * \param pObject an existing PdfObject
*/ */
PdfFontType1( PdfFontMetrics* pMetrics, const PdfEncoding* const pEncod ing, PdfFontType1( PdfFontMetrics* pMetrics, const PdfEncoding* const pEncod ing,
PdfObject* pObject ); PdfObject* pObject );
/** Create a PdfFont based on an existing PdfFont with a new id /** Create a PdfFont based on an existing PdfFont with a new id
* \param pFont pointer to existing font * \param pFont pointer to existing font
* \param pMetrics pointer to a font metrics object. The font in the P DF * \param pMetrics pointer to a font metrics object. The font in the P DF
* file will match this fontmetrics object. The metrics object is * file will match this fontmetrics object. The metrics object is
* deleted along with the font. * deleted along with the font.
 End of changes. 2 change blocks. 
4 lines changed or deleted 6 lines changed or added


 PdfFontType1Base14.h   PdfFontType1Base14.h 
skipping to change at line 39 skipping to change at line 39
/** A PdfFont implementation that can be used /** A PdfFont implementation that can be used
* draw with base14 type1 fonts into a PDF file. * draw with base14 type1 fonts into a PDF file.
*/ */
class PdfFontType1Base14 : public PdfFontSimple { class PdfFontType1Base14 : public PdfFontSimple {
public: public:
/** Create a new Type1 font object. /** Create a new Type1 font object.
* *
* \param pMetrics pointer to a font metrics object. The font in the P DF * \param pMetrics pointer to a font metrics object. The font in the P DF
* file will match this fontmetrics object. The metrics object is * file will match this fontmetrics object. The metrics object is
* deleted along with the font. * deleted along with the font.
* \param pEncoding the encoding of this font. The font will not take * \param pEncoding the encoding of this font. The font will take owne
ownership of this object. rship of this object
* depending on pEncoding->IsAutoDelete()
* \param pParent parent of the font object * \param pParent parent of the font object
* *
*/ */
PdfFontType1Base14( PdfFontMetrics* pMetrics, const PdfEncoding* const pEncoding, PdfFontType1Base14( PdfFontMetrics* pMetrics, const PdfEncoding* const pEncoding,
PdfVecObjects* pParent ); PdfVecObjects* pParent );
// OC 13.08.2010 New: // OC 13.08.2010 New:
/** Create a new Type1 font object based on an existing PdfObject /** Create a new Type1 font object based on an existing PdfObject
* \param pMetrics pointer to a font metrics object. The font in the P DF * \param pMetrics pointer to a font metrics object. The font in the P DF
* file will match this fontmetrics object. The metrics object is * file will match this fontmetrics object. The metrics object is
* deleted along with the font. * deleted along with the font.
* \param pEncoding the encoding of this font. The font will not take * \param pEncoding the encoding of this font. The font will take owne
ownership of this object. rship of this object
* depending on pEncoding->IsAutoDelete()
* \param pObject an existing PdfObject * \param pObject an existing PdfObject
*/ */
PdfFontType1Base14( PdfFontMetrics* pMetrics, const PdfEncoding* const pEncoding, PdfFontType1Base14( PdfFontMetrics* pMetrics, const PdfEncoding* const pEncoding,
PdfObject* pObject ); PdfObject* pObject );
~PdfFontType1Base14(); ~PdfFontType1Base14();
protected: protected:
/** Embed the font file directly into the PDF file. /** Embed the font file directly into the PDF file.
* *
 End of changes. 2 change blocks. 
4 lines changed or deleted 6 lines changed or added


 PdfInfo.h   PdfInfo.h 
skipping to change at line 26 skipping to change at line 26
* License along with this program; if not, write to the * * License along with this program; if not, write to the *
* Free Software Foundation, Inc., * * Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
*************************************************************************** / *************************************************************************** /
#ifndef _PDF_INFO_H_ #ifndef _PDF_INFO_H_
#define _PDF_INFO_H_ #define _PDF_INFO_H_
#include "podofo/base/PdfDefines.h" #include "podofo/base/PdfDefines.h"
#include "podofo/base/PdfName.h" #include "podofo/base/PdfName.h"
#include "podofo/base/PdfDate.h"
#include "PdfElement.h" #include "PdfElement.h"
namespace PoDoFo { namespace PoDoFo {
class PdfString; class PdfString;
/** This class provides access to the documents /** This class provides access to the documents
* info dictionary, which provides information * info dictionary, which provides information
* about the PDF document. * about the PDF document.
*/ */
skipping to change at line 141 skipping to change at line 142
/** Set the trapping state of the document. /** Set the trapping state of the document.
* \param sTrapped trapped * \param sTrapped trapped
*/ */
void SetTrapped( const PdfName & sTrapped ); void SetTrapped( const PdfName & sTrapped );
/** Get the trapping state of the document /** Get the trapping state of the document
* \returns the title * \returns the title
*/ */
inline const PdfName & GetTrapped() const; inline const PdfName & GetTrapped() const;
/** Get creation date of document
* \return creation date
*/
inline PdfDate GetCreationDate() const;
/** Get modification date of document
* \return modification date
*/
inline PdfDate GetModDate() const;
private: private:
/** Add the initial document information to the dictionary. /** Add the initial document information to the dictionary.
* \param eInitial which information should be * \param eInitial which information should be
* writting initially to the information * writting initially to the information
*/ */
void Init( int eInitial ); void Init( int eInitial );
/** Get a value from the info dictionary as name /** Get a value from the info dictionary as name
* \para rName the key to fetch from the info dictionary * \para rName the key to fetch from the info dictionary
* \return a value from the info dictionary * \return a value from the info dictionary
skipping to change at line 218 skipping to change at line 229
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
const PdfName & PdfInfo::GetTrapped() const const PdfName & PdfInfo::GetTrapped() const
{ {
return this->GetNameFromInfoDict( PdfName("Trapped") ); return this->GetNameFromInfoDict( PdfName("Trapped") );
} }
// -----------------------------------------------------
//
// -----------------------------------------------------
PdfDate PdfInfo::GetCreationDate() const
{
return PdfDate(this->GetStringFromInfoDict(PdfName("CreationDate")));
}
// -----------------------------------------------------
//
// -----------------------------------------------------
PdfDate PdfInfo::GetModDate() const
{
return PdfDate(this->GetStringFromInfoDict(PdfName("ModDate")));
}
}; };
#endif // _PDF_INFO_H_ #endif // _PDF_INFO_H_
 End of changes. 3 change blocks. 
0 lines changed or deleted 27 lines changed or added


 PdfMemDocument.h   PdfMemDocument.h 
/************************************************************************** * /**************************************************************************
* Copyright (C) 2006 by Dominik Seichter * * Copyright (C) 2006 by Dominik Seichter *
* domseichter@web.de * * domseichter@web.de *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Library General Public License as * * it under the terms of the GNU Library General Public License as *
* published by the Free Software Foundation; either version 2 of the * * published by the Free Software Foundation; either version 2 of the *
* License, or (at your option) any later version. * * License, or (at your option) any later version. *
* * * *
* This program is distributed in the hope that it will be useful, * * This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of * * but WITHOUT ANY WARRANTY; without even the implied warranty of *
skipping to change at line 244 skipping to change at line 244
void SetPassword( const std::string & sPassword ); void SetPassword( const std::string & sPassword );
/** Encrypt the document during writing. /** Encrypt the document during writing.
* *
* \param userPassword the user password (if empty the user does not h ave * \param userPassword the user password (if empty the user does not h ave
* to enter a password to open the document) * to enter a password to open the document)
* \param ownerPassword the owner password * \param ownerPassword the owner password
* \param protection several EPdfPermissions values or'ed together to set * \param protection several EPdfPermissions values or'ed together to set
* the users permissions for this document * the users permissions for this document
* \param eAlgorithm the revision of the encryption algorithm to be us ed * \param eAlgorithm the revision of the encryption algorithm to be us ed
* \param eKeyLength the length of the encryption key ranging from 40 * \param eKeyLength the length of the encryption key ranging from 40
to 128 bits to 256 bits
* (only used if eAlgorithm == ePdfEncryptAlgorithm_ * (only used if eAlgorithm >= ePdfEncryptAlgorithm_
RC4V2) RC4V2)
* *
* \see PdfEncrypt * \see PdfEncrypt
*/ */
void SetEncrypted( const std::string & userPassword, void SetEncrypted( const std::string & userPassword,
const std::string & ownerPassword, const std::string & ownerPassword,
int protection = PdfEncrypt::ePdfPermissions_Print | int protection = PdfEncrypt::ePdfPermissions_Print |
PdfEncrypt::ePdfPermissions_Edit | PdfEncrypt::ePdfPermissions_Edit |
PdfEncrypt::ePdfPermissions_Copy | PdfEncrypt::ePdfPermissions_Copy |
PdfEncrypt::ePdfPermissions_EditNot es | PdfEncrypt::ePdfPermissions_EditNot es |
PdfEncrypt::ePdfPermissions_FillAnd Sign | PdfEncrypt::ePdfPermissions_FillAnd Sign |
skipping to change at line 326 skipping to change at line 326
/** Get access to the Metadata stream /** Get access to the Metadata stream
* \returns PdfObject the Metadata stream (should be in XML, using XMP grammar) * \returns PdfObject the Metadata stream (should be in XML, using XMP grammar)
*/ */
PdfObject* GetMetadata() const { return GetNamedObjectFromCatalog( "Met adata" ); } PdfObject* GetMetadata() const { return GetNamedObjectFromCatalog( "Met adata" ); }
/** Get access to the MarkInfo dictionary (ISO 32000-1:2008 14.7.1) /** Get access to the MarkInfo dictionary (ISO 32000-1:2008 14.7.1)
* \returns PdfObject the MarkInfo dictionary * \returns PdfObject the MarkInfo dictionary
*/ */
PdfObject* GetMarkInfo() const { return GetNamedObjectFromCatalog( "Mar kInfo" ); } PdfObject* GetMarkInfo() const { return GetNamedObjectFromCatalog( "Mar kInfo" ); }
/** Get access to the RFC 3066 natural language id for the document (IS
O 32000-1:2008 14.9.2.1)
* \returns PdfObject the language ID string
*/
PdfObject* GetLanguage() const { return GetNamedObjectFromCatalog( "Lan
g" ); }
/** Creates a PdfFont object from an existing font. /** Creates a PdfFont object from an existing font.
* *
* \param pObject a PdfObject that is a font * \param pObject a PdfObject that is a font
* \returns PdfFont* a pointer to a new PdfFont object. * \returns PdfFont* a pointer to a new PdfFont object.
* The returned object is owned by the PdfDocument. * The returned object is owned by the PdfDocument.
*/ */
PdfFont* GetFont( PdfObject* pObject ); PdfFont* GetFont( PdfObject* pObject );
/** Copies one or more pages from another PdfMemDocument to this docume nt /** Copies one or more pages from another PdfMemDocument to this docume nt
 End of changes. 3 change blocks. 
5 lines changed or deleted 12 lines changed or added


 PdfOutputDevice.h   PdfOutputDevice.h 
skipping to change at line 195 skipping to change at line 195
size_t m_ulLength; size_t m_ulLength;
private: private:
FILE* m_hFile; FILE* m_hFile;
char* m_pBuffer; char* m_pBuffer;
size_t m_lBufferLen; size_t m_lBufferLen;
std::ostream* m_pStream; std::ostream* m_pStream;
std::istream* m_pReadStream; std::istream* m_pReadStream;
bool m_pStreamOwned; bool m_pStreamOwned;
#if USE_CXX_LOCALE
std::locale m_pStreamSavedLocale; std::locale m_pStreamSavedLocale;
#endif
PdfRefCountedBuffer* m_pRefCountedBuffer; PdfRefCountedBuffer* m_pRefCountedBuffer;
size_t m_ulPosition; size_t m_ulPosition;
PdfRefCountedBuffer m_printBuffer; PdfRefCountedBuffer m_printBuffer;
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
size_t PdfOutputDevice::GetLength() const size_t PdfOutputDevice::GetLength() const
 End of changes. 2 change blocks. 
0 lines changed or deleted 4 lines changed or added


 PdfPage.h   PdfPage.h 
skipping to change at line 170 skipping to change at line 170
/** Get the current ArtBox in PDF units. /** Get the current ArtBox in PDF units.
* \returns PdfRect the page box * \returns PdfRect the page box
*/ */
virtual const PdfRect GetArtBox() const { return GetPageBox( "ArtBox" ) ; } virtual const PdfRect GetArtBox() const { return GetPageBox( "ArtBox" ) ; }
/** Get the current page rotation (if any). /** Get the current page rotation (if any).
* \returns int 0, 90, 180 or 270 * \returns int 0, 90, 180 or 270
*/ */
virtual int GetRotation() const; virtual int GetRotation() const;
/** Set the current page rotation.
* \param iRotation Rotation to set to the page. Valid value are 0, 90
, 180, 270.
*/
virtual void SetRotation(int nRotation);
/** Get the number of annotations associated with this page /** Get the number of annotations associated with this page
* \ returns int number of annotations * \ returns int number of annotations
*/ */
virtual int GetNumAnnots() const; virtual int GetNumAnnots() const;
/** Create a new annotation to this page. /** Create a new annotation to this page.
* \param eType the type of the annotation * \param eType the type of the annotation
* \param rRect rectangle of the annotation on the page * \param rRect rectangle of the annotation on the page
* *
* \returns the annotation object which is owned by the PdfPage * \returns the annotation object which is owned by the PdfPage
 End of changes. 1 change blocks. 
0 lines changed or deleted 6 lines changed or added


 PdfPagesTree.h   PdfPagesTree.h 
skipping to change at line 93 skipping to change at line 93
* deleted along with it. * deleted along with it.
* *
* \param ref the reference of the pages object * \param ref the reference of the pages object
* \returns a pointer to the requested page * \returns a pointer to the requested page
*/ */
PdfPage* GetPage( const PdfReference & ref ); PdfPage* GetPage( const PdfReference & ref );
/** Inserts an existing page object into the internal page tree. /** Inserts an existing page object into the internal page tree.
* after the specified page number * after the specified page number
* *
* \param nAfterPageNumber an integer specifying after what page * \param nAfterPageIndex an integer specifying after what page
* - may be one of the special values from EPdfPageInsertionPoi nt. * - may be one of the special values from EPdfPageInsertionPoi nt.
* Pages are 0 based. * Pages are 0 based.
* *
* \param pPage musst be a PdfObject with type /Page * \param pPage musst be a PdfObject with type /Page
*/ */
void InsertPage( int nAfterPageNumber, PdfObject* pPage ); void InsertPage( int nAfterPageIndex, PdfObject* pPage );
/** Inserts an existing page object into the internal page tree. /** Inserts an existing page object into the internal page tree.
* after the specified page number * after the specified page number
* *
* \param nAfterPageNumber an integer specifying after what page * \param nAfterPageIndex an integer specifying after what page
* - may be one of the special values from EPdfPageInsertionPo int. * - may be one of the special values from EPdfPageInsertionPo int.
* Pages are 0 based. * Pages are 0 based.
* \param pPage a PdfPage to be inserted, the PdfPage will not get own ed by the PdfPagesTree * \param pPage a PdfPage to be inserted, the PdfPage will not get own ed by the PdfPagesTree
*/ */
void InsertPage( int nAfterPageNumber, PdfPage* pPage ); void InsertPage( int nAfterPageIndex, PdfPage* pPage );
/** Inserts a vector of page objects at once into the internal page tre
e
* after the specified page index (zero based index)
*
* \param nAfterPageIndex a zero based integer index specifying after
what page to insert
* - you need to pass ePdfPageInsertionPoint_InsertBeforeFirstP
age if you want to insert before the first page.
*
* \param vecPages must be a vector of PdfObjects with type /Page
*/
void InsertPages( int nAfterPageIndex, const std::vector<PdfObject*>& v
ecPages );
/** Creates a new page object and inserts it into the internal /** Creates a new page object and inserts it into the internal
* page tree. * page tree.
* The returned page is owned by the pages tree and will get deleted a long * The returned page is owned by the pages tree and will get deleted a long
* with it! * with it!
* *
* \param rSize a PdfRect specifying the size of the page (i.e the /Me diaBox key) in PDF units * \param rSize a PdfRect specifying the size of the page (i.e the /Me diaBox key) in PDF units
* \returns a pointer to a PdfPage object * \returns a pointer to a PdfPage object
*/ */
PdfPage* CreatePage( const PdfRect & rSize ); PdfPage* CreatePage( const PdfRect & rSize );
/** Creates several new page objects and inserts them into the internal
* page tree.
* The new pages are owned by the pages tree and will get deleted alon
g
* with it!
* Note: this function will attach all new pages onto the same page
node
* which can cause the tree to be unbalanced if
*
* \param vecSizes a vector of PdfRect specifying the size of each of
the pages to create (i.e the /MediaBox key) in PDF units
*/
void CreatePages( const std::vector<PdfRect>& vecSizes );
/** Delete the specified page object from the internal pages tree. /** Delete the specified page object from the internal pages tree.
* It does NOT remove any PdfObjects from memory - just the reference from the tree * It does NOT remove any PdfObjects from memory - just the reference from the tree
* *
* \param inPageNumber the page number (0-based) to be removed * \param inPageNumber the page number (0-based) to be removed
* *
* The PdfPage object refering to this page will be deleted by this c all! * The PdfPage object refering to this page will be deleted by this c all!
* Empty page nodes will also be deleted. * Empty page nodes will also be deleted.
* *
* \see PdfMemDocument::DeletePages * \see PdfMemDocument::DeletePages
*/ */
skipping to change at line 188 skipping to change at line 209
* *
* @param pNode the pages node whete pPage is to be inserted * @param pNode the pages node whete pPage is to be inserted
* @param rlstParents list of all (future) parent pages nodes in the pa ges tree * @param rlstParents list of all (future) parent pages nodes in the pa ges tree
* of pPage * of pPage
* @param nIndex index where pPage is to be inserted in pNode's kids ar ray * @param nIndex index where pPage is to be inserted in pNode's kids ar ray
* @param pPage the page object which is to be inserted * @param pPage the page object which is to be inserted
*/ */
void InsertPageIntoNode( PdfObject* pNode, const PdfObjectList & rlstPa rents, void InsertPageIntoNode( PdfObject* pNode, const PdfObjectList & rlstPa rents,
int nIndex, PdfObject* pPage ); int nIndex, PdfObject* pPage );
/**
* Insert a vector of page objects into a pages node
* Same as InsertPageIntoNode except that it allows for adding multiple
pages at one time
* Note that adding many pages onto the same node will create an unb
alanced page tree
*
* @param pNode the pages node whete pPage is to be inserted
* @param rlstParents list of all (future) parent pages nodes in the pa
ges tree
* of pPage
* @param nIndex index where pPage is to be inserted in pNode's kids ar
ray
* @param vecPages a vector of the page objects which are to be inserte
d
*/
void InsertPagesIntoNode( PdfObject* pParent, const PdfObjectList & rls
tParents,
int nIndex, const std::vector<PdfObject*>& ve
cPages );
/** /**
* Delete a page object from a pages node * Delete a page object from a pages node
* *
* @param pNode which is the direct parent of pPage and where the page must be deleted * @param pNode which is the direct parent of pPage and where the page must be deleted
* @param rlstParents list of all parent pages nodes in the pages tree * @param rlstParents list of all parent pages nodes in the pages tree
* of pPage * of pPage
* @param nIndex index where pPage is to be deleted in pNode's kids arr ay * @param nIndex index where pPage is to be deleted in pNode's kids arr ay
* @param pPage the page object which is to be deleted * @param pPage the page object which is to be deleted
*/ */
void DeletePageFromNode( PdfObject* pNode, const PdfObjectList & rlstPa rents, void DeletePageFromNode( PdfObject* pNode, const PdfObjectList & rlstPa rents,
 End of changes. 6 change blocks. 
4 lines changed or deleted 53 lines changed or added


 PdfPagesTreeCache.h   PdfPagesTreeCache.h 
skipping to change at line 67 skipping to change at line 67
virtual PdfPage* GetPage( int nIndex ); virtual PdfPage* GetPage( int nIndex );
/** /**
* Add a PdfPage object to the cache * Add a PdfPage object to the cache
* @param nIndex index of the page * @param nIndex index of the page
* @param pPage page object * @param pPage page object
*/ */
virtual void AddPageObject( int nIndex, PdfPage* pPage ); virtual void AddPageObject( int nIndex, PdfPage* pPage );
/** /**
* Add several PdfPage objects to the cache, replacing any existing at
the given index
* @param nIndex zero based index of where the first page will be place
d
* @param vecPages vector of the page objects to add
*/
virtual void AddPageObjects( int nIndex, std::vector<PdfPage*> vecPages
);
/**
* A page was inserted into the pagestree, * A page was inserted into the pagestree,
* therefore the cache has to be updated * therefore the cache has to be updated
* *
* @param nIndex index where the page was inserted * @param nAfterPageIndex zero based index of the page we are inserting
after
* - may be one of the special values from EPdfPageInsertio
nPoint.
*/
virtual void InsertPage( int nAfterPageIndex );
/**
* Insert several pages into the pagestree, after the given index
* therefore the cache has to be updated
*
* @param nAfterPageIndex zero based index of the page we are inserting
after
* - may be one of the special values from EPdfPageInsertio
nPoint.
* @param nCount number of pages that were inserted
*/ */
virtual void InsertPage( int nIndex ); virtual void InsertPages( int nAfterPageIndex, int nCount );
/** /**
* Delete a PdfPage from the cache * Delete a PdfPage from the cache
* @param nIndex index of the page * @param nIndex index of the page
*/ */
virtual void DeletePage( int nIndex ); virtual void DeletePage( int nIndex );
/** /**
* Clear cache, i.e. remove all elements from the * Clear cache, i.e. remove all elements from the
* cache. * cache.
 End of changes. 3 change blocks. 
2 lines changed or deleted 27 lines changed or added


 PdfPainter.h   PdfPainter.h 
skipping to change at line 363 skipping to change at line 363
* The current font is used and SetFont has to be called at least once * The current font is used and SetFont has to be called at least once
* before using this function * before using this function
* *
* \param dX the x coordinate of the text area (left) * \param dX the x coordinate of the text area (left)
* \param dY the y coordinate of the text area (bottom) * \param dY the y coordinate of the text area (bottom)
* \param dWidth width of the text area * \param dWidth width of the text area
* \param dHeight height of the text area * \param dHeight height of the text area
* \param rsText the text which should be drawn * \param rsText the text which should be drawn
* \param eAlignment alignment of the individual text lines in the giv en bounding box * \param eAlignment alignment of the individual text lines in the giv en bounding box
* \param eVertical vertical alignment of the text in the given boundi ng box * \param eVertical vertical alignment of the text in the given boundi ng box
* \param bClip set the clipping rectangle to the given rRect, otherwi se no clipping is performed
*/ */
void DrawMultiLineText( double dX, double dY, double dWidth, double dHe ight, void DrawMultiLineText( double dX, double dY, double dWidth, double dHe ight,
const PdfString & rsText, EPdfAlignment eAlignm ent = ePdfAlignment_Left, const PdfString & rsText, EPdfAlignment eAlignm ent = ePdfAlignment_Left,
EPdfVerticalAlignment eVertical = ePdfVerticalA lignment_Top); EPdfVerticalAlignment eVertical = ePdfVerticalA lignment_Top, bool bClip = true );
/** Draw multiline text into a rectangle doing automatic wordwrapping. /** Draw multiline text into a rectangle doing automatic wordwrapping.
* The current font is used and SetFont has to be called at least once * The current font is used and SetFont has to be called at least once
* before using this function * before using this function
* *
* \param rRect bounding rectangle of the text * \param rRect bounding rectangle of the text
* \param rsText the text which should be drawn * \param rsText the text which should be drawn
* \param eAlignment alignment of the individual text lines in the giv en bounding box * \param eAlignment alignment of the individual text lines in the giv en bounding box
* \param eVertical vertical alignment of the text in the given boundi ng box * \param eVertical vertical alignment of the text in the given boundi ng box
* \param bClip set the clipping rectangle to the given rRect, otherwi se no clipping is performed
*/ */
inline void DrawMultiLineText( const PdfRect & rRect, const PdfString & rsText, EPdfAlignment eAlignment = ePdfAlignment_Left, inline void DrawMultiLineText( const PdfRect & rRect, const PdfString & rsText, EPdfAlignment eAlignment = ePdfAlignment_Left,
EPdfVerticalAlignment eVertical = ePdfVe rticalAlignment_Top); EPdfVerticalAlignment eVertical = ePdfVe rticalAlignment_Top, bool bClip = true );
/** Gets the text divided into individual lines, using the current font and clipping rectangle. /** Gets the text divided into individual lines, using the current font and clipping rectangle.
* *
* \param dWidth width of the text area * \param dWidth width of the text area
* \param rsText the text which should be drawn * \param rsText the text which should be drawn
*/ */
std::vector<TLineElement> GetMultiLineTextAsLines( double dWidth, const PdfString & rsText); std::vector<PdfString> GetMultiLineTextAsLines( double dWidth, const Pd fString & rsText);
/** Draw a single line of text horizontally aligned. /** Draw a single line of text horizontally aligned.
* \param dX the x coordinate of the text line * \param dX the x coordinate of the text line
* \param dY the y coordinate of the text line * \param dY the y coordinate of the text line
* \param dWidth the width of the text line * \param dWidth the width of the text line
* \param rsText the text to draw * \param rsText the text to draw
* \param eAlignment alignment of the text line * \param eAlignment alignment of the text line
*/ */
void DrawTextAligned( double dX, double dY, double dWidth, const PdfStr ing & rsText, EPdfAlignment eAlignment ); void DrawTextAligned( double dX, double dY, double dWidth, const PdfStr ing & rsText, EPdfAlignment eAlignment );
skipping to change at line 880 skipping to change at line 882
{ {
this->FillRect( rRect.GetLeft(), rRect.GetBottom(), this->FillRect( rRect.GetLeft(), rRect.GetBottom(),
rRect.GetWidth(), rRect.GetHeight(), rRect.GetWidth(), rRect.GetHeight(),
dRoundX, dRoundY ); dRoundX, dRoundY );
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
void PdfPainter::DrawMultiLineText( const PdfRect & rRect, const PdfString & rsText, void PdfPainter::DrawMultiLineText( const PdfRect & rRect, const PdfString & rsText,
EPdfAlignment eAlignment, EPdfVerticalA lignment eVertical) EPdfAlignment eAlignment, EPdfVerticalA lignment eVertical, bool bClip)
{ {
this->DrawMultiLineText( rRect.GetLeft(), rRect.GetBottom(), rRect.GetW idth(), rRect.GetHeight(), this->DrawMultiLineText( rRect.GetLeft(), rRect.GetBottom(), rRect.GetW idth(), rRect.GetHeight(),
rsText, eAlignment, eVertical ); rsText, eAlignment, eVertical, bClip );
} }
}; };
#endif // _PDF_PAINTER_H_ #endif // _PDF_PAINTER_H_
 End of changes. 7 change blocks. 
5 lines changed or deleted 7 lines changed or added


 PdfParser.h   PdfParser.h 
skipping to change at line 369 skipping to change at line 369
* objects, i.e. XRef entries that do not point * objects, i.e. XRef entries that do not point
* to valid objects. * to valid objects.
* *
* Default is to not ignore broken objects and * Default is to not ignore broken objects and
* throw an exception if one is found. * throw an exception if one is found.
* *
* \param bBroken if true broken objects will be ignored * \param bBroken if true broken objects will be ignored
*/ */
inline void SetIgnoreBrokenObjects( bool bBroken ); inline void SetIgnoreBrokenObjects( bool bBroken );
/**
* \return maximum object count to read (default is LONG_MAX
* which means no limit)
*/
inline static long GetMaxObjectCount();
/**
* Specify the maximum number of objects the parser should
* read. An exception is thrown if document contains more
* objects than this. Use to avoid problems with very large
* documents with millions of objects, which use 500MB of
* working set and spend 15 mins in Load() before throwing
* an out of memory exception.
*
* \param nMaxObjects set max number of objects
*/
inline static void SetMaxObjectCount( long nMaxObjects );
protected: protected:
/** Searches backwards from the end of the file /** Searches backwards from the end of the file
* and tries to find a token. * and tries to find a token.
* The current file is positioned right after the token. * The current file is positioned right after the token.
* *
* \param pszToken a token to find * \param pszToken a token to find
* \param lRange range in bytes in which to search * \param lRange range in bytes in which to search
* begining at the end of the file * begining at the end of the file
*/ */
void FindToken( const char* pszToken, const long lRange ); void FindToken( const char* pszToken, const long lRange );
skipping to change at line 556 skipping to change at line 574
PdfEncrypt* m_pEncrypt; PdfEncrypt* m_pEncrypt;
bool m_xrefSizeUnknown; bool m_xrefSizeUnknown;
std::set<int> m_setObjectStreams; std::set<int> m_setObjectStreams;
bool m_bStrictParsing; bool m_bStrictParsing;
bool m_bIgnoreBrokenObjects; bool m_bIgnoreBrokenObjects;
int m_nIncrementalUpdates; int m_nIncrementalUpdates;
int m_nReadNextTrailerLevel;
static long s_nMaxObjects;
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
bool PdfParser::GetLoadOnDemand() const bool PdfParser::GetLoadOnDemand() const
{ {
return m_bLoadOnDemand; return m_bLoadOnDemand;
} }
skipping to change at line 640 skipping to change at line 661
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
void PdfParser::SetIgnoreBrokenObjects( bool bBroken ) void PdfParser::SetIgnoreBrokenObjects( bool bBroken )
{ {
m_bIgnoreBrokenObjects = bBroken; m_bIgnoreBrokenObjects = bBroken;
} }
// -----------------------------------------------------
//
// -----------------------------------------------------
long PdfParser::GetMaxObjectCount()
{
return PdfParser::s_nMaxObjects;
}
// -----------------------------------------------------
//
// -----------------------------------------------------
void PdfParser::SetMaxObjectCount( long nMaxObjects )
{
PdfParser::s_nMaxObjects = nMaxObjects;
}
}; };
#endif // _PDF_PARSER_H_ #endif // _PDF_PARSER_H_
 End of changes. 3 change blocks. 
0 lines changed or deleted 37 lines changed or added


 PdfVariant.h   PdfVariant.h 
skipping to change at line 674 skipping to change at line 674
if ( IsReal() ) if ( IsReal() )
return m_Data.dNumber; return m_Data.dNumber;
else else
return static_cast<double>(m_Data.nNumber); return static_cast<double>(m_Data.nNumber);
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wold-style-cast"
#endif // __GNUC__
const PdfData & PdfVariant::GetRawData() const const PdfData & PdfVariant::GetRawData() const
{ {
DelayedLoad(); DelayedLoad();
if( !IsRawData() ) if( !IsRawData() )
{ {
PODOFO_RAISE_ERROR( ePdfError_InvalidDataType ); PODOFO_RAISE_ERROR( ePdfError_InvalidDataType );
} }
return *(reinterpret_cast<PdfData* const>(m_Data.pData)); // Do not change this to an reinterpret_cast
} // We need a c-style casts here to avoid crashes
// because a reinterpret_cast might point to a different position.
return *((PdfData*)m_Data.pData);
}
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif // __GNUC__
PdfData & PdfVariant::GetRawData() PdfData & PdfVariant::GetRawData()
{ {
DelayedLoad(); DelayedLoad();
if( !IsRawData() ) if( !IsRawData() )
{ {
PODOFO_RAISE_ERROR( ePdfError_InvalidDataType ); PODOFO_RAISE_ERROR( ePdfError_InvalidDataType );
} }
return *(reinterpret_cast<PdfData* const>(m_Data.pData)); // Do not change this to an reinterpret_cast
// We need a c-style casts here to avoid crashes
// because a reinterpret_cast might point to a different position.
return *((PdfData*)m_Data.pData);
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
const PdfString & PdfVariant::GetString() const const PdfString & PdfVariant::GetString() const
{ {
DelayedLoad(); DelayedLoad();
if( !IsString() && !IsHexString() ) if( !IsString() && !IsHexString() )
{ {
PODOFO_RAISE_ERROR( ePdfError_InvalidDataType ); PODOFO_RAISE_ERROR( ePdfError_InvalidDataType );
} }
// Do not change this to an reinterpret_cast
return *(reinterpret_cast<PdfString* const>(m_Data.pData)); // We need a c-style casts here to avoid crashes
// because a reinterpret_cast might point to a different position.
return *((PdfString*)m_Data.pData);
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
const PdfName & PdfVariant::GetName() const const PdfName & PdfVariant::GetName() const
{ {
DelayedLoad(); DelayedLoad();
if( !IsName() ) if( !IsName() )
{ {
PODOFO_RAISE_ERROR( ePdfError_InvalidDataType ); PODOFO_RAISE_ERROR( ePdfError_InvalidDataType );
} }
return *(reinterpret_cast<PdfName*>(m_Data.pData)); // Do not change this to an reinterpret_cast
// We need a c-style casts here to avoid crashes
// because a reinterpret_cast might point to a different position.
return *((PdfName*)m_Data.pData);
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
const PdfArray & PdfVariant::GetArray() const const PdfArray & PdfVariant::GetArray() const
{ {
DelayedLoad(); DelayedLoad();
return GetArray_NoDL(); return GetArray_NoDL();
} }
skipping to change at line 748 skipping to change at line 766
const PdfArray & PdfVariant::GetArray_NoDL() const const PdfArray & PdfVariant::GetArray_NoDL() const
{ {
// Test against eDataType directly not GetDataType() since // Test against eDataType directly not GetDataType() since
// we don't want to trigger a delayed load (and if required one has // we don't want to trigger a delayed load (and if required one has
// already been triggered). // already been triggered).
if( m_eDataType != ePdfDataType_Array ) if( m_eDataType != ePdfDataType_Array )
{ {
PODOFO_RAISE_ERROR( ePdfError_InvalidDataType ); PODOFO_RAISE_ERROR( ePdfError_InvalidDataType );
} }
return *(reinterpret_cast<PdfArray* const>(m_Data.pData)); // Do not change this to an reinterpret_cast
// We need a c-style casts here to avoid crashes
// because a reinterpret_cast might point to a different position.
return *((PdfArray*)m_Data.pData);
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
PdfArray & PdfVariant::GetArray() PdfArray & PdfVariant::GetArray()
{ {
DelayedLoad(); DelayedLoad();
return GetArray_NoDL(); return GetArray_NoDL();
} }
skipping to change at line 772 skipping to change at line 793
// ----------------------------------------------------- // -----------------------------------------------------
PdfArray & PdfVariant::GetArray_NoDL() PdfArray & PdfVariant::GetArray_NoDL()
{ {
// Test against eDataType directly not GetDataType() since // Test against eDataType directly not GetDataType() since
// we don't want to trigger a delayed load (and if required one has // we don't want to trigger a delayed load (and if required one has
// already been triggered). // already been triggered).
if( m_eDataType != ePdfDataType_Array ) if( m_eDataType != ePdfDataType_Array )
{ {
PODOFO_RAISE_ERROR( ePdfError_InvalidDataType ); PODOFO_RAISE_ERROR( ePdfError_InvalidDataType );
} }
return *(reinterpret_cast<PdfArray* const>(m_Data.pData));
// Do not change this to an reinterpret_cast
// We need a c-style casts here to avoid crashes
// because a reinterpret_cast might point to a different position.
return *((PdfArray*)m_Data.pData);
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
const PdfDictionary & PdfVariant::GetDictionary() const const PdfDictionary & PdfVariant::GetDictionary() const
{ {
DelayedLoad(); DelayedLoad();
return GetDictionary_NoDL(); return GetDictionary_NoDL();
} }
skipping to change at line 797 skipping to change at line 822
const PdfDictionary & PdfVariant::GetDictionary_NoDL() const const PdfDictionary & PdfVariant::GetDictionary_NoDL() const
{ {
// Test against eDataType directly not GetDataType() since // Test against eDataType directly not GetDataType() since
// we don't want to trigger a delayed load (and if required one has // we don't want to trigger a delayed load (and if required one has
// already been triggered). // already been triggered).
if( m_eDataType != ePdfDataType_Dictionary ) if( m_eDataType != ePdfDataType_Dictionary )
{ {
PODOFO_RAISE_ERROR( ePdfError_InvalidDataType ); PODOFO_RAISE_ERROR( ePdfError_InvalidDataType );
} }
return *(reinterpret_cast<PdfDictionary* const>(m_Data.pData)); // Do not change this to an reinterpret_cast
// We need a c-style casts here to avoid crashes
// because a reinterpret_cast might point to a different position.
return *((PdfDictionary*)m_Data.pData);
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
PdfDictionary & PdfVariant::GetDictionary() PdfDictionary & PdfVariant::GetDictionary()
{ {
DelayedLoad(); DelayedLoad();
return GetDictionary_NoDL(); return GetDictionary_NoDL();
} }
skipping to change at line 822 skipping to change at line 850
PdfDictionary & PdfVariant::GetDictionary_NoDL() PdfDictionary & PdfVariant::GetDictionary_NoDL()
{ {
// Test against eDataType directly not GetDataType() since // Test against eDataType directly not GetDataType() since
// we don't want to trigger a delayed load (and if required one has // we don't want to trigger a delayed load (and if required one has
// already been triggered). // already been triggered).
if( m_eDataType != ePdfDataType_Dictionary ) if( m_eDataType != ePdfDataType_Dictionary )
{ {
PODOFO_RAISE_ERROR( ePdfError_InvalidDataType ); PODOFO_RAISE_ERROR( ePdfError_InvalidDataType );
} }
return *(reinterpret_cast<PdfDictionary* const>(m_Data.pData)); // Do not change this to an reinterpret_cast
// We need a c-style casts here to avoid crashes
// because a reinterpret_cast might point to a different position.
return *((PdfDictionary*)m_Data.pData);
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
const PdfReference & PdfVariant::GetReference() const const PdfReference & PdfVariant::GetReference() const
{ {
DelayedLoad(); DelayedLoad();
if( !IsReference() ) if( !IsReference() )
{ {
PODOFO_RAISE_ERROR( ePdfError_InvalidDataType ); PODOFO_RAISE_ERROR( ePdfError_InvalidDataType );
} }
return *(reinterpret_cast<PdfReference* const>(m_Data.pData)); // Do not change this to an reinterpret_cast
// We need a c-style casts here to avoid crashes
// because a reinterpret_cast might point to a different position.
return *((PdfReference*)m_Data.pData);
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
bool PdfVariant::DelayedLoadDone() const bool PdfVariant::DelayedLoadDone() const
{ {
return m_bDelayedLoadDone; return m_bDelayedLoadDone;
} }
 End of changes. 10 change blocks. 
11 lines changed or deleted 45 lines changed or added


 PdfVecObjects.h   PdfVecObjects.h 
skipping to change at line 266 skipping to change at line 266
* *
* \param pTrailer the trailer object * \param pTrailer the trailer object
* \param pNotDelete a list of object which must not be deleted * \param pNotDelete a list of object which must not be deleted
* \param bDoGarbageCollection enable garbage collection, which delete s * \param bDoGarbageCollection enable garbage collection, which delete s
* all objects that are not reachable from the trailer. This mi ght be slow! * all objects that are not reachable from the trailer. This mi ght be slow!
* *
* \see CollectGarbage * \see CollectGarbage
*/ */
void RenumberObjects( PdfObject* pTrailer, TPdfReferenceSet* pNotDelete = NULL, bool bDoGarbageCollection = false ); void RenumberObjects( PdfObject* pTrailer, TPdfReferenceSet* pNotDelete = NULL, bool bDoGarbageCollection = false );
/** Insert a object into this vector. /**
* Overwritten from std::vector so that * \see insert_sorted
* m_bObjectCount can be increased for each object.
* *
* \param pObj pointer to the object you want to insert * Simple forward to insert sorted, as PdfVecObjects is always sorted.
*/ */
void push_back( PdfObject* pObj ); void push_back( PdfObject* pObj );
/** Insert an object into this vector so that /** Insert an object into this vector so that
* the vector remains sorted w.r.t. * the vector remains sorted w.r.t.
* the ordering based on object and generation numbers * the ordering based on object and generation numbers
* m_bObjectCount will be increased for the object. * m_bObjectCount will be increased for the object.
* *
* Note: Assumes the vector is sorted, otherwise
* equivalent to push_back
*
* \param pObj pointer to the object you want to insert * \param pObj pointer to the object you want to insert
*/ */
void insert_sorted( PdfObject *pObj ); void insert_sorted( PdfObject *pObj );
/** /**
* Sort the objects in the vector based on their object and generation numbers * Sort the objects in the vector based on their object and generation numbers
*/ */
void Sort(); void Sort();
/** /**
 End of changes. 3 change blocks. 
7 lines changed or deleted 3 lines changed or added


 podofo-base.h   podofo-base.h 
skipping to change at line 60 skipping to change at line 60
#include "base/PdfObject.h" #include "base/PdfObject.h"
#include "base/PdfObjectStreamParserObject.h" #include "base/PdfObjectStreamParserObject.h"
#include "base/PdfOutputDevice.h" #include "base/PdfOutputDevice.h"
#include "base/PdfOutputStream.h" #include "base/PdfOutputStream.h"
#include "base/PdfParser.h" #include "base/PdfParser.h"
#include "base/PdfParserObject.h" #include "base/PdfParserObject.h"
#include "base/PdfRect.h" #include "base/PdfRect.h"
#include "base/PdfRefCountedBuffer.h" #include "base/PdfRefCountedBuffer.h"
#include "base/PdfRefCountedInputDevice.h" #include "base/PdfRefCountedInputDevice.h"
#include "base/PdfReference.h" #include "base/PdfReference.h"
#include "base/PdfRijndael.h"
#include "base/PdfStream.h" #include "base/PdfStream.h"
#include "base/PdfString.h" #include "base/PdfString.h"
#include "base/PdfTokenizer.h" #include "base/PdfTokenizer.h"
#include "base/PdfVariant.h" #include "base/PdfVariant.h"
#include "base/PdfVecObjects.h" #include "base/PdfVecObjects.h"
#include "base/PdfWriter.h" #include "base/PdfWriter.h"
#include "base/PdfXRef.h" #include "base/PdfXRef.h"
#include "base/PdfXRefStream.h" #include "base/PdfXRefStream.h"
#include "base/PdfXRefStreamParserObject.h" #include "base/PdfXRefStreamParserObject.h"
 End of changes. 1 change blocks. 
1 lines changed or deleted 0 lines changed or added


 podofo.h   podofo.h 
skipping to change at line 40 skipping to change at line 40
* On supporting platforms they will be excluded from the DLL interface, * On supporting platforms they will be excluded from the DLL interface,
* and they are not guaranteed to continue to exist. * and they are not guaranteed to continue to exist.
*/ */
#include "podofo-base.h" #include "podofo-base.h"
// Include files from PoDoFo-doc // Include files from PoDoFo-doc
#include "doc/PdfAcroForm.h" #include "doc/PdfAcroForm.h"
#include "doc/PdfAction.h" #include "doc/PdfAction.h"
#include "doc/PdfAnnotation.h" #include "doc/PdfAnnotation.h"
#include "doc/PdfCMapEncoding.h"
#include "doc/PdfContents.h" #include "doc/PdfContents.h"
#include "doc/PdfDestination.h" #include "doc/PdfDestination.h"
#include "doc/PdfDifferenceEncoding.h" #include "doc/PdfDifferenceEncoding.h"
#include "doc/PdfDocument.h" #include "doc/PdfDocument.h"
#include "doc/PdfElement.h" #include "doc/PdfElement.h"
#include "doc/PdfEncodingObjectFactory.h" #include "doc/PdfEncodingObjectFactory.h"
#include "doc/PdfExtGState.h" #include "doc/PdfExtGState.h"
#include "doc/PdfField.h" #include "doc/PdfField.h"
#include "doc/PdfFileSpec.h" #include "doc/PdfFileSpec.h"
#include "doc/PdfFontCache.h" #include "doc/PdfFontCache.h"
#include "doc/PdfFontCID.h" #include "doc/PdfFontCID.h"
#include "doc/PdfFontConfigWrapper.h"
#include "doc/PdfFontFactoryBase14Data.h" #include "doc/PdfFontFactoryBase14Data.h"
#include "doc/PdfFontFactory.h" #include "doc/PdfFontFactory.h"
#include "doc/PdfFont.h" #include "doc/PdfFont.h"
#include "doc/PdfFontMetricsBase14.h" #include "doc/PdfFontMetricsBase14.h"
#include "doc/PdfFontMetricsFreetype.h" #include "doc/PdfFontMetricsFreetype.h"
#include "doc/PdfFontMetrics.h" #include "doc/PdfFontMetrics.h"
#include "doc/PdfFontMetricsObject.h" #include "doc/PdfFontMetricsObject.h"
#include "doc/PdfFontSimple.h" #include "doc/PdfFontSimple.h"
#include "doc/PdfFontTrueType.h" #include "doc/PdfFontTrueType.h"
#include "doc/PdfFontTTFSubset.h" #include "doc/PdfFontTTFSubset.h"
 End of changes. 2 change blocks. 
0 lines changed or deleted 2 lines changed or added


 podofo_config.h   podofo_config.h 
skipping to change at line 23 skipping to change at line 23
#define PODOFO_VERSION_PATCH 1 #define PODOFO_VERSION_PATCH 1
/* PoDoFo configuration options */ /* PoDoFo configuration options */
#define PODOFO_MULTI_THREAD #define PODOFO_MULTI_THREAD
/* somewhat platform-specific headers */ /* somewhat platform-specific headers */
#define PODOFO_HAVE_STRINGS_H 1 #define PODOFO_HAVE_STRINGS_H 1
#define PODOFO_HAVE_ARPA_INET_H 1 #define PODOFO_HAVE_ARPA_INET_H 1
/* #undef PODOFO_HAVE_WINSOCK2_H */ /* #undef PODOFO_HAVE_WINSOCK2_H */
/* #undef PODOFO_HAVE_MEM_H */ /* #undef PODOFO_HAVE_MEM_H */
/* #undef PODOFO_HAVE_CTYPE_H */ #define PODOFO_HAVE_CTYPE_H 1
/* Integer types - headers */ /* Integer types - headers */
#define PODOFO_HAVE_STDINT_H 1 #define PODOFO_HAVE_STDINT_H 1
/* #undef PODOFO_HAVE_BASETSD_H */ /* #undef PODOFO_HAVE_BASETSD_H */
#define PODOFO_HAVE_SYS_TYPES_H 1 #define PODOFO_HAVE_SYS_TYPES_H 1
/* Integer types - type names */ /* Integer types - type names */
#define PDF_INT8_TYPENAME int8_t #define PDF_INT8_TYPENAME int8_t
#define PDF_INT16_TYPENAME int16_t #define PDF_INT16_TYPENAME int16_t
#define PDF_INT32_TYPENAME int32_t #define PDF_INT32_TYPENAME int32_t
#define PDF_INT64_TYPENAME int64_t #define PDF_INT64_TYPENAME int64_t
skipping to change at line 50 skipping to change at line 50
/* #undef TEST_BIG */ /* #undef TEST_BIG */
/* Libraries */ /* Libraries */
#define PODOFO_HAVE_JPEG_LIB #define PODOFO_HAVE_JPEG_LIB
#define PODOFO_HAVE_PNG_LIB #define PODOFO_HAVE_PNG_LIB
#define PODOFO_HAVE_TIFF_LIB #define PODOFO_HAVE_TIFF_LIB
#define PODOFO_HAVE_FONTCONFIG #define PODOFO_HAVE_FONTCONFIG
#define PODOFO_HAVE_LUA #define PODOFO_HAVE_LUA
/* #undef PODOFO_HAVE_BOOST */ /* #undef PODOFO_HAVE_BOOST */
#define PODOFO_HAVE_CPPUNIT #define PODOFO_HAVE_CPPUNIT
#define PODOFO_HAVE_LIBIDN
/* Platform quirks */ /* Platform quirks */
#define PODOFO_JPEG_RUNTIME_COMPATIBLE #define PODOFO_JPEG_RUNTIME_COMPATIBLE
 End of changes. 2 change blocks. 
1 lines changed or deleted 2 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/