PdfAnnotation.h   PdfAnnotation.h 
skipping to change at line 273 skipping to change at line 273
void SetFileAttachement( const PdfFileSpec & rFileSpec ); void SetFileAttachement( const PdfFileSpec & rFileSpec );
/** Get a file attachement of this annotation. /** Get a file attachement of this annotation.
* \returns a file specification object. The file specification object is owned * \returns a file specification object. The file specification object is owned
* by the PdfAnnotation. * by the PdfAnnotation.
* *
* \see SetFileAttachement * \see SetFileAttachement
*/ */
PdfFileSpec* GetFileAttachement() const; PdfFileSpec* GetFileAttachement() const;
/** Get the quad points associated with the annotation (if appropriate)
.
* This array is used in text markup annotations to describe the
* regions affected by the markup (i.e. the hilighted words, one
* quadrilateral per word)
*
* \returns a PdfArray of 8xn numbers describing the
* x,y coordinates of BL BR TR TL corners of the
* quadrilaterals. If inappropriate, returns
* an empty array.
*/
PdfArray GetQuadPoints() const;
/** Set the quad points associated with the annotation (if appropriate)
.
* This array is used in text markup annotations to describe the
* regions affected by the markup (i.e. the hilighted words, one
* quadrilateral per word)
*
* \param rQuadPoints a PdfArray of 8xn numbers describing the
* x,y coordinates of BL BR TR TL corners of the
* quadrilaterals.
*/
void SetQuadPoints( const PdfArray & rQuadPoints );
/** Get the color key of the Annotation dictionary
* which defines the color of the annotation,
* as per 8.4 of the pdf spec. The PdfArray contains
* 0 to four numbers, depending on the colorspace in
* which the color is specified
* 0 numbers means the annotation is transparent
* 1 number specifies the intensity of the color in grayscale
* 3 numbers specifie the color in the RGB colorspace and
* 4 numbers specify the color in the CMYK colorspace
*
* \returns a PdfArray of either 0, 1, 3 or 4 numbers
* depending on the colorspace in which the color
* is specified
*/
PdfArray GetColor() const;
/** Set the C key of the Annotation dictionary, which defines the
* color of the annotation, as per 8.4 of the pdf spec. Parameters
* give the color in rgb colorspace coordinates
*
* \param r number from 0 to 1, the intensity of the red channel
* \param g number from 0 to 1, the intensity of the green channel
* \param b number from 0 to 1, the intensity of the blue channel
*/
void SetColor( double r, double g, double b );
/** Set the C key of the Annotation dictionary, which defines the
* color of the annotation, as per 8.4 of the pdf spec. Parameters
* give the color in cmyk colorspace coordinates
*
* \param c number from 0 to 1, the intensity of the cyan channel
* \param m number from 0 to 1, the intensity of the magneta channel
* \param y number from 0 to 1, the intensity of the yellow channel
* \param k number from 0 to 1, the intensity of the black channel
*/
void SetColor( double c, double m, double y, double k );
/** Set the C key of the Annotation dictionary, which defines the
* color of the annotation, as per 8.4 of the pdf spec. Parameters
* give the color in grayscale colorspace coordinates
*
* \param gray number from 0 to 1, the intensity of the black
*/
void SetColor( double gray );
/** Set the C key of the Annotation dictionary to an empty array, which
,
* as per 8.4 of the pdf spec., makes the annotation transparent
*
*/
void SetColor();
/** Get the type of this annotation /** Get the type of this annotation
* \returns the annotation type * \returns the annotation type
*/ */
inline EPdfAnnotation GetType() const; inline EPdfAnnotation GetType() const;
/** Get the page of this PdfField /** Get the page of this PdfField
* *
* \returns the page of this PdfField * \returns the page of this PdfField
*/ */
inline PdfPage* GetPage() const; inline PdfPage* GetPage() const;
 End of changes. 1 change blocks. 
0 lines changed or deleted 82 lines changed or added


 PdfArray.h   PdfArray.h 
skipping to change at line 24 skipping to change at line 24
* * * *
* You should have received a copy of the GNU Library General Public * * You should have received a copy of the GNU Library General Public *
* 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_ARRAY_H_ #ifndef _PDF_ARRAY_H_
#define _PDF_ARRAY_H_ #define _PDF_ARRAY_H_
#ifdef _WIN32
#ifdef _MSC_VER
// IC: VS2008 suppress dll warning
#pragma warning(disable: 4275)
#endif // _MSC_VER
#endif // _WIN32
#include "PdfDefines.h" #include "PdfDefines.h"
#include "PdfDataType.h" #include "PdfDataType.h"
#include "PdfObject.h" #include "PdfObject.h"
namespace PoDoFo { namespace PoDoFo {
/** This class represents a PdfArray /** This class represents a PdfArray
* Use it for all arrays that are written to a PDF file. * Use it for all arrays that are written to a PDF file.
* *
* A PdfArray can hold any PdfVariant. * A PdfArray can hold any PdfVariant.
* *
* \see PdfVariant * \see PdfVariant
*/ */
class PODOFO_API PdfArray : public std::vector<PdfObject>, public PdfDataTy typedef std::vector<PdfObject> PdfArrayBaseClass;
pe {
class PODOFO_API PdfArray : private PdfArrayBaseClass, public PdfDataType {
public: public:
typedef PdfArrayBaseClass::iterator iterator;
typedef PdfArrayBaseClass::const_iterator const_iterator;
typedef PdfArrayBaseClass::reverse_iterator reverse_iterator;
typedef PdfArrayBaseClass::const_reverse_iterator const_reverse_iterato
r;
/** Create an empty array /** Create an empty array
*/ */
PdfArray(); PdfArray();
/** Create an array and add one value to it. /** Create an array and add one value to it.
* The value is copied. * The value is copied.
* *
* \param var add this object to the array. * \param var add this object to the array.
*/ */
skipping to change at line 92 skipping to change at line 105
*/ */
bool ContainsString( const std::string& cmpString ) const; bool ContainsString( const std::string& cmpString ) const;
/** Utility method to return the actual index in the /** Utility method to return the actual index in the
* array which contains an object of ePdfDataType_String whose * array which contains an object of ePdfDataType_String whose
* value is the passed string. * value is the passed string.
* \param cmpString the string to compare against * \param cmpString the string to compare against
* \returns true if success, false if not * \returns true if success, false if not
*/ */
size_t GetStringIndex( const std::string& cmpString ) const; size_t GetStringIndex( const std::string& cmpString ) const;
/** Adds a PdfObject to the array
*
* \param var add a PdfObject to the array
*
* This will set the dirty flag of this object.
* \see IsDirty
*/
inline void push_back( const PdfObject & var );
/**
* \returns the size of the array
*/
inline size_t size() const;
/**
* \returns true if the array is empty.
*/
inline bool empty() const;
inline PdfObject & operator[](size_type __n);
inline const PdfObject & operator[](size_type __n) const;
/**
* Returns a read/write iterator that points to the first
* element in the array. Iteration is done in ordinary
* element order.
*/
inline iterator begin();
/**
* Returns a read-only (constant) iterator that points to the
* first element in the array. Iteration is done in ordinary
* element order.
*/
inline const_iterator begin() const;
/**
* Returns a read/write iterator that points one past the last
* element in the array. Iteration is done in ordinary
* element order.
*/
inline iterator end();
/**
* Returns a read-only (constant) iterator that points one past
* the last element in the array. Iteration is done in
* ordinary element order.
*/
inline const_iterator end() const;
/**
* Returns a read/write reverse iterator that points to the
* last element in the array. Iteration is done in reverse
* element order.
*/
inline reverse_iterator rbegin();
/**
* Returns a read-only (constant) reverse iterator that points
* to the last element in the array. Iteration is done in
* reverse element order.
*/
inline const_reverse_iterator rbegin() const;
/**
* Returns a read/write reverse iterator that points to one
* before the first element in the array. Iteration is done
* in reverse element order.
*/
inline reverse_iterator rend();
/**
* Returns a read-only (constant) reverse iterator that points
* to one before the first element in the array. Iteration
* is done in reverse element order.
*/
inline const_reverse_iterator rend() const;
#if defined(_MSC_VER) && _MSC_VER <= 1200 // workaround templa
te-error in Visualstudio 6
inline void insert(iterator __position,
iterator __first,
iterator __last);
#else
template<typename _InputIterator>
void insert(iterator __position,
_InputIterator __first,
_InputIterator __last);
#endif
inline PdfArray::iterator insert(iterator __position, const PdfObject &
val );
inline void erase( iterator pos );
inline void erase( iterator first, iterator last );
inline void reserve(size_type __n);
/**
* \returns a read/write reference to the data at the first
* element of the array.
*/
inline reference front();
/**
* \returns a read-only (constant) reference to the data at the first
* element of the array.
*/
inline const_reference front() const;
/**
* \returns a read/write reference to the data at the last
* element of the array.
*/
inline reference back();
/**
* \returns a read-only (constant) reference to the data at the
* last element of the array.
*/
inline const_reference back() const;
inline bool operator==( const PdfArray & rhs ) const;
inline bool operator!=( const PdfArray & rhs ) const;
/** The dirty flag is set if this variant
* has been modified after construction.
*
* Usually the dirty flag is also set
* if you call any non-const member function
* as we cannot determine if you actually changed
* something or not.
*
* \returns true if the value is dirty and has been
* modified since construction
*/
virtual bool IsDirty() const;
/** Sets the dirty flag of this PdfVariant
*
* \param bDirty true if this PdfVariant has been
* modified from the outside
*
* \see IsDirty
*/
virtual void SetDirty( bool bDirty );
private:
bool m_bDirty; ///< Indicates if this object was modified after
construction
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
void PdfArray::Clear() void PdfArray::Clear()
{ {
this->clear(); this->clear();
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
size_t PdfArray::GetSize() const size_t PdfArray::GetSize() const
{ {
return this->size(); return this->size();
} }
// -----------------------------------------------------
//
// -----------------------------------------------------
void PdfArray::push_back( const PdfObject & var )
{
PdfArrayBaseClass::push_back( var );
m_bDirty = true;
}
// -----------------------------------------------------
//
// -----------------------------------------------------
size_t PdfArray::size() const
{
return PdfArrayBaseClass::size();
}
// -----------------------------------------------------
//
// -----------------------------------------------------
bool PdfArray::empty() const
{
return PdfArrayBaseClass::empty();
}
// -----------------------------------------------------
//
// -----------------------------------------------------
PdfObject& PdfArray::operator[](size_type __n)
{
m_bDirty = true;
return PdfArrayBaseClass::operator[](__n);
}
// -----------------------------------------------------
//
// -----------------------------------------------------
const PdfObject& PdfArray::operator[](size_type __n) const
{
return PdfArrayBaseClass::operator[](__n);
}
// -----------------------------------------------------
//
// -----------------------------------------------------
PdfArray::iterator PdfArray::begin()
{
return PdfArrayBaseClass::begin();
}
// -----------------------------------------------------
//
// -----------------------------------------------------
PdfArray::const_iterator PdfArray::begin() const
{
return PdfArrayBaseClass::begin();
}
// -----------------------------------------------------
//
// -----------------------------------------------------
PdfArray::iterator PdfArray::end()
{
return PdfArrayBaseClass::end();
}
// -----------------------------------------------------
//
// -----------------------------------------------------
PdfArray::const_iterator PdfArray::end() const
{
return PdfArrayBaseClass::end();
}
// -----------------------------------------------------
//
// -----------------------------------------------------
PdfArray::reverse_iterator PdfArray::rbegin()
{
return PdfArrayBaseClass::rbegin();
}
// -----------------------------------------------------
//
// -----------------------------------------------------
PdfArray::const_reverse_iterator PdfArray::rbegin() const
{
return PdfArrayBaseClass::rbegin();
}
// -----------------------------------------------------
//
// -----------------------------------------------------
PdfArray::reverse_iterator PdfArray::rend()
{
return PdfArrayBaseClass::rend();
}
// -----------------------------------------------------
//
// -----------------------------------------------------
PdfArray::const_reverse_iterator PdfArray::rend() const
{
return PdfArrayBaseClass::rend();
}
// -----------------------------------------------------
//
// -----------------------------------------------------
#if defined(_MSC_VER) && _MSC_VER <= 1200 // workaround templa
te-error in Visualstudio 6
void PdfArray::insert(PdfArray::iterator __position,
PdfArray::iterator __first,
PdfArray::iterator __last)
#else
template<typename _InputIterator>
void PdfArray::insert(PdfArray::iterator __position,
_InputIterator __first,
_InputIterator __last)
#endif
{
PdfArrayBaseClass::insert( __position, __first, __last );
m_bDirty = true;
}
// -----------------------------------------------------
//
// -----------------------------------------------------
PdfArray::iterator PdfArray::insert(PdfArray::iterator __position, const Pd
fObject & val )
{
m_bDirty = true;
return PdfArrayBaseClass::insert( __position, val );
}
// -----------------------------------------------------
//
// -----------------------------------------------------
void PdfArray::erase( iterator pos )
{
PdfArrayBaseClass::erase( pos );
m_bDirty = true;
}
// -----------------------------------------------------
//
// -----------------------------------------------------
void PdfArray::erase( iterator first, iterator last )
{
PdfArrayBaseClass::erase( first, last );
m_bDirty = true;
}
// -----------------------------------------------------
//
// -----------------------------------------------------
void PdfArray::reserve(size_type __n)
{
PdfArrayBaseClass::reserve( __n );
}
// -----------------------------------------------------
//
// -----------------------------------------------------
PdfObject & PdfArray::front()
{
return PdfArrayBaseClass::front();
}
// -----------------------------------------------------
//
// -----------------------------------------------------
const PdfObject & PdfArray::front() const
{
return PdfArrayBaseClass::front();
}
// -----------------------------------------------------
//
// -----------------------------------------------------
PdfObject & PdfArray::back()
{
return PdfArrayBaseClass::back();
}
// -----------------------------------------------------
//
// -----------------------------------------------------
const PdfObject & PdfArray::back() const
{
return PdfArrayBaseClass::back();
}
// -----------------------------------------------------
//
// -----------------------------------------------------
bool PdfArray::operator==( const PdfArray & rhs ) const
{
return (static_cast< PdfArrayBaseClass >(*this) == static_cast< PdfArra
yBaseClass >(rhs) );
}
// -----------------------------------------------------
//
// -----------------------------------------------------
bool PdfArray::operator!=( const PdfArray & rhs ) const
{
return (static_cast< PdfArrayBaseClass >(*this) != static_cast< PdfArra
yBaseClass >(rhs) );
}
typedef PdfArray TVariantList; typedef PdfArray TVariantList;
typedef PdfArray::iterator TIVariantList; typedef PdfArray::iterator TIVariantList;
typedef PdfArray::const_iterator TCIVariantList; typedef PdfArray::const_iterator TCIVariantList;
}; };
#endif // _PDF_ARRAY_H_ #endif // _PDF_ARRAY_H_
 End of changes. 5 change blocks. 
2 lines changed or deleted 378 lines changed or added


 PdfColor.h   PdfColor.h 
skipping to change at line 82 skipping to change at line 82
inline PdfColor( const PdfColor & rhs ); inline PdfColor( const PdfColor & rhs );
/** Assignment operator /** Assignment operator
* *
* \param rhs copy rhs into this object * \param rhs copy rhs into this object
* *
* \returns a reference to this color object * \returns a reference to this color object
*/ */
const PdfColor & operator=( const PdfColor & rhs ); const PdfColor & operator=( const PdfColor & rhs );
/** Test for equality of colors.
*
* \param rhs color to compare ro
*
* \returns true if object color is equal to rhs
*/
inline bool operator==( const PdfColor & rhs ) const;
/** Test for inequality of colors.
*
* \param rhs color to compare ro
*
* \returns true if object color is not equal to rhs
*/
inline bool operator!=( const PdfColor & rhs ) const;
/** Test if this is a grayscale color. /** Test if this is a grayscale color.
* *
* \returns true if this is a grayscale PdfColor object * \returns true if this is a grayscale PdfColor object
*/ */
inline bool IsGrayScale() const; inline bool IsGrayScale() const;
/** Test if this is a RGB color. /** Test if this is a RGB color.
* *
* \returns true if this is a RGB PdfColor object * \returns true if this is a RGB PdfColor object
*/ */
skipping to change at line 279 skipping to change at line 295
// //
// ----------------------------------------------------- // -----------------------------------------------------
PdfColor::PdfColor( const PdfColor & rhs ) PdfColor::PdfColor( const PdfColor & rhs )
{ {
this->operator=( rhs ); this->operator=( rhs );
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline bool PdfColor::operator==( const PdfColor & rhs ) const
{
if ( m_eColorSpace == rhs.m_eColorSpace )
{
if (
m_eColorSpace == ePdfColorSpace_DeviceGray
&&
m_uColor.gray == rhs.m_uColor.gray
)
return true;
if (
m_eColorSpace == ePdfColorSpace_DeviceRGB
&&
m_uColor.rgb[0] == rhs.m_uColor.rgb[0]
&&
m_uColor.rgb[1] == rhs.m_uColor.rgb[1]
&&
m_uColor.rgb[2] == rhs.m_uColor.rgb[2]
)
return true;
if (
m_eColorSpace == ePdfColorSpace_DeviceCMYK
&&
m_uColor.cmyk[0] == rhs.m_uColor.cmyk[0]
&&
m_uColor.cmyk[1] == rhs.m_uColor.cmyk[1]
&&
m_uColor.cmyk[2] == rhs.m_uColor.cmyk[2]
&&
m_uColor.cmyk[3] == rhs.m_uColor.cmyk[3]
)
return true;
}
return false;
}
// -----------------------------------------------------
//
// -----------------------------------------------------
inline bool PdfColor::operator!=( const PdfColor & rhs ) const
{
return ! (*this == rhs);
}
// -----------------------------------------------------
//
// -----------------------------------------------------
bool PdfColor::IsGrayScale() const bool PdfColor::IsGrayScale() const
{ {
return (m_eColorSpace == ePdfColorSpace_DeviceGray); return (m_eColorSpace == ePdfColorSpace_DeviceGray);
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
bool PdfColor::IsRGB() const bool PdfColor::IsRGB() const
{ {
 End of changes. 2 change blocks. 
0 lines changed or deleted 65 lines changed or added


 PdfDataType.h   PdfDataType.h 
skipping to change at line 54 skipping to change at line 54
public: public:
virtual ~PdfDataType(); virtual ~PdfDataType();
/** Write the complete datatype to a file. /** Write the complete datatype to a file.
* \param pDevice write the object to this device * \param pDevice write the object to this device
* \param pEncrypt an encryption object which is used to encrypt this object * \param pEncrypt an encryption object which is used to encrypt this object
* or NULL to not encrypt this object * or NULL to not encrypt this object
*/ */
virtual void Write( PdfOutputDevice* pDevice, const PdfEncrypt* pEncryp t = NULL ) const = 0; virtual void Write( PdfOutputDevice* pDevice, const PdfEncrypt* pEncryp t = NULL ) const = 0;
/** The dirty flag is set if this variant
* has been modified after construction.
*
* Usually the dirty flag is also set
* if you call any non-const member function
* as we cannot determine if you actually changed
* something or not.
*
* \returns true if the value is dirty and has been
* modified since construction
*/
virtual bool IsDirty() const;
/** Sets the dirty flag of this PdfVariant
*
* \param bDirty true if this PdfVariant has been
* modified from the outside
*
* \see IsDirty
*/
virtual void SetDirty( bool bDirty );
}; };
}; // namespace PoDoFo }; // namespace PoDoFo
#endif /* _PDF_DATATYPE_H_ */ #endif /* _PDF_DATATYPE_H_ */
 End of changes. 1 change blocks. 
0 lines changed or deleted 23 lines changed or added


 PdfDefines.h   PdfDefines.h 
skipping to change at line 32 skipping to change at line 32
#define _PDF_DEFINES_H_ #define _PDF_DEFINES_H_
/** \file PdfDefines.h /** \file PdfDefines.h
* This file should be included as the FIRST file in every header of * This file should be included as the FIRST file in every header of
* PoDoFo lib. It includes all standard files, defines some useful * PoDoFo lib. It includes all standard files, defines some useful
* macros, some datatypes and all important enumeration types. On * macros, some datatypes and all important enumeration types. On
* supporting platforms it will be precompiled to speed compilation. * supporting platforms it will be precompiled to speed compilation.
*/ */
#ifdef _MSC_VER #ifdef _MSC_VER
#if _MSC_VER <= 1200 // Visual Studio 6
#pragma warning(disable: 4786) #pragma warning(disable: 4786)
#pragma warning(disable: 4251) #pragma warning(disable: 4251)
#endif #elif _MSC_VER <= 1400 // Visual Studio 2005
#pragma warning(disable: 4251)
#pragma warning(disable: 4275)
#endif // _MSC_VER
#endif // _MSC_VER
// Include common system files // Include common system files
#include <cstdio> #include <cstdio>
// Include common STL files // Include common STL files
#include <map> #include <map>
#include <string> #include <string>
#include <vector> #include <vector>
#include <set> #include <set>
skipping to change at line 62 skipping to change at line 67
* more debuf output to the commandline from PoDoFo * more debuf output to the commandline from PoDoFo
* *
* Setting PDF_VERBOSE_DEBUG will make PoDoFo * Setting PDF_VERBOSE_DEBUG will make PoDoFo
* EXTREMELY slow and verbose, so it's not practical * EXTREMELY slow and verbose, so it's not practical
* even for regular debuggin. * even for regular debuggin.
*/ */
#ifndef PODOFO_VERBOSE_DEBUG #ifndef PODOFO_VERBOSE_DEBUG
//#define PODOFO_VERBOSE_DEBUG //#define PODOFO_VERBOSE_DEBUG
#endif //PODOFO_VERBOSE_DEBUG #endif //PODOFO_VERBOSE_DEBUG
// Make sure that DEBUG is defined
// for debug builds on Windows
// as Visual Studio defines only _DEBUG
#ifdef _DEBUG
#ifndef DEBUG
#define DEBUG 1
#endif // DEBUG
#endif // _DEBUG
#ifdef DEBUG #ifdef DEBUG
#include <assert.h>
#define PODOFO_ASSERT( x ) assert( x ); #define PODOFO_ASSERT( x ) assert( x );
#else #else
#define PODOFO_ASSERT( x ) #define PODOFO_ASSERT( x )
#endif // DEBUG #endif // DEBUG
// Should we do lots of extra (expensive) sanity checking? You should not // Should we do lots of extra (expensive) sanity checking? You should not
// define this on production builds because of the runtime cost and because it // define this on production builds because of the runtime cost and because it
// might cause the library to abort() if it notices something nasty. // might cause the library to abort() if it notices something nasty.
// It may also change the size of some objects, and is thus not binary // It may also change the size of some objects, and is thus not binary
// compatible. // compatible.
skipping to change at line 133 skipping to change at line 148
ePdfVersion_1_0 = 0, /**< PDF 1.0 */ ePdfVersion_1_0 = 0, /**< PDF 1.0 */
ePdfVersion_1_1, /**< PDF 1.1 */ ePdfVersion_1_1, /**< PDF 1.1 */
ePdfVersion_1_2, /**< PDF 1.2 */ ePdfVersion_1_2, /**< PDF 1.2 */
ePdfVersion_1_3, /**< PDF 1.3 */ ePdfVersion_1_3, /**< PDF 1.3 */
ePdfVersion_1_4, /**< PDF 1.4 */ ePdfVersion_1_4, /**< PDF 1.4 */
ePdfVersion_1_5, /**< PDF 1.5 */ ePdfVersion_1_5, /**< PDF 1.5 */
ePdfVersion_1_6, /**< PDF 1.6 */ ePdfVersion_1_6, /**< PDF 1.6 */
ePdfVersion_1_7 /**< PDF 1.7 */ ePdfVersion_1_7 /**< PDF 1.7 */
}; };
/** The default PDF Version used by new PDF documents
* in PoDoFo.
*/
const EPdfVersion ePdfVersion_Default = ePdfVersion_1_3;
/** /**
* Every PDF datatype that can occur in a PDF file * Every PDF datatype that can occur in a PDF file
* is referenced by an own enum (e.g. Bool or String). * is referenced by an own enum (e.g. Bool or String).
* *
* \see PdfVariant * \see PdfVariant
* *
* Remember to update PdfVariant::GetDataTypeString() when adding members h ere. * Remember to update PdfVariant::GetDataTypeString() when adding members h ere.
*/ */
enum EPdfDataType { enum EPdfDataType {
ePdfDataType_Bool, /**< Boolean datatype: Accepts the values "true" and "false" */ ePdfDataType_Bool, /**< Boolean datatype: Accepts the values "true" and "false" */
skipping to change at line 394 skipping to change at line 414
* \returns the maximum of x and y * \returns the maximum of x and y
*/ */
#define PDF_MAX(x,y) ((x)>(y)?(x):(y)) #define PDF_MAX(x,y) ((x)>(y)?(x):(y))
/** /**
* \def PDF_MIN(x,y) * \def PDF_MIN(x,y)
* \returns the minimum of x and y * \returns the minimum of x and y
*/ */
#define PDF_MIN(x,y) ((x)<(y)?(x):(y)) #define PDF_MIN(x,y) ((x)<(y)?(x):(y))
/**
* \def PODOFO_UNUSED( x )
* Make a certain variable to be unused
* in the code, without getting a compiler
* warning.
*/
#ifndef _WIN32
template <typename T>
inline void podofo_unused(T &t) { (void)t; }
#define PODOFO_UNUSED( x ) podofo_unused( x );
#else
#define PODOFO_UNUSED( x ) (void)x;
#endif // _WIN32
/* /*
This is needed to enable compilation with VC++ on Windows This is needed to enable compilation with VC++ on Windows
*/ */
#ifdef _MSC_VER #ifdef _MSC_VER
#define snprintf _snprintf #define snprintf _snprintf
#define vsnprintf _vsnprintf #define vsnprintf _vsnprintf
#endif #endif
/** /**
* \mainpage * \mainpage
 End of changes. 6 change blocks. 
1 lines changed or deleted 34 lines changed or added


 PdfDictionary.h   PdfDictionary.h 
skipping to change at line 60 skipping to change at line 60
*/ */
virtual ~PdfDictionary(); virtual ~PdfDictionary();
/** Asignment operator. /** Asignment operator.
* Asign another PdfDictionary to this dictionary. This is a deep copy ; * Asign another PdfDictionary to this dictionary. This is a deep copy ;
* all elements of the source dictionary are duplicated. * all elements of the source dictionary are duplicated.
* *
* \param rhs the PdfDictionary to copy. * \param rhs the PdfDictionary to copy.
* *
* \return this PdfDictionary * \return this PdfDictionary
*
* This will set the dirty flag of this object.
* \see IsDirty
*/ */
const PdfDictionary & operator=( const PdfDictionary & rhs ); const PdfDictionary & operator=( const PdfDictionary & rhs );
/** /**
* Comparison operator. If this dictionary contains all the same keys * Comparison operator. If this dictionary contains all the same keys
* as the other dictionary, and for each key the values compare equal, * as the other dictionary, and for each key the values compare equal,
* the dictionaries are considered equal. * the dictionaries are considered equal.
*/ */
bool operator==( const PdfDictionary& rhs ) const; bool operator==( const PdfDictionary& rhs ) const;
skipping to change at line 85 skipping to change at line 88
/** Removes all keys from the dictionary /** Removes all keys from the dictionary
*/ */
void Clear(); void Clear();
/** Add a key to the dictionary. If an existing key of this name exists , its /** Add a key to the dictionary. If an existing key of this name exists , its
* value is replaced and the old value object will be deleted. The pas sed * value is replaced and the old value object will be deleted. The pas sed
* object is copied. * object is copied.
* *
* \param identifier the key is identified by this name in the diction ary * \param identifier the key is identified by this name in the diction ary
* \param rObject a variant object containing the data. The object is copied. * \param rObject a variant object containing the data. The object is copied.
*
* This will set the dirty flag of this object.
* \see IsDirty
*/ */
void AddKey( const PdfName & identifier, const PdfObject & rObject ); void AddKey( const PdfName & identifier, const PdfObject & rObject );
/** Add a key to the dictionary. If an existing key of this name exists , /** Add a key to the dictionary. If an existing key of this name exists ,
* its value is replaced and the old value object will be deleted. The * its value is replaced and the old value object will be deleted. The
* passed object is copied. * passed object is copied.
* *
* This is an overloaded member function. * This is an overloaded member function.
* *
* \param identifier the key is identified by this name in the diction ary * \param identifier the key is identified by this name in the diction ary
* \param rObject a variant object containing the data. The object is copied. * \param rObject a variant object containing the data. The object is copied.
*
* This will set the dirty flag of this object.
* \see IsDirty
*/ */
void AddKey( const PdfName & identifier, const PdfObject* pObject ); void AddKey( const PdfName & identifier, const PdfObject* pObject );
/** Get the keys value out of the dictionary. /** Get the keys value out of the dictionary.
* *
* The returned value is a pointer to the internal object in the dictio nary * The returned value is a pointer to the internal object in the dictio nary
* so it MUST not be deleted. * so it MUST not be deleted.
* *
* \param key look for the key names pszKey in the dictionary * \param key look for the key names pszKey in the dictionary
* *
skipping to change at line 125 skipping to change at line 134
* be deleted. * be deleted.
* *
* \param key look for the key named key in the dictionary * \param key look for the key named key in the dictionary
* *
* \returns the found value or 0 if the key was not found. * \returns the found value or 0 if the key was not found.
*/ */
PdfObject* GetKey( const PdfName & key ); PdfObject* GetKey( const PdfName & key );
long GetKeyAsLong( const PdfName & key, long lDefault = 0 ) const; long GetKeyAsLong( const PdfName & key, long lDefault = 0 ) const;
double GetKeyAsReal( const PdfName & key, double dDefault = 0.0 ) const
;
bool GetKeyAsBool( const PdfName & key, bool bDefault = false ) const; bool GetKeyAsBool( const PdfName & key, bool bDefault = false ) const;
PdfName GetKeyAsName( const PdfName & key ) const; PdfName GetKeyAsName( const PdfName & key ) const;
/** Allows to check if a dictionary contains a certain key. \param key /** Allows to check if a dictionary contains a certain key. \param key
* look for the key named key.Name() in the dictionary * look for the key named key.Name() in the dictionary
* *
* \returns true if the key is part of the dictionary, otherwise false . * \returns true if the key is part of the dictionary, otherwise false .
*/ */
bool HasKey( const PdfName & key ) const; bool HasKey( const PdfName & key ) const;
/** Remove a key from this dictionary. If the key does not exists, thi s /** Remove a key from this dictionary. If the key does not exists, thi s
* function does nothing. * function does nothing.
* *
* \param identifier the name of the key to delete * \param identifier the name of the key to delete
* *
* \returns true if the key was found in the object and was removed if * \returns true if the key was found in the object and was removed if
* there was is no key with this name, false is returned. * there was is no key with this name, false is returned.
*
* This will set the dirty flag of this object.
* \see IsDirty
*/ */
bool RemoveKey( const PdfName & identifier ); bool RemoveKey( const PdfName & identifier );
/** Write the complete dictionary to a file. \param pDevice write the /** Write the complete dictionary to a file. \param pDevice write the
* object to this device \returns ErrOk on success * object to this device \returns ErrOk on success
* *
* \param pEncrypt an encryption object which is used to encrypt this object * \param pEncrypt an encryption object which is used to encrypt this object
* or NULL to not encrypt this object * or NULL to not encrypt this object
*/ */
inline void Write( PdfOutputDevice* pDevice, const PdfEncrypt* pEncrypt = NULL ) const; inline void Write( PdfOutputDevice* pDevice, const PdfEncrypt* pEncrypt = NULL ) const;
skipping to change at line 172 skipping to change at line 186
void Write( PdfOutputDevice* pDevice, const PdfEncrypt* pEncrypt, const PdfName & keyStop = void Write( PdfOutputDevice* pDevice, const PdfEncrypt* pEncrypt, const PdfName & keyStop =
PdfName::KeyNull ) const; PdfName::KeyNull ) const;
/** Get access to the internal map of keys. /** Get access to the internal map of keys.
* *
* \returns all keys of this dictionary * \returns all keys of this dictionary
*/ */
inline const TKeyMap & GetKeys() const; inline const TKeyMap & GetKeys() const;
/** Get access to the internal map of keys. \returns all keys of this /** Get access to the internal map of keys. \returns all keys of this
* dictionary * dictionary
*/ */
inline TKeyMap & GetKeys(); inline TKeyMap & GetKeys();
/** The dirty flag is set if this variant
* has been modified after construction.
*
* Usually the dirty flag is also set
* if you call any non-const member function
* as we cannot determine if you actually changed
* something or not.
*
* \returns true if the value is dirty and has been
* modified since construction
*/
virtual bool IsDirty() const;
/** Sets the dirty flag of this PdfVariant
*
* \param bDirty true if this PdfVariant has been
* modified from the outside
*
* \see IsDirty
*/
virtual void SetDirty( bool bDirty );
private: private:
TKeyMap m_mapKeys; TKeyMap m_mapKeys;
bool m_bDirty; ///< Indicates if this object was modified after
construction
}; };
typedef std::vector<PdfDictionary*> TVecDictionaries; typedef std::vector<PdfDictionary*> TVecDictionaries;
typedef TVecDictionaries::iterator TIVecDictionaries; typedef TVecDictionaries::iterator oTIVecDictionaries;
typedef TVecDictionaries::const_iterator TCIVecDictionaries; typedef TVecDictionaries::const_iterator TCIVecDictionaries;
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
const TKeyMap & PdfDictionary::GetKeys() const const TKeyMap & PdfDictionary::GetKeys() const
{ {
return m_mapKeys; return m_mapKeys;
} }
 End of changes. 9 change blocks. 
2 lines changed or deleted 42 lines changed or added


 PdfDocument.h   PdfDocument.h 
skipping to change at line 139 skipping to change at line 139
/** Creates a PdfFont object /** Creates a PdfFont object
* \param pszFontName name of the font as it is known to the system * \param pszFontName name of the font as it is known to the system
* \param pEncoding the encoding of the font. The font will not take o wnership of this object. * \param pEncoding the encoding of the font. The font will not take o wnership of this object.
* \param bEmbedd specifies whether this font should be embedded in th e PDF file. * \param bEmbedd specifies whether this font should be embedded in th e PDF file.
* Embedding fonts is usually a good idea. * Embedding fonts is usually a good idea.
* *
* \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* CreateFont( const char* pszFontName, const PdfEncoding * const pEncoding = &PdfFont::WinAnsiEncoding, PdfFont* CreateFont( const char* pszFontName, const PdfEncoding * const pEncoding = PdfEncodingFactory::GlobalPdfDocEncodingInstance(),
bool bEmbedd = true ); bool bEmbedd = true );
/** Creates a PdfFont object /** Creates a PdfFont object
* \param pszFontName name of the font as it is known to the system * \param pszFontName name of the font as it is known to the system
* \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
* \param pEncoding the encoding of the font. The font will not take o wnership of this object. * \param pEncoding the encoding of the font. The font will not take o wnership of this object.
* \param bEmbedd specifies whether this font should be embedded in th e PDF file. * \param bEmbedd specifies whether this font should be embedded in th e PDF file.
* Embedding fonts is usually a good idea. * Embedding fonts is usually a good idea.
* \param optional: pszFileName path to a valid font file * \param optional: pszFileName path to a valid font file
* *
* \returns PdfFont* a pointer to a new PdfFont object. * \returns PdfFont* a pointer to a new PdfFont object.
*/ */
PdfFont* CreateFont( const char* pszFontName, bool bBold, bool bItalic, PdfFont* CreateFont( const char* pszFontName, bool bBold, bool bItalic,
const PdfEncoding * const pEncoding = &PdfFont::Wi nAnsiEncoding, const PdfEncoding * const pEncoding = PdfEncodingF actory::GlobalPdfDocEncodingInstance(),
bool bEmbedd = true, const char* pszFileName = NUL L ); bool bEmbedd = true, const char* pszFileName = NUL L );
#ifdef _WIN32
/** Creates a PdfFont object
* \param pszFontName name of the font as it is known to the system
* \param pEncoding the encoding of the font. The font will not take o
wnership of this object.
* \param bEmbedd specifies whether this font should be embedded in th
e PDF file.
* Embedding fonts is usually a good idea.
*
* \returns PdfFont* a pointer to a new PdfFont object.
* The returned object is owned by the PdfDocument.
*
* This is an overloaded member function to allow working
* with unicode characters. On Unix systes you can also path
* UTF-8 to the const char* overload.
*/
PdfFont* CreateFont( const wchar_t* pszFontName, const PdfEncoding * co
nst pEncoding = PdfEncodingFactory::GlobalPdfDocEncodingInstance(),
bool bEmbedd = true );
/** Creates a PdfFont object
* \param pszFontName name of the font as it is known to the system
* \param bBold if true search for a bold font
* \param bItalic if true search for an italic font
* \param pEncoding the encoding of the font. The font will not take o
wnership of this object.
* \param bEmbedd specifies whether this font should be embedded in th
e PDF file.
* Embedding fonts is usually a good idea.
* \param optional: pszFileName path to a valid font file
*
* \returns PdfFont* a pointer to a new PdfFont object.
*
* This is an overloaded member function to allow working
* with unicode characters. On Unix systes you can also path
* UTF-8 to the const char* overload.
*/
PdfFont* CreateFont( const wchar_t* pszFontName, bool bBold, bool bItal
ic,
const PdfEncoding * const pEncoding = PdfEncodingF
actory::GlobalPdfDocEncodingInstance(),
bool bEmbedd = true);
#endif // _WIN32
/** Creates a PdfFont object /** Creates a PdfFont object
* \param face a valid freetype font handle (will be free'd by PoDoFo) * \param face a valid freetype font handle (will be free'd by PoDoFo)
* \param pEncoding the encoding of the font. The font will not take o wnership of this object. * \param pEncoding the encoding of the font. The font will not take o wnership of this object.
* \param bEmbedd specifies whether this font should be embedded in th e PDF file. * \param bEmbedd specifies whether this font should be embedded in th e PDF file.
* Embedding fonts is usually a good idea. * Embedding fonts is usually a good idea.
* \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* CreateFont( FT_Face face, const PdfEncoding * const pEncoding PdfFont* CreateFont( FT_Face face, const PdfEncoding * const pEncoding
= &PdfFont::WinAnsiEncoding, bool bEmbedd = true ); = PdfEncodingFactory::GlobalPdfDocEncodingInstance(), bool bEmbedd = true )
;
/** Creates a font subset which contains only a few characters and is e
mbedded.
*
* THIS WORKS ONLY FOR TTF FONTS!
*
* \param pszFontName name of the font as it is known to the system
* \param bBold if true search for a bold font
* \param bItalic if true search for an italic font
* \param pEncoding the encoding of the font. The font will not take o
wnership of this object.
*
* \returns PdfFont* a pointer to a new PdfFont object.
*/
PdfFont* CreateFontSubset( const char* pszFontName, bool bBold, bool bI
talic,
const PdfEncoding * const = PdfEncodingFactor
y::GlobalPdfDocEncodingInstance(),
const char* pszFileName = NULL);
#ifdef _WIN32
/** Creates a font subset which contains only a few characters and is e
mbedded.
*
* THIS WORKS ONLY FOR TTF FONTS!
*
* \param pszFontName name of the font as it is known to the system
* \param bBold if true search for a bold font
* \param bItalic if true search for an italic font
* \param pEncoding the encoding of the font. The font will not take o
wnership of this object.
*
* \returns PdfFont* a pointer to a new PdfFont object.
*
* This is an overloaded member function to allow working
* with unicode characters. On Unix systes you can also path
* UTF-8 to the const char* overload.
*/
PdfFont* CreateFontSubset( const wchar_t* pszFontName, bool bBold, bool
bItalic,
const PdfEncoding * const = PdfEncodingFactor
y::GlobalPdfDocEncodingInstance() );
#endif // _WIN32
// Peter Petrov 26 April 2008
/** Returns the font library from font cache
*
* \returns the internal handle to the freetype library
*/
inline FT_Library GetFontLibrary() const;
/** 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 );
skipping to change at line 452 skipping to change at line 531
* \param the object to be set * \param the object to be set
*/ */
void SetViewerPreference( const PdfName& whichPref, const PdfObject & v alueObj ); void SetViewerPreference( const PdfName& whichPref, const PdfObject & v alueObj );
void SetViewerPreference( const PdfName& whichPref, bool inValue ); void SetViewerPreference( const PdfName& whichPref, bool inValue );
/** Clear all internal variables /** Clear all internal variables
* And reset PdfDocument to an intial state * And reset PdfDocument to an intial state
*/ */
void Clear(); void Clear();
protected:
PdfFontCache m_fontCache;
private: private:
// Prevent use of copy constructor and assignment operator. These meth ods // Prevent use of copy constructor and assignment operator. These meth ods
// should never be referenced (given that code referencing them outside // should never be referenced (given that code referencing them outside
// PdfDocument won't compile), and calling them will result in a link e rror // PdfDocument won't compile), and calling them will result in a link e rror
// as they're not defined. // as they're not defined.
explicit PdfDocument(const PdfDocument&); explicit PdfDocument(const PdfDocument&);
PdfDocument& operator=(const PdfDocument&); PdfDocument& operator=(const PdfDocument&);
PdfVecObjects m_vecObjects; PdfVecObjects m_vecObjects;
PdfObject* m_pTrailer; PdfObject* m_pTrailer;
PdfObject* m_pCatalog; PdfObject* m_pCatalog;
PdfInfo* m_pInfo; PdfInfo* m_pInfo;
PdfOutlines* m_pOutlines; PdfOutlines* m_pOutlines;
PdfNamesTree* m_pNamesTree; PdfNamesTree* m_pNamesTree;
PdfPagesTree* m_pPagesTree; PdfPagesTree* m_pPagesTree;
PdfAcroForm* m_pAcroForms; PdfAcroForm* m_pAcroForms;
EPdfVersion m_eVersion; EPdfVersion m_eVersion;
PdfFontCache m_fontCache;
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline PdfPagesTree* PdfDocument::GetPagesTree() const inline PdfPagesTree* PdfDocument::GetPagesTree() const
{ {
return m_pPagesTree; return m_pPagesTree;
} }
skipping to change at line 561 skipping to change at line 642
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline const PdfVecObjects* PdfDocument::GetObjects() const inline const PdfVecObjects* PdfDocument::GetObjects() const
{ {
return &m_vecObjects; return &m_vecObjects;
} }
// Peter Petrov 26 April 2008
// -----------------------------------------------------
//
// -----------------------------------------------------
inline FT_Library PdfDocument::GetFontLibrary() const
{
return this->m_fontCache.GetFontLibrary();
}
}; };
#endif // _PDF_DOCUMENT_H_ #endif // _PDF_DOCUMENT_H_
 End of changes. 7 change blocks. 
5 lines changed or deleted 111 lines changed or added


 PdfEncoding.h   PdfEncoding.h 
skipping to change at line 25 skipping to change at line 25
* You should have received a copy of the GNU Library General Public * * You should have received a copy of the GNU Library General Public *
* 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_ENCODING_H_ #ifndef _PDF_ENCODING_H_
#define _PDF_ENCODING_H_ #define _PDF_ENCODING_H_
#include "PdfDefines.h" #include "PdfDefines.h"
#include "PdfElement.h"
#include "PdfName.h" #include "PdfName.h"
#include "PdfString.h" #include "PdfString.h"
#include "util/PdfMutex.h"
#include <iterator>
namespace PoDoFo { namespace PoDoFo {
class PdfDictionary; class PdfDictionary;
class PdfFont; class PdfFont;
/** /**
* A PdfEncoding is in PdfFont to transform a text string * A PdfEncoding is in PdfFont to transform a text string
* into a representation so that it can be displayed in a * into a representation so that it can be displayed in a
* PDF file. * PDF file.
* *
* PdfEncoding can also be used to convert strings from a * PdfEncoding can also be used to convert strings from a
* PDF file back into a PdfString. * PDF file back into a PdfString.
*/ */
class PODOFO_API PdfEncoding { class PODOFO_API PdfEncoding {
protected: protected:
/** /**
* Create a new PdfEncoding. * Create a new PdfEncoding.
* *
* \param nFirstChar the first supported character code * \param nFirstChar the first supported character code
* (either a byte value in the current encoding or a unicode value) * (either a byte value in the current encoding or a unicode value)
* \param nLastChar the last supported character code, must be larger than nFirstChar * \param nLastChar the last supported character code, must be larger than nFirstChar
* (either a byte value in the current encoding or a unicode value) * (either a byte value in the current encoding or a unicode value)
* *
*/ */
PdfEncoding( int nFirstChar, int nLastChar ); PdfEncoding( int nFirstChar, int nLastChar );
/** Get a unique ID for this encoding /** Get a unique ID for this encoding
* which can used for comparisons! * which can used for comparisons!
* *
* \returns a unique id for this encoding! * \returns a unique id for this encoding!
*/ */
virtual const PdfName & GetID() const = 0; virtual const PdfName & GetID() const = 0;
public: public:
#if defined(_MSC_VER) && _MSC_VER <= 1200 // ab Visual
studio 6
class PODOFO_API const_iterator : public std::iterator<
std::forward_iterator_tag,
int, ptrdiff_t> {
#else
class PODOFO_API const_iterator : public std::iterator<
std::forward_iterator_tag,
int, std::ptrdiff_t,
const int *, const int &> {
#endif
public:
const_iterator( const PdfEncoding* pEncoding, int nCur )
: m_pEncoding( pEncoding ), m_nCur( nCur )
{
}
const_iterator( const const_iterator & rhs )
{
this->operator=(rhs);
}
const const_iterator & operator=( const const_iterator & rhs )
{
m_nCur = rhs.m_nCur;
m_pEncoding = rhs.m_pEncoding;
return *this;
}
inline bool operator==( const const_iterator & rhs ) const
{
return (m_nCur == rhs.m_nCur);
}
inline bool operator!=( const const_iterator & rhs ) const
{
return (m_nCur != rhs.m_nCur);
}
inline pdf_utf16be operator*() const
{
return m_pEncoding->GetCharCode( m_nCur );
}
inline const_iterator & operator++()
{
m_nCur++;
return *this;
}
private:
const PdfEncoding* m_pEncoding;
int m_nCur;
};
virtual ~PdfEncoding(); virtual ~PdfEncoding();
/** Comparison operator. /** Comparison operator.
* *
* \param rhs the PdfEncoding to which this encoding should be compare d * \param rhs the PdfEncoding to which this encoding should be compare d
* *
* \returns true if both encodings are the same. * \returns true if both encodings are the same.
*/ */
inline bool operator==( const PdfEncoding & rhs ) const; inline bool operator==( const PdfEncoding & rhs ) const;
skipping to change at line 131 skipping to change at line 189
/** /**
* \returns the first character code that is defined for this encoding * \returns the first character code that is defined for this encoding
*/ */
inline int GetFirstChar() const; inline int GetFirstChar() const;
/** /**
* \returns the last character code that is defined for this encoding * \returns the last character code that is defined for this encoding
*/ */
inline int GetLastChar() const; inline int GetLastChar() const;
/** Iterate over all unicode character points in this
* encoding, beginning with the first.
*
* \returns iterator pointing to the first defined unicode character
*/
inline const_iterator begin() const;
/** Iterate over all unicode character points in this
* encoding, beginning with the first.
*
* \returns iterator pointing at the end
*/
inline const_iterator end() const;
/** Get the unicode character code for this encoding
* at the position nIndex. nIndex is a position between
* GetFirstChar() and GetLastChar()
*
* \param nIndex character code at position index
* \returns unicode character code
*
* \see GetFirstChar
* \see GetLastChar
*
* Will throw an exception if nIndex is out of range.
*/
virtual pdf_utf16be GetCharCode( int nIndex ) const = 0;
private: private:
int m_nFirstChar; ///< The first defined character code int m_nFirstChar; ///< The first defined character code
int m_nLastChar; ///< The last defined character code int m_nLastChar; ///< The last defined character code
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline bool PdfEncoding::operator<( const PdfEncoding & rhs ) const inline bool PdfEncoding::operator<( const PdfEncoding & rhs ) const
{ {
skipping to change at line 168 skipping to change at line 254
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline int PdfEncoding::GetLastChar() const inline int PdfEncoding::GetLastChar() const
{ {
return m_nLastChar; return m_nLastChar;
} }
// -----------------------------------------------------
//
// -----------------------------------------------------
inline PdfEncoding::const_iterator PdfEncoding::begin() const
{
return PdfEncoding::const_iterator( this, this->GetFirstChar() );
}
// -----------------------------------------------------
//
// -----------------------------------------------------
inline PdfEncoding::const_iterator PdfEncoding::end() const
{
return PdfEncoding::const_iterator( this, this->GetLastChar() + 1 );
}
/** /**
* A common base class for standard PdfEncoding which are * A common base class for standard PdfEncoding which are
* known by name. * known by name.
* *
* - PdfDocEncoding (only use this for strings which are not printed
* in the document. This is for meta data in the PDF).
* - MacRomanEncoding * - MacRomanEncoding
* - WinAnsiEncoding * - WinAnsiEncoding
* - MacExpertEncoding * - MacExpertEncoding
* *
* \see PdfWinAnsiEncoding * \see PdfWinAnsiEncoding
* \see PdfMacRomanEncoding * \see PdfMacRomanEncoding
* \see PdfMacExportEncoding * \see PdfMacExportEncoding
* *
*/ */
class PODOFO_API PdfSimpleEncoding : public PdfEncoding { class PODOFO_API PdfSimpleEncoding : public PdfEncoding {
public: public:
/* /*
* Create a new simple PdfEncoding which uses 1 byte. * Create a new simple PdfEncoding which uses 1 byte.
* *
* \param rName the name of a standard PdfEncoding * \param rName the name of a standard PdfEncoding
* *
* As of now possible values for rName are: * As of now possible values for rName are:
* - MacRomanEncoding * - MacRomanEncoding
* - WinAnsiEncoding * - WinAnsiEncoding
* - MacExpertEncoding * - MacExpertEncoding
* *
skipping to change at line 260 skipping to change at line 363
* \returns true if this is a single byte encoding with a maximum of 2 56 values. * \returns true if this is a single byte encoding with a maximum of 2 56 values.
*/ */
inline virtual bool IsSingleByteEncoding() const; inline virtual bool IsSingleByteEncoding() const;
/** Get the name of this encoding. /** Get the name of this encoding.
* *
* \returns the name of this encoding. * \returns the name of this encoding.
*/ */
inline const PdfName & GetName() const; inline const PdfName & GetName() const;
/** Get the unicode character code for this encoding
* at the position nIndex. nIndex is a position between
* GetFirstChar() and GetLastChar()
*
* \param nIndex character code at position index
* \returns unicode character code
*
* \see GetFirstChar
* \see GetLastChar
*
* Will throw an exception if nIndex is out of range.
*/
virtual pdf_utf16be GetCharCode( int nIndex ) const;
private: private:
/** Initialize the internal table of mappings from unicode code points /** Initialize the internal table of mappings from unicode code points
* to encoded byte values. * to encoded byte values.
*/ */
void InitEncodingTable(); void InitEncodingTable();
protected: protected:
/** Get a unique ID for this encoding /** Get a unique ID for this encoding
* which can used for comparisons! * which can used for comparisons!
skipping to change at line 286 skipping to change at line 403
* big endian unicode code points that are assigned * big endian unicode code points that are assigned
* to the 256 values of this encoding. * to the 256 values of this encoding.
* *
* This table is used internally to convert an encoded * This table is used internally to convert an encoded
* string of this encoding to and from unicode. * string of this encoding to and from unicode.
* *
* \returns an array of 256 big endian unicode code points * \returns an array of 256 big endian unicode code points
*/ */
virtual const pdf_utf16be* GetToUnicodeTable() const = 0; virtual const pdf_utf16be* GetToUnicodeTable() const = 0;
protected:
Util::PdfMutex m_mutex; ///< Mutex for the creation of the encoding t
able
private: private:
PdfName m_name; ///< The name of the encoding PdfName m_name; ///< The name of the encoding
char* m_pEncodingTable; ///< The helper table for conversions into th is encoding char* m_pEncodingTable; ///< The helper table for conversions into th is encoding
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline const PdfName & PdfSimpleEncoding::GetID() const inline const PdfName & PdfSimpleEncoding::GetID() const
{ {
skipping to change at line 324 skipping to change at line 444
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline const PdfName & PdfSimpleEncoding::GetName() const inline const PdfName & PdfSimpleEncoding::GetName() const
{ {
return m_name; return m_name;
} }
/** /**
* The PdfDocEncoding is the default encoding for
* all strings in PoDoFo which are data in the PDF
* file.
*
* Do not allocate this class yourself, as allocations
* might be expensive. Try using PdfFont::DocEncoding.
*
* \see PdfFont::DocEncoding
*/
class PODOFO_API PdfDocEncoding : public PdfSimpleEncoding {
public:
/** Create a new PdfWinAnsiEncoding
*/
PdfDocEncoding()
: PdfSimpleEncoding( PdfName("PdfDocEncoding") )
{
}
protected:
/** Gets a table of 256 short values which are the
* big endian unicode code points that are assigned
* to the 256 values of this encoding.
*
* This table is used internally to convert an encoded
* string of this encoding to and from unicode.
*
* \returns an array of 256 big endian unicode code points
*/
virtual const pdf_utf16be* GetToUnicodeTable() const;
private:
static const pdf_utf16be s_cEncoding[256]; ///< conversion table from W
inAnsiEncoding to UTF16
};
/**
* The WinAnsi Encoding is the default encoding in PoDoFo for * The WinAnsi Encoding is the default encoding in PoDoFo for
* contents on PDF pages. * contents on PDF pages.
* *
* It is also called CP-1252 encoding. * It is also called CP-1252 encoding.
* *
* Do not allocate this class yourself, as allocations * Do not allocate this class yourself, as allocations
* might be expensive. Try using PdfFont::WinAnsiEncoding. * might be expensive. Try using PdfFont::WinAnsiEncoding.
* *
* \see PdfFont::WinAnsiEncoding * \see PdfFont::WinAnsiEncoding
*/ */
class PODOFO_API PdfWinAnsiEncoding : public PdfSimpleEncoding { class PODOFO_API PdfWinAnsiEncoding : public PdfSimpleEncoding {
public: public:
/** Create a new PdfWinAnsiEncoding /** Create a new PdfWinAnsiEncoding
*/ */
inline PdfWinAnsiEncoding() PdfWinAnsiEncoding()
: PdfSimpleEncoding( PdfName("WinAnsiEncoding") ) : PdfSimpleEncoding( PdfName("WinAnsiEncoding") )
{ {
} }
protected: protected:
/** Gets a table of 256 short values which are the /** Gets a table of 256 short values which are the
* big endian unicode code points that are assigned * big endian unicode code points that are assigned
* to the 256 values of this encoding. * to the 256 values of this encoding.
* *
* This table is used internally to convert an encoded * This table is used internally to convert an encoded
* string of this encoding to and from unicode. * string of this encoding to and from unicode.
* *
* \returns an array of 256 big endian unicode code points * \returns an array of 256 big endian unicode code points
*/ */
inline virtual const pdf_utf16be* GetToUnicodeTable() const; virtual const pdf_utf16be* GetToUnicodeTable() const;
private: private:
static const pdf_utf16be s_cEncoding[256]; ///< conversion table from W inAnsiEncoding to UTF16 static const pdf_utf16be s_cEncoding[256]; ///< conversion table from W inAnsiEncoding to UTF16
}; };
// -----------------------------------------------------
//
// -----------------------------------------------------
inline const pdf_utf16be* PdfWinAnsiEncoding::GetToUnicodeTable() const
{
return PdfWinAnsiEncoding::s_cEncoding;
}
/** /**
* Do not allocate this class yourself, as allocations * Do not allocate this class yourself, as allocations
* might be expensive. Try using PdfFont::MacRomanEncoding. * might be expensive. Try using PdfFont::MacRomanEncoding.
* *
* \see PdfFont::MacRomanEncoding * \see PdfFont::MacRomanEncoding
*/ */
class PODOFO_API PdfMacRomanEncoding : public PdfSimpleEncoding { class PODOFO_API PdfMacRomanEncoding : public PdfSimpleEncoding {
public: public:
/** Create a new PdfMacRomanEncoding /** Create a new PdfMacRomanEncoding
*/ */
inline PdfMacRomanEncoding() PdfMacRomanEncoding()
: PdfSimpleEncoding( PdfName("MacRomanEncoding") ) : PdfSimpleEncoding( PdfName("MacRomanEncoding") )
{ {
} }
protected: protected:
/** Gets a table of 256 short values which are the /** Gets a table of 256 short values which are the
* big endian unicode code points that are assigned * big endian unicode code points that are assigned
* to the 256 values of this encoding. * to the 256 values of this encoding.
* *
* This table is used internally to convert an encoded * This table is used internally to convert an encoded
* string of this encoding to and from unicode. * string of this encoding to and from unicode.
* *
* \returns an array of 256 big endian unicode code points * \returns an array of 256 big endian unicode code points
*/ */
inline virtual const pdf_utf16be* GetToUnicodeTable() const; virtual const pdf_utf16be* GetToUnicodeTable() const;
private: private:
static const pdf_utf16be s_cEncoding[256]; ///< conversion table from W inAnsiEncoding to UTF16 static const pdf_utf16be s_cEncoding[256]; ///< conversion table from W inAnsiEncoding to UTF16
}; };
// -----------------------------------------------------
//
// -----------------------------------------------------
inline const pdf_utf16be* PdfMacRomanEncoding::GetToUnicodeTable() const
{
return PdfMacRomanEncoding::s_cEncoding;
}
/** /**
*/ */
class PODOFO_API PdfMacExpertEncoding : public PdfSimpleEncoding { class PODOFO_API PdfMacExpertEncoding : public PdfSimpleEncoding {
public: public:
/** Create a new PdfMacExpertEncoding /** Create a new PdfMacExpertEncoding
*/ */
inline PdfMacExpertEncoding() inline PdfMacExpertEncoding()
: PdfSimpleEncoding( PdfName("MacExpertEncoding") ) : PdfSimpleEncoding( PdfName("MacExpertEncoding") )
{ {
skipping to change at line 437 skipping to change at line 580
}; };
/** PdfIdentityEncoding is a two-byte encoding which can be /** PdfIdentityEncoding is a two-byte encoding which can be
* used with TrueType fonts to represent all characters * used with TrueType fonts to represent all characters
* present in a font. If the font contains all unicode * present in a font. If the font contains all unicode
* glyphs, PdfIdentityEncoding will support all unicode * glyphs, PdfIdentityEncoding will support all unicode
* characters. * characters.
*/ */
class PODOFO_API PdfIdentityEncoding : public PdfEncoding { class PODOFO_API PdfIdentityEncoding : public PdfEncoding {
public: public:
/** /**
* Create a new PdfIdentityEncoding. * Create a new PdfIdentityEncoding.
* *
* \param nFirstChar the first supported unicode character code (at le ast 0) * \param nFirstChar the first supported unicode character code (at le ast 0)
* \param nLastChar the last supported unicode character code, * \param nLastChar the last supported unicode character code,
* must be larger than nFirstChar (max value is 0xfff f) * must be larger than nFirstChar (max value is 0xfff f)
* \param bAutoDelete if true the encoding is deleted by its owning fo nt * \param bAutoDelete if true the encoding is deleted by its owning fo nt
*/ */
PdfIdentityEncoding( int nFirstChar = 0, int nLastChar = 0xffff, bool b AutoDelete = true ); PdfIdentityEncoding( int nFirstChar = 0, int nLastChar = 0xffff, bool b AutoDelete = true );
skipping to change at line 489 skipping to change at line 631
* \returns true if this encoding should be deleted automatically with the * \returns true if this encoding should be deleted automatically with the
* font. * font.
*/ */
virtual bool IsAutoDelete() const; virtual bool IsAutoDelete() const;
/** /**
* \returns true if this is a single byte encoding with a maximum of 2 56 values. * \returns true if this is a single byte encoding with a maximum of 2 56 values.
*/ */
virtual bool IsSingleByteEncoding() const; virtual bool IsSingleByteEncoding() const;
/** Get the unicode character code for this encoding
* at the position nIndex. nIndex is a position between
* GetFirstChar() and GetLastChar()
*
* \param nIndex character code at position index
* \returns unicode character code
*
* \see GetFirstChar
* \see GetLastChar
*
* Will throw an exception if nIndex is out of range.
*/
virtual pdf_utf16be GetCharCode( int nIndex ) const;
protected: protected:
/** Get a unique ID for this encoding /** Get a unique ID for this encoding
* which can used for comparisons! * which can used for comparisons!
* *
* \returns a unique id for this encoding! * \returns a unique id for this encoding!
*/ */
inline virtual const PdfName & GetID() const; inline virtual const PdfName & GetID() const;
private: private:
/** Gets the unicode value from a char code in this font
*
* \param lCharCode the character code (i.e. glyph id)
*
* \returns an unicode value
*/
pdf_utf16be GetUnicodeValue( long lCharCode ) const;
private:
bool m_bAutoDelete; ///< If true this encoding is deleted by it s font. bool m_bAutoDelete; ///< If true this encoding is deleted by it s font.
PdfName m_id; ///< Unique ID of this encoding PdfName m_id; ///< Unique ID of this encoding
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline const PdfName & PdfIdentityEncoding::GetID() const inline const PdfName & PdfIdentityEncoding::GetID() const
{ {
return m_id; return m_id;
skipping to change at line 526 skipping to change at line 692
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline bool PdfIdentityEncoding::IsSingleByteEncoding() const inline bool PdfIdentityEncoding::IsSingleByteEncoding() const
{ {
return false; return false;
} }
}; /* namespace RoMA */ }; /* namespace PoDoFo */
#endif // _PDF_ENCODING_H_ #endif // _PDF_ENCODING_H_
 End of changes. 21 change blocks. 
24 lines changed or deleted 193 lines changed or added


 PdfError.h   PdfError.h 
skipping to change at line 31 skipping to change at line 31
#ifndef _PDF_ERROR_H_ #ifndef _PDF_ERROR_H_
#define _PDF_ERROR_H_ #define _PDF_ERROR_H_
// PdfError.h should not include PdfDefines.h, since it is included by it. // PdfError.h should not include PdfDefines.h, since it is included by it.
// It should avoid depending on anything defined in PdfDefines.h . // It should avoid depending on anything defined in PdfDefines.h .
#include "podofoapi.h" #include "podofoapi.h"
#include <string> #include <string>
#include <queue> #include <queue>
#ifdef _MSC_VER // same pragma as in PdfDefines.h which we cannot include h ere #if defined(_MSC_VER) && _MSC_VER <= 1200 // same pragma as in PdfDefines .h which we cannot include here
#pragma warning(disable: 4251) #pragma warning(disable: 4251)
#endif #endif
/** \file PdfError.h /** \file PdfError.h
* Error information and logging is implemented in this file. * Error information and logging is implemented in this file.
*/ */
namespace PoDoFo { namespace PoDoFo {
/** Error Code defines which are used in PdfError to describe the error. /** Error Code defines which are used in PdfError to describe the error.
skipping to change at line 96 skipping to change at line 96
ePdfError_UnsupportedFilter, /**< The requested filter is not ye t implemented. */ ePdfError_UnsupportedFilter, /**< The requested filter is not ye t implemented. */
ePdfError_UnsupportedFontFormat, /**< This font format is not suppor ted by PoDoFO. */ ePdfError_UnsupportedFontFormat, /**< This font format is not suppor ted by PoDoFO. */
ePdfError_ActionAlreadyPresent, /**< An Action was already present when trying to add a Destination */ ePdfError_ActionAlreadyPresent, /**< An Action was already present when trying to add a Destination */
ePdfError_MissingEndStream, /**< The required token endstream w as not found. */ ePdfError_MissingEndStream, /**< The required token endstream w as not found. */
ePdfError_Date, /**< Date/time error */ ePdfError_Date, /**< Date/time error */
ePdfError_Flate, /**< Error in zlib */ ePdfError_Flate, /**< Error in zlib */
ePdfError_FreeType, /**< Error in FreeType */ ePdfError_FreeType, /**< Error in FreeType */
ePdfError_SignatureError, /**< Error in signature */ ePdfError_SignatureError, /**< Error in signature */
ePdfError_MutexError, /**< Error during a mutex operation
*/
ePdfError_UnsupportedImageFormat, /**< This image format is not suppo rted by PoDoFO. */ ePdfError_UnsupportedImageFormat, /**< This image format is not suppo rted by PoDoFO. */
ePdfError_NotImplemented, /**< This feature is currently not
implemented. */
ePdfError_Unknown = 0xffff /**< Unknown error */ ePdfError_Unknown = 0xffff /**< Unknown error */
}; };
/** /**
* Used in PdfError::LogMessage to specify the log level. * Used in PdfError::LogMessage to specify the log level.
* *
* \see PdfError::LogMessage * \see PdfError::LogMessage
*/ */
enum ELogSeverity { enum ELogSeverity {
eLogSeverity_Critical, /**< Critical unexpected error */ eLogSeverity_Critical, /**< Critical unexpected error */
skipping to change at line 153 skipping to change at line 157
// Woo for double-negatives. We define PODOFO_RAISE_LOGIC_IF unless we' ve been told not to by NDEBUG. // Woo for double-negatives. We define PODOFO_RAISE_LOGIC_IF unless we' ve been told not to by NDEBUG.
#define PODOFO_RAISE_LOGIC_IF( x, y ) { if (x) throw ::PoDoFo::PdfError ( ePdfError_InternalLogic, __FILE__, __LINE__, y ); }; #define PODOFO_RAISE_LOGIC_IF( x, y ) { if (x) throw ::PoDoFo::PdfError ( ePdfError_InternalLogic, __FILE__, __LINE__, y ); };
#else #else
#define PODOFO_RAISE_LOGIC_IF( x, y ) {}; #define PODOFO_RAISE_LOGIC_IF( x, y ) {};
#endif #endif
class PODOFO_API PdfErrorInfo { class PODOFO_API PdfErrorInfo {
public: public:
PdfErrorInfo(); PdfErrorInfo();
PdfErrorInfo( int line, const char* pszFile, const char* pszInfo ); PdfErrorInfo( int line, const char* pszFile, const char* pszInfo );
PdfErrorInfo( const PdfErrorInfo & rhs ); PdfErrorInfo( int line, const char* pszFile, const wchar_t* pszInfo );
PdfErrorInfo( const PdfErrorInfo & rhs );
const PdfErrorInfo & operator=( const PdfErrorInfo & rhs ); const PdfErrorInfo & operator=( const PdfErrorInfo & rhs );
inline int GetLine() const { return m_nLine; } inline int GetLine() const { return m_nLine; }
inline const std::string & GetFilename() const { return m_sFile; } inline const std::string & GetFilename() const { return m_sFile; }
inline const std::string & GetInformation() const { return m_sInfo; } inline const std::string & GetInformation() const { return m_sInfo; }
inline const std::wstring & GetInformationW() const { return m_swInfo; }
inline void SetInformation( const char* pszInfo ) { m_sInfo = pszInfo ? pszInfo : ""; } inline void SetInformation( const char* pszInfo ) { m_sInfo = pszInfo ? pszInfo : ""; }
inline void SetInformation( const wchar_t* pszInfo ) { m_swInfo = pszIn fo ? pszInfo : L""; }
private: private:
int m_nLine; int m_nLine;
std::string m_sFile; std::string m_sFile;
std::string m_sInfo; std::string m_sInfo;
std::wstring m_swInfo;
}; };
typedef std::deque<PdfErrorInfo> TDequeErrorInfo; typedef std::deque<PdfErrorInfo> TDequeErrorInfo;
typedef TDequeErrorInfo::iterator TIDequeErrorInfo; typedef TDequeErrorInfo::iterator TIDequeErrorInfo;
typedef TDequeErrorInfo::const_iterator TCIDequeErrorInfo; typedef TDequeErrorInfo::const_iterator TCIDequeErrorInfo;
// This is required to generate the documentation with Doxygen. // This is required to generate the documentation with Doxygen.
// Without this define doxygen thinks we have a class called PODOFO_EXCEPTI ON_API(PODOFO_API) ... // Without this define doxygen thinks we have a class called PODOFO_EXCEPTI ON_API(PODOFO_API) ...
#define PODOFO_EXCEPTION_API_DOXYGEN PODOFO_EXCEPTION_API(PODOFO_API) #define PODOFO_EXCEPTION_API_DOXYGEN PODOFO_EXCEPTION_API(PODOFO_API)
skipping to change at line 280 skipping to change at line 288
*/ */
inline void SetError( const EPdfError & eCode, const char* pszFile = NU LL, int line = 0, const char* pszInformation = NULL ); inline void SetError( const EPdfError & eCode, const char* pszFile = NU LL, int line = 0, const char* pszInformation = NULL );
/** Set additional error informatiom /** Set additional error informatiom
* \param pszInformation additional information on the error. * \param pszInformation additional information on the error.
* e.g. how to fix the error. This string is intended to * e.g. how to fix the error. This string is intended to
* be shown to the user. * be shown to the user.
*/ */
inline void SetErrorInformation( const char* pszInformation ); inline void SetErrorInformation( const char* pszInformation );
/** Add callstack information to an error object. Always call this func /** Set additional error informatiom
tion * \param pszInformation additional information on the error.
* e.g. how to fix the error. This string is intended to
* be shown to the user.
*/
inline void SetErrorInformation( const wchar_t* pszInformation );
/** Add callstack information to an error object. Always call this f
unction
* if you get an error object but do not handle the error but throw it again. * if you get an error object but do not handle the error but throw it again.
* *
* \param pszFile the filename of the source file causing * \param pszFile the filename of the source file causing
* the error or NULL. Typically you will use * the error or NULL. Typically you will use
* the gcc macro __FILE__ here. * the gcc macro __FILE__ here.
* \param line the line of source causing the error * \param line the line of source causing the error
* or 0. Typically you will use the gcc * or 0. Typically you will use the gcc
* macro __LINE__ here. * macro __LINE__ here.
* \param pszInformation additional information on the error. * \param pszInformation additional information on the error.
* e.g. how to fix the error. This string is intended to * e.g. how to fix the error. This string is intended to
skipping to change at line 329 skipping to change at line 344
* is available. * is available.
*/ */
static const char* ErrorMessage( EPdfError eCode ); static const char* ErrorMessage( EPdfError eCode );
/** Log a message to the logging system defined for PoDoFo. /** Log a message to the logging system defined for PoDoFo.
* \param eLogSeverity the sevirity of the log message * \param eLogSeverity the sevirity of the log message
* \param pszMsg the message to be logged * \param pszMsg the message to be logged
*/ */
static void LogMessage( ELogSeverity eLogSeverity, const char* pszMsg, ... ); static void LogMessage( ELogSeverity eLogSeverity, const char* pszMsg, ... );
/** Log a message to the logging system defined for PoDoFo.
* \param eLogSeverity the sevirity of the log message
* \param pszMsg the message to be logged
*/
static void LogMessage( ELogSeverity eLogSeverity, const wchar_t* pszMs
g, ... );
/** Enable or disable Logging
* \param bEnable enable (true) or disable (false)
*/
static void EnableLogging( bool bEnable ) { PdfError::s_LogEnabled = bE
nable; }
/** Is the display of debugging messages enabled or not?
*/
static bool LoggingEnabled() { return PdfError::s_LogEnabled; }
/** Log a message to the logging system defined for PoDoFo for debuggin g /** Log a message to the logging system defined for PoDoFo for debuggin g
* \param pszMsg the message to be logged * \param pszMsg the message to be logged
*/ */
static void DebugMessage( const char* pszMsg, ... ); static void DebugMessage( const char* pszMsg, ... );
/** Enable or disable the display of debugging messages /** Enable or disable the display of debugging messages
* \param bEnable enable (true) or disable (false) * \param bEnable enable (true) or disable (false)
*/ */
static void EnableDebug( bool bEnable ) { PdfError::s_DgbEnabled = bEna ble; } static void EnableDebug( bool bEnable ) { PdfError::s_DgbEnabled = bEna ble; }
/** Is the display of debugging messages enabled or not? /** Is the display of debugging messages enabled or not?
*/ */
static bool DebugEnabled() { return PdfError::s_DgbEnabled; } static bool DebugEnabled() { return PdfError::s_DgbEnabled; }
private: private:
EPdfError m_error; EPdfError m_error;
TDequeErrorInfo m_callStack; TDequeErrorInfo m_callStack;
static bool s_DgbEnabled; static bool s_DgbEnabled;
static bool s_LogEnabled;
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
EPdfError PdfError::GetError() const EPdfError PdfError::GetError() const
{ {
return m_error; return m_error;
} }
skipping to change at line 396 skipping to change at line 427
// ----------------------------------------------------- // -----------------------------------------------------
void PdfError::SetErrorInformation( const char* pszInformation ) void PdfError::SetErrorInformation( const char* pszInformation )
{ {
if( m_callStack.size() ) if( m_callStack.size() )
m_callStack.front().SetInformation( pszInformation ? pszInformation : "" ); m_callStack.front().SetInformation( pszInformation ? pszInformation : "" );
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
void PdfError::SetErrorInformation( const wchar_t* pszInformation )
{
if( m_callStack.size() )
m_callStack.front().SetInformation( pszInformation ? pszInformation
: L"" );
}
// -----------------------------------------------------
//
// -----------------------------------------------------
bool PdfError::IsError() const bool PdfError::IsError() const
{ {
return (m_error != ePdfError_ErrOk); return (m_error != ePdfError_ErrOk);
} }
}; };
#endif /* _PDF_ERROR_H_ */ #endif /* _PDF_ERROR_H_ */
 End of changes. 11 change blocks. 
7 lines changed or deleted 52 lines changed or added


 PdfFiltersPrivate.h   PdfFiltersPrivate.h 
skipping to change at line 42 skipping to change at line 42
*/ */
#include "PdfDefines.h" #include "PdfDefines.h"
#include "PdfFilter.h" #include "PdfFilter.h"
#include "PdfRefCountedBuffer.h" #include "PdfRefCountedBuffer.h"
#include <zlib.h> #include <zlib.h>
#ifdef PODOFO_HAVE_JPEG_LIB #ifdef PODOFO_HAVE_JPEG_LIB
extern "C" { extern "C" {
#ifdef _WIN32 // Collision between win and jpeg-headers
#define XMD_H
#endif
#include "jpeglib.h" #include "jpeglib.h"
} }
#endif // PODOFO_HAVE_JPEG_LIB #endif // PODOFO_HAVE_JPEG_LIB
#ifdef PODOFO_HAVE_TIFF_LIB #ifdef PODOFO_HAVE_TIFF_LIB
extern "C" { extern "C" {
#include "tiffio.h" #include "tiffio.h"
#ifdef WIN32 // Collision between tiff and jpeg-headers #ifdef _WIN32 // Collision between tiff and jpeg-headers
#define XMD_H #define XMD_H
#undef FAR #undef FAR
#endif #endif
} }
#endif // PODOFO_HAVE_TIFF_LIB #endif // PODOFO_HAVE_TIFF_LIB
namespace PoDoFo { namespace PoDoFo {
#define PODOFO_FILTER_INTERNAL_BUFFER_SIZE 4096 #define PODOFO_FILTER_INTERNAL_BUFFER_SIZE 4096
 End of changes. 2 change blocks. 
1 lines changed or deleted 4 lines changed or added


 PdfFont.h   PdfFont.h 
skipping to change at line 27 skipping to change at line 27
* 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_FONT_H_ #ifndef _PDF_FONT_H_
#define _PDF_FONT_H_ #define _PDF_FONT_H_
#include "PdfDefines.h" #include "PdfDefines.h"
#include "PdfName.h" #include "PdfName.h"
#include "PdfElement.h" #include "PdfElement.h"
#include "PdfEncoding.h" #include "PdfEncodingFactory.h"
#include "PdfFontMetrics.h" #include "PdfFontMetrics.h"
namespace PoDoFo { namespace PoDoFo {
class PdfObject; class PdfObject;
class PdfPage; class PdfPage;
class PdfWriter; class PdfWriter;
/** Before you can draw text on a PDF document, you have to create /** Before you can draw text on a PDF document, you have to create
* a font object first. You can reuse this font object as often * a font object first. You can reuse this font object as often
skipping to change at line 51 skipping to change at line 51
* It will choose a correct subclass using PdfFontFactory. * It will choose a correct subclass using PdfFontFactory.
* *
* This is only an abstract base class which is implemented * This is only an abstract base class which is implemented
* for different font formats. * for different font formats.
*/ */
class PODOFO_API PdfFont : public PdfElement { class PODOFO_API PdfFont : public PdfElement {
friend class PdfFontFactory; friend class PdfFontFactory;
public: public:
/** Always use this static declaration,
* if you need an instance of PdfWinAnsiEncoding
* as heap allocation is expensive for PdfWinAnsiEncoding.
*/
static const PdfWinAnsiEncoding WinAnsiEncoding;
/** Always use this static declaration,
* if you need an instance of PdfWinAnsiEncoding
* as heap allocation is expensive for PdfWinAnsiEncoding.
*/
static const PdfMacRomanEncoding MacRomanEncoding;
/** 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 ownership of this object. * \param pEncoding the encoding of this font. The font will not take ownership of this object.
* \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
* \param pMetrics pointer to a font metrics object. The font in the P
DF
* file will match this fontmetrics object. The metrics object
is
* deleted along with the font.
* \param pEncoding the encoding of this font. The font will not take
ownership of this object.
* \param pObject an existing PdfObject
*/
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 );
/** Retrieve the current font size of this font object /** Retrieve the current font size of this font object
* \returns the current font size * \returns the current font size
*/ */
 End of changes. 3 change blocks. 
13 lines changed or deleted 14 lines changed or added


 PdfFontCID.h   PdfFontCID.h 
skipping to change at line 41 skipping to change at line 41
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 ownership of this object. * \param pEncoding the encoding of this font. The font will not take ownership of this object.
* \param pParent parent of the font object * \param pParent parent of the font object
* \param bEmbed specifies the embedding of font
* *
*/ */
PdfFontCID( PdfFontMetrics* pMetrics, const PdfEncoding* const pEncodin PdfFontCID( PdfFontMetrics* pMetrics, const PdfEncoding* const pEncodin
g, PdfVecObjects* pParent ); g,
PdfVecObjects* pParent, bool bEmbed = true );
/** Create a PdfFont based on an existing PdfObject
* \param pMetrics pointer to a font metrics object. The font in the P
DF
* file will match this fontmetrics object. The metrics object
is
* deleted along with the font.
* \param pEncoding the encoding of this font. The font will not take
ownership of this object.
* \param pObject an existing PdfObject
*/
PdfFontCID( PdfFontMetrics* pMetrics, const PdfEncoding* const pEncodin
g, PdfObject* pObject );
private: private:
/** Create the DW and W entries which contain /** Create the DW and W entries which contain
* all glyph width in the given font dictionary. * all glyph width in the given font dictionary.
* *
* \param pFontDict a CID font dictionary * \param pFontDict a CID font dictionary
*/ */
void CreateWidth( PdfObject* pFontDict ) const; void CreateWidth( PdfObject* pFontDict ) const;
/** Create a ToUnicode CMap and write it to the stream /** Create a ToUnicode CMap and write it to the stream
 End of changes. 2 change blocks. 
2 lines changed or deleted 17 lines changed or added


 PdfFontCache.h   PdfFontCache.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_FONT_CACHE_H_ #ifndef _PDF_FONT_CACHE_H_
#define _PDF_FONT_CACHE_H_ #define _PDF_FONT_CACHE_H_
#include "PdfDefines.h" #include "PdfDefines.h"
#include "Pdf3rdPtyForwardDecl.h" #include "Pdf3rdPtyForwardDecl.h"
#include "PdfEncoding.h"
#include "PdfEncodingFactory.h"
#include "PdfFont.h" #include "PdfFont.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 {
TFontCacheElement() TFontCacheElement()
: m_pFont( NULL ), : m_pFont( NULL ),
m_pEncoding( NULL ), m_pEncoding( NULL ),
m_bBold( false ), m_bBold( false ),
m_bItalic( false ) m_bItalic( false )
{ {
} }
TFontCacheElement( const char* pszFontName, bool bBold, bool bItalic,
const PdfEncoding * const pEncoding )
: m_pFont(NULL), m_pEncoding( pEncoding ), m_bBold( bBold ),
m_bItalic( bItalic ), m_sFontName( reinterpret_cast<const pdf_utf
8*>(pszFontName) )
{
}
#ifdef _WIN32
TFontCacheElement( const wchar_t* pszFontName, bool bBold, bool bItalic
,
const PdfEncoding * const pEncoding )
: m_pFont(NULL), m_pEncoding( pEncoding ), m_bBold( bBold ),
m_bItalic( bItalic ), m_sFontName( pszFontName )
{
}
#endif // _WIN32
TFontCacheElement( const TFontCacheElement & rhs ) TFontCacheElement( const TFontCacheElement & rhs )
{ {
this->operator=(rhs); this->operator=(rhs);
} }
const TFontCacheElement & operator=( const TFontCacheElement & rhs ) const TFontCacheElement & operator=( const TFontCacheElement & rhs )
{ {
m_pFont = rhs.m_pFont; m_pFont = rhs.m_pFont;
m_pEncoding = rhs.m_pEncoding; m_pEncoding = rhs.m_pEncoding;
m_bBold = rhs.m_bBold; m_bBold = rhs.m_bBold;
skipping to change at line 79 skipping to change at line 97
else else
return m_bBold < rhs.m_bBold; return m_bBold < rhs.m_bBold;
} }
else else
return *m_pEncoding < *rhs.m_pEncoding; return *m_pEncoding < *rhs.m_pEncoding;
} }
else else
return (m_sFontName < rhs.m_sFontName); return (m_sFontName < rhs.m_sFontName);
} }
inline bool operator()( const TFontCacheElement& r1,
const TFontCacheElement& r2 ) const
{
return r1 < r2;
}
PdfFont* m_pFont; PdfFont* m_pFont;
const PdfEncoding* m_pEncoding; const PdfEncoding* m_pEncoding;
bool m_bBold; bool m_bBold;
bool m_bItalic; bool m_bItalic;
std::string m_sFontName; PdfString m_sFontName; ///< We use PdfString here as it can ea sily handle unicode on windows
}; };
/** /**
* This class assists PdfDocument * This class assists PdfDocument
* with caching font information. * with caching font information.
* *
* Additional to font caching, this class is also * Additional to font caching, this class is also
* responsible for font matching. * responsible for font matching.
* *
* PdfFont is an actual font that can be used in * PdfFont is an actual font that can be used in
* a PDF file (i.e. it does also font embedding) * a PDF file (i.e. it does also font embedding)
* and PdfFontMetrics provides only metrics informations. * and PdfFontMetrics provides only metrics informations.
* *
* 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_API PdfFontCache { class PODOFO_API PdfFontCache {
typedef std::vector<TFontCacheElement> TSortedFontList;
typedef TSortedFontList::iterator TISortedFontList;
typedef TSortedFontList::const_iterator TCISortedFontList;
public: public:
/** 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 );
/** 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();
/** Get a font from the cache. If the font does not yet /** Get a font from the cache. If the font does not yet
* exist, add it to the cache. This font is created
* from an existing object.
*
* \param pObject a PdfObject that is a font
*
* \returns a PdfFont object or NULL if the font could
* not be created or found.
*/
PdfFont* GetFont( PdfObject* pObject );
/** Get a font from the cache. If the font does not yet
* exist, add it to the cache. * exist, add it to the cache.
* *
* \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
* \param bEmbedd if true a font for embedding into * \param bEmbedd if true a font for embedding into
* PDF will be created * PDF will be created
* \param pEncoding the encoding of the font. The font will not take o wnership of this object. * \param pEncoding the encoding of the font. The font will not take o wnership of this object.
* \param optional: pszFileName path to a valid font file * \param optional: pszFileName path to a valid font file
* *
* \returns a PdfFont object or NULL if the font could * \returns a PdfFont object or NULL if the font could
* not be created or found. * not be created or found.
*/ */
PdfFont* GetFont( const char* pszFontName, bool bBold, bool bItalic, PdfFont* GetFont( const char* pszFontName, bool bBold, bool bItalic,
bool bEmbedd, const PdfEncoding * const = &PdfFont::W bool bEmbedd,
inAnsiEncoding, const PdfEncoding * const = PdfEncodingFactory::Global
PdfDocEncodingInstance(),
const char* pszFileName = NULL ); const char* pszFileName = NULL );
#ifdef _WIN32
/** Get a font from the cache. If the font does not yet
* exist, add it to the cache.
*
* \param pszFontName a valid fontname
* \param bBold if true search for a bold font
* \param bItalic if true search for an italic font
* \param bEmbedd if true a font for embedding into
* PDF will be created
* \param pEncoding the encoding of the font. The font will not take o
wnership of this object.
*
* \returns a PdfFont object or NULL if the font could
* not be created or found.
*
* This is an overloaded member function to allow working
* with unicode characters. On Unix systes you can also path
* UTF-8 to the const char* overload.
*/
PdfFont* GetFont( const wchar_t* pszFontName, bool bBold, bool bItalic,
bool bEmbedd, const PdfEncoding * const = PdfEncoding
Factory::GlobalPdfDocEncodingInstance() );
#endif // _WIN32
/** Get a font from the cache. If the font does not yet /** Get a font from the cache. If the font does not yet
* exist, add it to the cache. * exist, add it to the cache.
* *
* \param face a valid freetype font face (will be free'd by PoDoFo) * \param face a valid freetype font face (will be free'd by PoDoFo)
* \param bEmbedd if true a font for embedding into * \param bEmbedd if true a font for embedding into
* PDF will be created * PDF will be created
* \param pEncoding the encoding of the font. The font will not take o wnership of this object. * \param pEncoding the encoding of the font. The font will not take o wnership of this object.
* *
* \returns a PdfFont object or NULL if the font could * \returns a PdfFont object or NULL if the font could
* not be created or found. * not be created or found.
*/ */
PdfFont* GetFont( FT_Face face, bool bEmbedd, const PdfEncoding * const = &PdfFont::WinAnsiEncoding ); PdfFont* GetFont( FT_Face face, bool bEmbedd, const PdfEncoding * const = PdfEncodingFactory::GlobalPdfDocEncodingInstance() );
/** Get a fontsubset from the cache. If the font does not yet /** Get a fontsubset from the cache. If the font does not yet
* exist, add it to the cache. * exist, add it to the cache.
* *
* \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
* \param vecGlyphs a list of Unicode glyph indeces that should be emb * \param pEncoding the encoding of the font. All characters
edded in the subset * of the encoding will be included in this subset.
* The font will not take ownership of this object.
* \param optional: pszFileName path to a valid font file
* *
* \returns a PdfFont object or NULL if the font could * \returns a PdfFont object or NULL if the font could
* not be created or found. * not be created or found.
*/ */
/* PdfFont* GetFontSubset( const char* pszFontName, bool bBold, bool bItal
PdfFont* GetFontSubset( const char* pszFontName, bool bBold, ic,
bool bItalic, const std::vector<int> & vecGlyph const PdfEncoding * const = PdfEncodingFactory::
s ); GlobalPdfDocEncodingInstance(),
*/ const char* pszFileName = NULL);
#if defined(HAVE_FONTCONFIG) #if defined(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.
* *
* \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 // (HAVE_FONTCONFIG) #endif // defined(HAVE_FONTCONFIG)
// Peter Petrov: 26 April 2008
/** Returns the font library from font cache
*
* \returns the internal handle to the freetype library
*/
inline FT_Library GetFontLibrary() const;
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.
*/ */
std::string GetFontPath( const char* pszFontName, bool bBold, bool bIta lic ); std::string GetFontPath( const char* pszFontName, bool bBold, bool bIta lic );
/** Create a font and put it into the fontcache /** Create a font and put it into the fontcache
*
* \param itSorted iterator pointing to a location in vecContainer
* where a sorted insert can be made
* \param vecContainer container where the font object should be added
* \param pMetrics a font metrics * \param pMetrics a font metrics
* \param bEmbedd if true the font will be embedded in the pdf file * \param bEmbedd if true the font will be embedded in the pdf file
* \param bBold if true this font will be treated as bold font * \param bBold if true this font will be treated as bold font
* \param bItalic if true this font will be treated as italic font * \param bItalic if true this font will be treated as italic font
* \param pszFontName a font name for debug output * \param pszFontName a font name for debug output
* \param pEncoding the encoding of the font. The font will not take o wnership of this object. * \param pEncoding the encoding of the font. The font will not take o wnership of this object.
* *
* \returns a font handle or NULL in case of error * \returns a font handle or NULL in case of error
*/ */
PdfFont* CreateFontObject( PdfFontMetrics* pMetrics, bool bEmbedd, bool PdfFont* CreateFontObject( TISortedFontList itSorted, TSortedFontList &
bBold, vecContainer,
PdfFontMetrics* pMetrics, bool bEmbedd, bool
bBold,
bool bItalic, const char* pszFontName, const PdfEncoding * const pEncoding ); bool bItalic, const char* pszFontName, const PdfEncoding * const pEncoding );
/** Create a font subset. /** Create a font subset.
* \param pMetrics a font metrics * \param pMetrics a font metrics
* \param pszFontName a font name for debug output * \param pszFontName a font name for debug output
* \param bBold if true this font will be treated as bold font * \param bBold if true this font will be treated as bold font
* \param bItalic if true this font will be treated as italic font * \param bItalic if true this font will be treated as italic font
* \param vecGlyphs the list of all glyphs that should get embedded in to this subset * \param vecCharacters a list of Unicode character indeces that shoul d be embedded in the subset
* *
* \returns a font handle or NULL in case of error * \returns a font handle or NULL in case of error
*/ */
/* /*
PdfFont* CreateFontSubset( PdfFontMetrics* pMetrics, const char* pszFon tName, bool bBold, PdfFont* CreateFontSubset( PdfFontMetrics* pMetrics, const char* pszFon tName, bool bBold,
bool bItalic, const std::vector<int> & vecGl yphs ); bool bItalic, const std::vector<int> & vecCh aracters );
*/ */
#ifdef _WIN32 #ifdef _WIN32
/** Load and create a font with windows API calls /** Load and create a font with windows API calls
* *
* This method is only available on Windows systems. * This method is only available on Windows systems.
* *
* \param pszFontName a fontnanme * \param itSorted iterator pointing to a location in vecContainer
* where a sorted insert can be made
* \param vecContainer container where the font object should be added
* \param pszFontName a 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
* \param bEmbedd if true embedd the font * \param bEmbedd if true embedd the font
* \param pEncoding the encoding of the font. The font will not take o wnership of this object. * \param pEncoding the encoding of the font. The font will not take o wnership of this object.
* *
* \returns a font handle or NULL in case of error * \returns a font handle or NULL in case of error
*/ */
PdfFont* GetWin32Font( const char* pszFontName, bool bBold, bool bItali PdfFont* GetWin32Font( TISortedFontList itSorted, TSortedFontList & vec
c, bool bEmbedd, const PdfEncoding * const pEncoding ); Container, const char* pszFontName,
bool bBold, bool bItalic, bool bEmbed
d, const PdfEncoding * const pEncoding );
PdfFont* GetWin32Font( TISortedFontList itSorted, TSortedFontList & vec
Container, const wchar_t* pszFontName,
bool bBold, bool bItalic, bool bEmbed
d, const PdfEncoding * const pEncoding );
#endif // _WIN32 #endif // _WIN32
private: private:
typedef std::vector<TFontCacheElement> TSortedFontList;
typedef TSortedFontList::iterator TISortedFontList;
typedef TSortedFontList::const_iterator TCISortedFontList;
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 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
}; };
// Peter Petrov: 26 April 2008
// -----------------------------------------------------
//
// -----------------------------------------------------
FT_Library PdfFontCache::GetFontLibrary() const
{
return this->m_ftLibrary;
}
}; };
#endif /* _PDF_FONT_CACHE_H_ */ #endif /* _PDF_FONT_CACHE_H_ */
 End of changes. 21 change blocks. 
26 lines changed or deleted 122 lines changed or added


 PdfFontFactory.h   PdfFontFactory.h 
skipping to change at line 63 skipping to change at line 63
* here. * here.
* \param nFlags font flags or'ed together, specifying the font style and if it should be embedded * \param nFlags font flags or'ed together, specifying the font style and if it should be embedded
* \param pEncoding the encoding of this font. * \param pEncoding the encoding of this font.
* \param pParent the parent of the created font. * \param pParent the parent of the created font.
* *
* \returns a new PdfFont object or NULL * \returns a new PdfFont object or NULL
*/ */
static PdfFont* CreateFontObject( PdfFontMetrics* pMetrics, int nFlags, static PdfFont* CreateFontObject( PdfFontMetrics* pMetrics, int nFlags,
const PdfEncoding* const pEncoding, P dfVecObjects* pParent ); const PdfEncoding* const pEncoding, P dfVecObjects* pParent );
/** Create a new PdfFont from an existing
* font in a PDF file.
*
* \param pLibrary handle to the FreeType library, so that a PdfFontMe
trics
* can be constructed for this font
* \param pObject a PDF font object
*/
static PdfFont* CreateFont( FT_Library* pLibrary, PdfObject* pObject );
private: private:
/** Actually creates the font object for the requested type. /** Actually creates the font object for the requested type.
* Throws an exception in case of an error. * Throws an exception in case of an error.
* *
* \returns a new PdfFont object or NULL * \returns a new PdfFont object or NULL
*/ */
static PdfFont* CreateFontForType( EPdfFontType eType, PdfFontMetrics* pMetrics, static PdfFont* CreateFontForType( EPdfFontType eType, PdfFontMetrics* pMetrics,
const PdfEncoding* const pEncoding, const PdfEncoding* const pEncoding,
bool bEmbed, PdfVecObjects* pParent ); bool bEmbed, PdfVecObjects* pParent );
 End of changes. 1 change blocks. 
0 lines changed or deleted 10 lines changed or added


 PdfFontMetrics.h   PdfFontMetrics.h 
skipping to change at line 35 skipping to change at line 35
#include "Pdf3rdPtyForwardDecl.h" #include "Pdf3rdPtyForwardDecl.h"
#include "PdfString.h" #include "PdfString.h"
#ifndef PODOFO_CONVERSION_CONSTANT #ifndef PODOFO_CONVERSION_CONSTANT
#define PODOFO_CONVERSION_CONSTANT 0.002834645669291339 #define PODOFO_CONVERSION_CONSTANT 0.002834645669291339
#endif // PODOFO_CONVERSION_CONSTANT #endif // PODOFO_CONVERSION_CONSTANT
namespace PoDoFo { namespace PoDoFo {
class PdfArray; class PdfArray;
class PdfObject;
class PdfVariant; class PdfVariant;
/** /**
* Enum for the different font formats supported by PoDoFo * Enum for the different font formats supported by PoDoFo
*/ */
enum EPdfFontType { enum EPdfFontType {
ePdfFontType_TrueType, ePdfFontType_TrueType,
ePdfFontType_Type1Pfa, ePdfFontType_Type1Pfa,
ePdfFontType_Type1Pfb, ePdfFontType_Type1Pfb,
ePdfFontType_Unknown = 0xff ePdfFontType_Unknown = 0xff
}; };
class PODOFO_API PdfFontMetrics { class PODOFO_API PdfFontMetrics {
public: public:
/** Create a font metrics object for a given true type file /** Create a font metrics object for a given true type file
* \param pLibrary handle to an initialized FreeType2 library handle * \param pLibrary handle to an initialized FreeType2 library handle
* \param pszFilename filename of a truetype file * \param pszFilename filename of a truetype file
* \param pszSubsetPrefix unique prefix for font subsets (see GetFontS ubsetPrefix)
*/ */
PdfFontMetrics( FT_Library* pLibrary, const char* pszFilename ); PdfFontMetrics( FT_Library* pLibrary, const char* pszFilename,
const char* pszSubsetPrefix = NULL );
/** Create a font metrics object for a given memory buffer /** Create a font metrics object for a given memory buffer
* \param pLibrary handle to an initialized FreeType2 library handle * \param pLibrary handle to an initialized FreeType2 library handle
* \param pBuffer block of memory representing the font data (PdfFontM etrics will copy the buffer) * \param pBuffer block of memory representing the font data (PdfFontM etrics will copy the buffer)
* \param nBufLen the length of the buffer * \param nBufLen the length of the buffer
*/ * \param pszSubsetPrefix unique prefix for font subsets (see GetFontS
PdfFontMetrics( FT_Library* pLibrary, const char* pBuffer, unsigned int ubsetPrefix)
nBufLen ); */
PdfFontMetrics( FT_Library* pLibrary, const char* pBuffer, unsigned int
nBufLen,
const char* pszSubsetPrefix = NULL);
/** Create a font metrics object for a given true type file /** Create a font metrics object for a given true type file
* \param pLibrary handle to an initialized FreeType2 library handle * \param pLibrary handle to an initialized FreeType2 library handle
* \param rBuffer a buffer containing a font file * \param rBuffer a buffer containing a font file
* \param pszSubsetPrefix unique prefix for font subsets (see GetFontS ubsetPrefix)
*/ */
PdfFontMetrics( FT_Library* pLibrary, const PdfRefCountedBuffer & rBuff PdfFontMetrics( FT_Library* pLibrary, const PdfRefCountedBuffer & rBuff
er ); er,
const char* pszSubsetPrefix = NULL);
/** Create a font metrics object for a given freetype font. /** Create a font metrics object for a given freetype font.
* \param pLibrary handle to an initialized FreeType2 library handle * \param pLibrary handle to an initialized FreeType2 library handle
* \param face a valid freetype font face * \param face a valid freetype font face
* \param pszSubsetPrefix unique prefix for font subsets (see GetFontS
ubsetPrefix)
*/
PdfFontMetrics( FT_Library* pLibrary, FT_Face face,
const char* pszSubsetPrefix = NULL);
/** Create a font metrics object based on an existing PdfObject
*
* \param pLibrary handle to an initialized FreeType2 library handle
* \param pObject an existing font descriptor object
*/ */
PdfFontMetrics( FT_Library* pLibrary, FT_Face face ); PdfFontMetrics( FT_Library* pLibrary, PdfObject* pDescriptor );
virtual ~PdfFontMetrics(); virtual ~PdfFontMetrics();
/** Create a width array for this font which is a required part /** Create a width array for this font which is a required part
* of every font dictionary. * of every font dictionary.
* \param var the final width array is written to this PdfVariant * \param var the final width array is written to this PdfVariant
* \param nFirst first character to be in the array * \param nFirst first character to be in the array
* \param nLast last character code to be in the array * \param nLast last character code to be in the array
*/ */
void GetWidthArray( PdfVariant & var, unsigned int nFirst, unsigned int nLast ) const; void GetWidthArray( PdfVariant & var, unsigned int nFirst, unsigned int nLast ) const;
skipping to change at line 115 skipping to change at line 131
inline double StringWidth( const PdfString & rsString ) const; inline double StringWidth( const PdfString & rsString ) const;
/** 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
* \param pszText a text string of which the width should be calculate d * \param pszText a text string of which the width should be calculate d
* \param nLength if != 0 only the width of the nLength first characte rs is calculated * \param nLength if != 0 only the width of the nLength first characte rs is calculated
* \returns the width in PDF units * \returns the width in PDF units
*/ */
double StringWidth( const char* pszText, unsigned int nLength = 0 ) con st; double StringWidth( const char* pszText, unsigned int nLength = 0 ) con st;
/** Retrieve the width of a given text string in PDF units when
* drawn with the current font
* \param pszText a text string of which the width should be calculate
d
* \param nLength if != 0 only the width of the nLength first characte
rs is calculated
* \returns the width in PDF units
*/
double StringWidth( const pdf_utf16be* pszText, unsigned int nLength =
0 ) const;
#if defined(_MSC_VER) && _MSC_VER <= 1200 // nicht f
#else
/** Retrieve the width of a given text string in PDF units when
* drawn with the current font
* \param pszText a text string of which the width should be calculate
d
* \param nLength if != 0 only the width of the nLength first characte
rs is calculated
* \returns the width in PDF units
*/
double StringWidth( const wchar_t* pszText, unsigned int nLength = 0 )
const;
#endif
/** Retrieve the width of a given text string in 1/1000th mm when /** Retrieve the width of a given text string in 1/1000th mm when
* drawn with the current font * drawn with the current font
* \param pszText a text string of which the width should be calculate d * \param pszText a text string of which the width should be calculate d
* \param nLength if != 0 only the width of the nLength first characte rs is calculated * \param nLength if != 0 only the width of the nLength first characte rs is calculated
* \returns the width in 1/1000th mm * \returns the width in 1/1000th mm
*/ */
unsigned long StringWidthMM( const char* pszText, unsigned int nLength = 0 ) const; unsigned long StringWidthMM( const char* pszText, unsigned int nLength = 0 ) const;
/** Retrieve the width of a given text string in 1/1000th mm when
* drawn with the current font
* \param pszText a text string of which the width should be calculate
d
* \param nLength if != 0 only the width of the nLength first characte
rs is calculated
* \returns the width in 1/1000th mm
*/
unsigned long StringWidthMM( const pdf_utf16be* pszText, unsigned int n
Length = 0 ) const;
#if defined(_MSC_VER) && _MSC_VER <= 1200 // nicht f
#else
/** Retrieve the width of a given text string in 1/1000th mm when
* drawn with the current font
* \param pszText a text string of which the width should be calculate
d
* \param nLength if != 0 only the width of the nLength first characte
rs is calculated
* \returns the width in 1/1000th mm
*/
unsigned long StringWidthMM( const wchar_t* pszText, unsigned int nLeng
th = 0 ) const;
#endif
/** Retrieve the width of the given character in PDF units in the curre nt font /** Retrieve the width of the given character in PDF units in the curre nt font
* \param c character * \param c character
* \returns the width in PDF units * \returns the width in PDF units
*/ */
double CharWidth( unsigned char c ) const; double CharWidth( unsigned char c ) const;
/** Retrieve the width of the given character in 1/1000th mm in the cur rent font /** Retrieve the width of the given character in 1/1000th mm in the cur rent font
* \param c character * \param c character
* \returns the width in 1/1000th mm * \returns the width in 1/1000th mm
*/ */
skipping to change at line 213 skipping to change at line 267
/** Get the length of the actual font data - if it was loaded from memo ry. /** Get the length of the actual font data - if it was loaded from memo ry.
* \returns a the length of the font data * \returns a the length of the font data
*/ */
inline unsigned int GetFontDataLen() const; inline unsigned int GetFontDataLen() const;
/** Get a string with the postscript name of the font. /** Get a string with the postscript name of the font.
* \returns the postscript name of the font or NULL string if no posts cript name is available. * \returns the postscript name of the font or NULL string if no posts cript name is available.
*/ */
const char* GetFontname() const; const char* GetFontname() const;
/**
* \returns NULL or a 6 uppercase letter and "+" sign prefix
* used for font subsets
*/
const char* GetSubsetFontnamePrefix() const;
/** Get the weight of this font. /** Get the weight of this font.
* Used to build the font dictionay * Used to build the font dictionay
* \returns the weight of this font (500 is normal). * \returns the weight of this font (500 is normal).
*/ */
inline unsigned int GetWeight() const; inline unsigned int GetWeight() const;
/** Get the ascent of this font in PDF /** Get the ascent of this font in PDF
* units for the current font size. * units for the current font size.
* *
* \returns the ascender for this font * \returns the ascender for this font
skipping to change at line 358 skipping to change at line 418
std::string m_sFilename; std::string m_sFilename;
PdfRefCountedBuffer m_bufFontData; PdfRefCountedBuffer m_bufFontData;
float m_fFontSize; float m_fFontSize;
float m_fFontScale; float m_fFontScale;
float m_fFontCharSpace; float m_fFontCharSpace;
std::vector<double> m_vecWidth; std::vector<double> m_vecWidth;
EPdfFontType m_eFontType; EPdfFontType m_eFontType;
std::string m_sFontSubsetPrefix;
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
double PdfFontMetrics::StringWidth( const PdfString & rsString ) const double PdfFontMetrics::StringWidth( const PdfString & rsString ) const
{ {
return this->StringWidth( rsString.GetString() ); return (rsString.IsUnicode() ? this->StringWidth( rsString.GetUnicode( ) ) : this->StringWidth( rsString.GetString() ));
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
double PdfFontMetrics::GetLineSpacing() const double PdfFontMetrics::GetLineSpacing() const
{ {
return m_dLineSpacing; return m_dLineSpacing;
} }
 End of changes. 13 change blocks. 
8 lines changed or deleted 83 lines changed or added


 PdfFontSimple.h   PdfFontSimple.h 
skipping to change at line 48 skipping to change at line 48
* 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 ned * \param pEncoding the encoding of this font. The encoding will be ow ned
* by this font and will be deleted along with it. * by this font and will be deleted along with it.
* \param pParent parent of the font object * \param pParent parent of the font object
* *
*/ */
PdfFontSimple( PdfFontMetrics* pMetrics, const PdfEncoding* const pEnco PdfFontSimple( PdfFontMetrics* pMetrics, const PdfEncoding* const pEnco
ding, PdfVecObjects* pParent ); ding,
PdfVecObjects* pParent );
/** Create a PdfFont based on an existing PdfObject
* \param pMetrics pointer to a font metrics object. The font in the P
DF
* file will match this fontmetrics object. The metrics object
is
* deleted along with the font.
* \param pEncoding the encoding of this font. The encoding will be ow
ned
* by this font and will be deleted along with it.
* \param pObject an existing PdfObject
*/
PdfFontSimple( PdfFontMetrics* pMetrics, const PdfEncoding* const pEnco
ding,
PdfObject* pObject );
protected: protected:
/** Initialize this font object. /** Initialize this font object.
* *
* \param bEmbed if true embed the font data into the PDF file. * \param bEmbed if true embed the font data into the PDF file.
* \param rsSubType the subtype of the real font. * \param rsSubType the subtype of the real font.
*/ */
void Init( bool bEmbed, const PdfName & rsSubType ); void Init( bool bEmbed, const PdfName & rsSubType );
/** Embed the font file directly into the PDF file. /** Embed the font file directly into the PDF file.
 End of changes. 1 change blocks. 
2 lines changed or deleted 18 lines changed or added


 PdfFontTrueType.h   PdfFontTrueType.h 
skipping to change at line 47 skipping to change at line 47
/** 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 ownership of this object. * \param pEncoding the encoding of this font. The font will not take ownership of this object.
* \param pParent parent of the font object * \param pParent parent of the font object
* \param bEmbed if true the font will get embedded.
* *
*/ */
PdfFontTrueType( PdfFontMetrics* pMetrics, const PdfEncoding* const pEn
coding,
PdfVecObjects* pParent, bool bEmbed );
PdfFontTrueType( PdfFontMetrics* pMetrics, const PdfEncoding* const pEn /** Create a PdfFont based on an existing PdfObject
coding, PdfVecObjects* pParent ); * \param pMetrics pointer to a font metrics object. The font in the P
DF
* file will match this fontmetrics object. The metrics object
is
* deleted along with the font.
* \param pEncoding the encoding of this font. The font will not take
ownership of this object.
* \param pObject an existing PdfObject
*/
PdfFontTrueType( PdfFontMetrics* pMetrics, const PdfEncoding* const pEn
coding,
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
*/ */
void EmbedFont( PdfObject* pDescriptor ); void EmbedFont( PdfObject* pDescriptor );
}; };
 End of changes. 3 change blocks. 
2 lines changed or deleted 17 lines changed or added


 PdfFontType1.h   PdfFontType1.h 
skipping to change at line 38 skipping to change at line 38
/** A PdfFont implementation that can be used /** A PdfFont implementation that can be used
* to embedd type1 fonts into a PDF file * to embedd type1 fonts into a PDF file
* 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 bEmbed if true the font will get embedded.
* \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 ownership of this object. * \param pEncoding the encoding of this font. The font will not take ownership of this object.
* \param pParent parent of the font object * \param pParent parent of the font object
* \param bEmbed if true the font will get embedded.
* *
*/ */
PdfFontType1( PdfFontMetrics* pMetrics, const PdfEncoding* const pEncod PdfFontType1( PdfFontMetrics* pMetrics, const PdfEncoding* const pEncod
ing, bool bEmbed, PdfVecObjects* pParent ); ing,
PdfVecObjects* pParent, bool bEmbed );
/** Create a PdfFont based on an existing PdfObject
* \param pMetrics pointer to a font metrics object. The font in the P
DF
* file will match this fontmetrics object. The metrics object
is
* deleted along with the font.
* \param pEncoding the encoding of this font. The font will not take
ownership of this object.
* \param pObject an existing PdfObject
*/
PdfFontType1( PdfFontMetrics* pMetrics, const PdfEncoding* const pEncod
ing,
PdfObject* pObject );
protected: protected:
/** 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
*/ */
virtual void EmbedFont( PdfObject* pDescriptor ); virtual void EmbedFont( PdfObject* pDescriptor );
private: private:
 End of changes. 3 change blocks. 
3 lines changed or deleted 18 lines changed or added


 PdfImage.h   PdfImage.h 
skipping to change at line 135 skipping to change at line 135
* \param pStream stream supplieding raw image data * \param pStream stream supplieding raw image data
* \param vecFilters these filters will be applied to compress the ima ge data * \param vecFilters these filters will be applied to compress the ima ge data
*/ */
void SetImageData( unsigned int nWidth, unsigned int nHeight, void SetImageData( unsigned int nWidth, unsigned int nHeight,
unsigned int nBitsPerComponent, PdfInputStream* pStr eam, const TVecFilters & vecFilters ); unsigned int nBitsPerComponent, PdfInputStream* pStr eam, const TVecFilters & vecFilters );
/** Load the image data from a file /** Load the image data from a file
* \param pszFilename * \param pszFilename
*/ */
void LoadFromFile( const char* pszFilename ); void LoadFromFile( const char* pszFilename );
#ifdef PODOFO_HAVE_JPEG_LIB #ifdef PODOFO_HAVE_JPEG_LIB
/** Load the image data from a JPEG file /** Load the image data from a JPEG file
* \param pszFilename * \param pszFilename
*/ */
void LoadFromJpeg( const char* pszFilename ); void LoadFromJpeg( const char* pszFilename );
#ifdef _WIN32
/** Load the image data from a JPEG file
* \param pszFilename
*
* This is an overloaded member function to allow working
* with unicode characters. On Unix systes you can also path
* UTF-8 to the const char* overload.
*/
void LoadFromJpeg( const wchar_t* pszFilename );
#endif // _WIN32
#endif // PODOFO_HAVE_JPEG_LIB #endif // PODOFO_HAVE_JPEG_LIB
#ifdef PODOFO_HAVE_TIFF_LIB #ifdef PODOFO_HAVE_TIFF_LIB
/** Load the image data from a TIFF file /** Load the image data from a TIFF file
* \param pszFilename * \param pszFilename
*/ */
void LoadFromTiff( const char* pszFilename ); void LoadFromTiff( const char* pszFilename );
#endif // PODOFO_HAVE_TIFF_LIB #endif // PODOFO_HAVE_TIFF_LIB
private: private:
/** Set the actual image data from an input stream. /** Set the actual image data from an input stream.
skipping to change at line 169 skipping to change at line 181
void SetImageDataRaw( unsigned int nWidth, unsigned int nHeight, void SetImageDataRaw( unsigned int nWidth, unsigned int nHeight,
unsigned int nBitsPerComponent, PdfInputStream* p Stream ); unsigned int nBitsPerComponent, PdfInputStream* p Stream );
/** Converts a EPdfColorSpace enum to a name key which can be used in a /** Converts a EPdfColorSpace enum to a name key which can be used in a
* PDF dictionary. * PDF dictionary.
* \param eColorSpace a valid colorspace * \param eColorSpace a valid colorspace
* \returns a valid key for this colorspace. * \returns a valid key for this colorspace.
*/ */
static const char* ColorspaceToName( EPdfColorSpace eColorSpace ); static const char* ColorspaceToName( EPdfColorSpace eColorSpace );
private: #ifdef PODOFO_HAVE_JPEG_LIB
void LoadFromJpegHandle( FILE* hInfile, PdfFileInputStream* pInStrea
m );
#endif // PODOFO_HAVE_JPEG_LIB
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline double PdfImage::GetWidth() const inline double PdfImage::GetWidth() const
{ {
return this->GetPageSize().GetWidth(); return this->GetPageSize().GetWidth();
} }
 End of changes. 3 change blocks. 
1 lines changed or deleted 16 lines changed or added


 PdfInfo.h   PdfInfo.h 
skipping to change at line 104 skipping to change at line 104
/** Set the title of the document. /** Set the title of the document.
* \param sTitle title * \param sTitle title
*/ */
void SetTitle( const PdfString & sTitle ); void SetTitle( const PdfString & sTitle );
/** Get the title of the document /** Get the title of the document
* \returns the title * \returns the title
*/ */
inline const PdfString & GetTitle() const; inline const PdfString & GetTitle() const;
// Peter Petrov 27 April 2008
/** Set the producer of the document.
* \param sProducer producer
*/
void SetProducer( const PdfString & sProducer );
// Peter Petrov 27 April 2008
/** Get the producer of the document
* \returns the producer
*/
inline const PdfString & GetProducer() const;
/** Set the trapping state of the document.
* \param sTitle title
*/
void SetTrapped( const PdfName & sTrapped );
/** Get the trapping state of the document
* \returns the title
*/
inline const PdfName & GetTrapped() const;
private: private:
/** Add the initial document information to the dictionary. /** Add the initial document information to the dictionary.
* \param bModify if true a ModDate will be added instead * \param bModify if true a ModDate will be added instead
* of a CreationDate. * of a CreationDate.
*/ */
void Init( bool bModify = false ); void Init( bool bModify = false );
/** 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
*/ */
const PdfString & GetStringFromInfoDict( const PdfName & rName ) const; const PdfString & GetStringFromInfoDict( const PdfName & rName ) const;
/** Get a value from the info dictionary as name
* \para rName the key to fetch from the info dictionary
* \return a value from the info dictionary
*/
const PdfName & GetNameFromInfoDict( const PdfName & rName ) const;
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
const PdfString & PdfInfo::GetAuthor() const const PdfString & PdfInfo::GetAuthor() const
{ {
return this->GetStringFromInfoDict( PdfName("Author") ); return this->GetStringFromInfoDict( PdfName("Author") );
} }
skipping to change at line 159 skipping to change at line 187
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
const PdfString & PdfInfo::GetTitle() const const PdfString & PdfInfo::GetTitle() const
{ {
return this->GetStringFromInfoDict( PdfName("Title") ); return this->GetStringFromInfoDict( PdfName("Title") );
} }
// -----------------------------------------------------
//
// -----------------------------------------------------
const PdfString & PdfInfo::GetProducer() const
{
return this->GetStringFromInfoDict( PdfName("Producer") );
}
// -----------------------------------------------------
//
// -----------------------------------------------------
const PdfName & PdfInfo::GetTrapped() const
{
return this->GetNameFromInfoDict( PdfName("Trapped") );
}
}; };
#endif // _PDF_INFO_H_ #endif // _PDF_INFO_H_
 End of changes. 3 change blocks. 
0 lines changed or deleted 44 lines changed or added


 PdfInputDevice.h   PdfInputDevice.h 
skipping to change at line 48 skipping to change at line 48
class PODOFO_API PdfInputDevice { class PODOFO_API PdfInputDevice {
public: public:
/** Construct a new PdfInputDevice that reads all data from a file. /** Construct a new PdfInputDevice that reads all data from a file.
* *
* \param pszFilename path to a file that will be opened and all data * \param pszFilename path to a file that will be opened and all data
* is read from this file. * is read from this file.
*/ */
PdfInputDevice( const char* pszFilename ); PdfInputDevice( const char* pszFilename );
#ifdef _WIN32
#if defined(_MSC_VER) && _MSC_VER <= 1200 // nicht f
#else
/** Construct a new PdfInputDevice that reads all data from a file.
*
* \param pszFilename path to a file that will be opened and all data
* is read from this file.
*
* This is an overloaded member function to allow working
* with unicode characters. On Unix systes you can also path
* UTF-8 to the const char* overload.
*/
PdfInputDevice( const wchar_t* pszFilename );
#endif
#endif // _WIN32
/** Construct a new PdfInputDevice that reads all data from a memory bu ffer. /** Construct a new PdfInputDevice that reads all data from a memory bu ffer.
* The buffer will not be owned by this object - it is COPIED. * The buffer will not be owned by this object - it is COPIED.
* *
* \param pBuffer a buffer in memory * \param pBuffer a buffer in memory
* \param lLen the length of the buffer in memory * \param lLen the length of the buffer in memory
*/ */
PdfInputDevice( const char* pBuffer, long lLen ); PdfInputDevice( const char* pBuffer, long lLen );
/** Construct a new PdfInputDevice that reads all data from a std::istr eam. /** Construct a new PdfInputDevice that reads all data from a std::istr eam.
* *
skipping to change at line 145 skipping to change at line 161
* However subclasses may well need to do just that. * However subclasses may well need to do just that.
*/ */
PdfInputDevice(); PdfInputDevice();
private: private:
/** Initialize all private members /** Initialize all private members
*/ */
void Init(); void Init();
private: private:
std::istream* m_pStream; std::istream* m_pStream;
bool m_StreamOwned; bool m_StreamOwned;
bool m_bIsSeekable; bool m_bIsSeekable;
}; };
bool PdfInputDevice::IsSeekable() const bool PdfInputDevice::IsSeekable() const
{ {
return m_bIsSeekable; return m_bIsSeekable;
} }
void PdfInputDevice::SetSeekable(bool bIsSeekable) void PdfInputDevice::SetSeekable(bool bIsSeekable)
{ {
m_bIsSeekable = bIsSeekable; m_bIsSeekable = bIsSeekable;
 End of changes. 2 change blocks. 
3 lines changed or deleted 19 lines changed or added


 PdfInputStream.h   PdfInputStream.h 
skipping to change at line 61 skipping to change at line 61
/** An input stream that reads data from a file /** An input stream that reads data from a file
*/ */
class PODOFO_API PdfFileInputStream : public PdfInputStream { class PODOFO_API PdfFileInputStream : public PdfInputStream {
public: public:
/** Open a file for reading data /** Open a file for reading data
* *
* \param pszFilename the filename of the file to read * \param pszFilename the filename of the file to read
*/ */
PdfFileInputStream( const char* pszFilename ); PdfFileInputStream( const char* pszFilename );
#ifdef _WIN32
/** Open a file for reading data
*
* \param pszFilename the filename of the file to read
*
* This is an overloaded member function to allow working
* with unicode characters. On Unix systes you can also path
* UTF-8 to the const char* overload.
*/
PdfFileInputStream( const wchar_t* pszFilename );
#endif // _WIN32
~PdfFileInputStream(); ~PdfFileInputStream();
/** Read data from the input stream /** Read data from the input stream
* *
* \param pBuffer the data will be stored into this buffer * \param pBuffer the data will be stored into this buffer
* \param lLen the size of the buffer and number of bytes * \param lLen the size of the buffer and number of bytes
* that will be read * that will be read
* *
* \returns the number of bytes read, -1 if an error ocurred * \returns the number of bytes read, -1 if an error ocurred
* and zero if no more bytes are available for reading. * and zero if no more bytes are available for reading.
 End of changes. 1 change blocks. 
0 lines changed or deleted 13 lines changed or added


 PdfMemDocument.h   PdfMemDocument.h 
skipping to change at line 84 skipping to change at line 84
* \param pszFilename filename of the file which is going to be parsed /opened * \param pszFilename filename of the file which is going to be parsed /opened
* *
* This might throw a PdfError( ePdfError_InvalidPassword ) exception * This might throw a PdfError( ePdfError_InvalidPassword ) exception
* if a password is required to read this PDF. * if a password is required to read this PDF.
* Call SetPassword with the correct password in this case. * Call SetPassword with the correct password in this case.
* *
* \see SetPassword * \see SetPassword
*/ */
PdfMemDocument( const char* pszFilename ); PdfMemDocument( const char* pszFilename );
#ifdef _WIN32
#if defined(_MSC_VER) && _MSC_VER <= 1200 // nicht f
#else
/** Construct a PdfMemDocument from an existing PDF (on disk)
* \param pszFilename filename of the file which is going to be parsed
/opened
*
* This might throw a PdfError( ePdfError_InvalidPassword ) exception
* if a password is required to read this PDF.
* Call SetPassword with the correct password in this case.
*
* This is an overloaded member function to allow working
* with unicode characters. On Unix systes you can also path
* UTF-8 to the const char* overload.
*
* \see SetPassword
*/
PdfMemDocument( const wchar_t* pszFilename );
#endif
#endif // _WIN32
/** Close down/destruct the PdfMemDocument /** Close down/destruct the PdfMemDocument
*/ */
virtual ~PdfMemDocument(); virtual ~PdfMemDocument();
/** Load a PdfMemDocument from a file /** Load a PdfMemDocument from a file
* *
* \param pszFilename filename of the file which is going to be parsed /opened * \param pszFilename filename of the file which is going to be parsed /opened
* *
* This might throw a PdfError( ePdfError_InvalidPassword ) exception * This might throw a PdfError( ePdfError_InvalidPassword ) exception
* if a password is required to read this PDF. * if a password is required to read this PDF.
* Call SetPassword with the correct password in this case. * Call SetPassword with the correct password in this case.
* *
* \see SetPassword * \see SetPassword
*/ */
void Load( const char* pszFilename ); void Load( const char* pszFilename );
#ifdef _WIN32
#if defined(_MSC_VER) && _MSC_VER <= 1200 // nicht f
#else
/** Load a PdfMemDocument from a file
*
* \param pszFilename filename of the file which is going to be parsed
/opened
*
* This might throw a PdfError( ePdfError_InvalidPassword ) exception
* if a password is required to read this PDF.
* Call SetPassword with the correct password in this case.
*
* This is an overloaded member function to allow working
* with unicode characters. On Unix systes you can also path
* UTF-8 to the const char* overload.
*
* \see SetPassword
*/
void Load( const wchar_t* pszFilename );
#endif
#endif // _WIN32
/** Load a PdfMemDocument from a buffer in memory /** Load a PdfMemDocument from a buffer in memory
* *
* \param pBuffer a memory area containing the PDF data * \param pBuffer a memory area containing the PDF data
* \param lLen length of the buffer * \param lLen length of the buffer
* *
* This might throw a PdfError( ePdfError_InvalidPassword ) exception * This might throw a PdfError( ePdfError_InvalidPassword ) exception
* if a password is required to read this PDF. * if a password is required to read this PDF.
* Call SetPassword with the correct password in this case. * Call SetPassword with the correct password in this case.
* *
* \see SetPassword * \see SetPassword
skipping to change at line 135 skipping to change at line 176
/** Writes the complete document to a file /** Writes the complete document to a file
* *
* \param pszFilename filename of the document * \param pszFilename filename of the document
* *
* \see Write * \see Write
* *
* This is an overloaded member function for your convinience. * This is an overloaded member function for your convinience.
*/ */
void Write( const char* pszFilename ); void Write( const char* pszFilename );
#ifdef _WIN32
/** Writes the complete document to a file
*
* \param pszFilename filename of the document
*
* \see Write
*
* This is an overloaded member function to allow working
* with unicode characters. On Unix systes you can also path
* UTF-8 to the const char* overload.
*
* This is an overloaded member function for your convinience.
*/
void Write( const wchar_t* pszFilename );
#endif // _WIN32
/** Writes the complete document to an output device /** Writes the complete document to an output device
* *
* \param pDevice write to this output device * \param pDevice write to this output device
*/ */
void Write( PdfOutputDevice* pDevice ); void Write( PdfOutputDevice* pDevice );
/** Set the PDF Version of the document. Has to be called before Write( ) to /** Set the PDF Version of the document. Has to be called before Write( ) to
* have an effect. * have an effect.
* \param eVersion version of the pdf document * \param eVersion version of the pdf document
*/ */
skipping to change at line 254 skipping to change at line 311
/** Get access to the StructTreeRoot dictionary /** Get access to the StructTreeRoot dictionary
* \returns PdfObject the StructTreeRoot dictionary * \returns PdfObject the StructTreeRoot dictionary
*/ */
PdfObject* GetStructTreeRoot() const { return GetNamedObjectFromCatalog ( "StructTreeRoot" ); } PdfObject* GetStructTreeRoot() const { return GetNamedObjectFromCatalog ( "StructTreeRoot" ); }
/** 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" ); }
/** Creates a PdfFont object from an existing font.
*
* \param pObject a PdfObject that is a font
* \returns PdfFont* a pointer to a new PdfFont object.
* The returned object is owned by the PdfDocument.
*/
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
* \param rDoc the document to append * \param rDoc the document to append
* \param inFirstPage the first page number to copy (0-based) * \param inFirstPage the first page number to copy (0-based)
* \param inNumPages the number of pages to copy * \param inNumPages the number of pages to copy
* \returns this document * \returns this document
*/ */
const PdfMemDocument & InsertPages( const PdfMemDocument & rDoc, int in FirstPage, int inNumPages ); const PdfMemDocument & InsertPages( const PdfMemDocument & rDoc, int in FirstPage, int inNumPages );
/** Deletes one or more pages from this document /** Deletes one or more pages from this document
* \param inFirstPage the first page number to delete (0-based) * \param inFirstPage the first page number to delete (0-based)
skipping to change at line 341 skipping to change at line 407
/** 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 virtual bool IsHighPrintAllowed() const; inline virtual bool IsHighPrintAllowed() const;
/** Tries to free all memory allocated by the given
* PdfObject (variables and streams) and reads
* it from disk again if it is requested another time.
*
* This will only work if load on demand is used. Other-
* wise any call to this method will be ignored. Load on
* demand is currently always enabled when using PdfMemDocument.
* If the object is dirty if will not be free'd.
*
* \param rRef free all memory allocated by the object
* with this reference.
* \param bForce if true the object will be free'd
* even if IsDirty() returns true.
* So you will loose any changes made
* to this object.
*
* This is an overloaded member for your convinience.
*/
void FreeObjectMemory( const PdfReference & rRef, bool bForce = false )
;
/** Tries to free all memory allocated by the given
* PdfObject (variables and streams) and reads
* it from disk again if it is requested another time.
*
* This will only work if load on demand is used. Other-
* wise any call to this method will be ignored. Load on
* demand is currently always enabled when using PdfMemDocument.
* If the object is dirty if will not be free'd.
*
* \param pObj free object from memory
* \param bForce if true the object will be free'd
* even if IsDirty() returns true.
* So you will loose any changes made
* to this object.
*
* \see IsDirty
*/
void FreeObjectMemory( PdfObject* pObj, bool bForce = false );
private: private:
/** Get a dictioary from the catalog dictionary by its name. /** Get a dictioary from the catalog dictionary by its name.
* \param pszName will be converted into a PdfName * \param pszName will be converted into a PdfName
* \returns the dictionary if it was found or NULL * \returns the dictionary if it was found or NULL
*/ */
PdfObject* GetNamedObjectFromCatalog( const char* pszName ) const; PdfObject* GetNamedObjectFromCatalog( const char* pszName ) const;
/** Internal method to load all objects from a PdfParser object. /** Internal method to load all objects from a PdfParser object.
* The objects will be removed from the parser and are now * The objects will be removed from the parser and are now
* owned by the PdfMemDocument. * owned by the PdfMemDocument.
*/ */
void InitFromParser( PdfParser* pParser ); void InitFromParser( PdfParser* pParser );
/** Clear all internal variables /** Clear all internal variables
*/ */
void Clear(); void Clear();
/** Recursively changes every PdfReference in the PdfObject and in any
child
* that is either an PdfArray or a direct object.
* The reference is changed so that difference is added to the object
number
* if the reference.
* \param pObject object to change
* \param difference add this value to every reference that is encount
ered
*/
void FixObjectReferences( PdfObject* pObject, int difference );
/** Low level APIs for setting a viewer preference /** Low level APIs for setting a viewer preference
* \param whichPrefs the dictionary key to set * \param whichPrefs the dictionary key to set
* \param the object to be set * \param the object to be set
*/ */
void SetViewerPreference( const PdfName& whichPref, const PdfObject & v alueObj ) const; void SetViewerPreference( const PdfName& whichPref, const PdfObject & v alueObj ) const;
void SetViewerPreference( const PdfName& whichPref, bool inValue ) cons t; void SetViewerPreference( const PdfName& whichPref, bool inValue ) cons t;
private: private:
// Prevent use of copy constructor and assignment operator. These meth ods // Prevent use of copy constructor and assignment operator. These meth ods
// should never be referenced (given that code referencing them outside // should never be referenced (given that code referencing them outside
 End of changes. 6 change blocks. 
12 lines changed or deleted 108 lines changed or added


 PdfNamesTree.h   PdfNamesTree.h 
skipping to change at line 102 skipping to change at line 102
/** /**
* Adds all keys and values from a name tree to a dictionary. * Adds all keys and values from a name tree to a dictionary.
* Removes all keys that have been previously in the dictionary. * Removes all keys that have been previously in the dictionary.
* *
* \param tree the name of the tree to convert into a dictionary * \param tree the name of the tree to convert into a dictionary
* \param rDict add all keys and values to this dictionary * \param rDict add all keys and values to this dictionary
*/ */
void ToDictionary( const PdfName & dictionary, PdfDictionary& rDict ); void ToDictionary( const PdfName & dictionary, PdfDictionary& rDict );
/** Peter Petrov: 23 May 2008
* I have made it for access to "JavaScript" dictonary. This is "docume
nt-level javascript storage"
*/
inline PdfObject* GetJavaScriptNode() const;
/** Peter Petrov: 6 June 2008
* I have made it for access to "Dest" dictionary. This is "document-le
vel named destination storage"
*/
inline PdfObject* GetDestsNode() const;
private: private:
/** Get a PdfNameTrees root node for a certain name. /** Get a PdfNameTrees root node for a certain name.
* \param name that identifies a specific name tree. * \param name that identifies a specific name tree.
* Valid names are: * Valid names are:
* - Dests * - Dests
* - AP * - AP
* - JavaScript * - JavaScript
* - Pages * - Pages
* - Templates * - Templates
* - IDS * - IDS
skipping to change at line 140 skipping to change at line 150
* Add all keys and values from an object and its children to a dictio nary. * Add all keys and values from an object and its children to a dictio nary.
* \param pObj a pdf name tree node * \param pObj a pdf name tree node
* \param rDict a dictionary * \param rDict a dictionary
*/ */
void AddToDictionary( PdfObject* pObj, PdfDictionary & rDict ); void AddToDictionary( PdfObject* pObj, PdfDictionary & rDict );
private: private:
PdfObject* m_pCatalog; PdfObject* m_pCatalog;
}; };
// -----------------------------------------------------
//
// -----------------------------------------------------
PdfObject* PdfNamesTree::GetJavaScriptNode() const
{
return this->GetRootNode( PdfName("JavaScript") );
}
// -----------------------------------------------------
//
// -----------------------------------------------------
PdfObject* PdfNamesTree::GetDestsNode() const
{
return this->GetRootNode( PdfName("Dests") );
}
}; };
#endif // _PDF_NAMES_TREE_H_ #endif // _PDF_NAMES_TREE_H_
 End of changes. 2 change blocks. 
0 lines changed or deleted 28 lines changed or added


 PdfObject.h   PdfObject.h 
skipping to change at line 190 skipping to change at line 190
/** Get a indirect reference to this object /** Get a indirect reference to this object
* \returns a PdfReference pointing to this object. * \returns a PdfReference pointing to this object.
*/ */
inline const PdfReference & Reference() const; inline const PdfReference & Reference() const;
/** Get a handle to a PDF stream object /** Get a handle to a PDF stream object
* If the PDF object does not have a stream, * If the PDF object does not have a stream,
* one will be created. * one will be created.
* \returns a PdfStream object * \returns a PdfStream object
*
* This will set the dirty flag of this object.
* \see IsDirty
*/ */
PdfStream* GetStream(); PdfStream* GetStream();
/** Get a handle to a const PDF stream object /** Get a handle to a const PDF stream object
* If the PDF object does not have a stream, * If the PDF object does not have a stream,
* null is returned * null is returned
* \returns a PdfStream object or null * \returns a PdfStream object or null
*/ */
const PdfStream* GetStream() const; const PdfStream* GetStream() const;
skipping to change at line 300 skipping to change at line 303
/** Load the stream of the object if it has one and if delayed loading is enabled. /** Load the stream of the object if it has one and if delayed loading is enabled.
* *
* You should override this to control deferred stream loading in your subclass. * You should override this to control deferred stream loading in your subclass.
* *
* Never call this method directly; use DelayedStreamLoad() instead. * Never call this method directly; use DelayedStreamLoad() instead.
*/ */
inline virtual void DelayedStreamLoadImpl(); inline virtual void DelayedStreamLoadImpl();
/** Same as GetStream() but won't trigger a delayed load, so it's safe /** Same as GetStream() but won't trigger a delayed load, so it's safe
* for use while a delayed load is in progress. * for use while a delayed load is in progress.
*
* This will set the dirty flag of this object.
* \see IsDirty
*/ */
PdfStream* GetStream_NoDL(); PdfStream* GetStream_NoDL();
protected: protected:
PdfReference m_reference; PdfReference m_reference;
PdfStream* m_pStream; PdfStream* m_pStream;
PdfVecObjects* m_pOwner; PdfVecObjects* m_pOwner;
PODOFO_NOTHROW inline bool DelayedStreamLoadDone() const; PODOFO_NOTHROW inline bool DelayedStreamLoadDone() const;
 End of changes. 2 change blocks. 
0 lines changed or deleted 6 lines changed or added


 PdfOutputDevice.h   PdfOutputDevice.h 
skipping to change at line 58 skipping to change at line 58
*/ */
PdfOutputDevice(); PdfOutputDevice();
/** Construct a new PdfOutputDevice that writes all data to a file. /** Construct a new PdfOutputDevice that writes all data to a file.
* *
* \param pszFilename path to a file that will be opened and all data * \param pszFilename path to a file that will be opened and all data
* is written to this file. * is written to this file.
*/ */
PdfOutputDevice( const char* pszFilename ); PdfOutputDevice( const char* pszFilename );
#ifdef _WIN32
/** Construct a new PdfOutputDevice that writes all data to a file.
*
* \param pszFilename path to a file that will be opened and all data
* is written to this file.
*
* This is an overloaded member function to allow working
* with unicode characters. On Unix systes you can also path
* UTF-8 to the const char* overload.
*/
PdfOutputDevice( const wchar_t* pszFilename );
#endif // _WIN32
/** Construct a new PdfOutputDevice that writes all data to a memory bu ffer. /** Construct a new PdfOutputDevice that writes all data to a memory bu ffer.
* The buffer will not be owned by this object and has to be allocated before. * The buffer will not be owned by this object and has to be allocated before.
* *
* \param pBuffer a buffer in memory * \param pBuffer a buffer in memory
* \param lLen the length of the buffer in memory * \param lLen the length of the buffer in memory
*/ */
PdfOutputDevice( char* pBuffer, long lLen ); PdfOutputDevice( char* pBuffer, long lLen );
/** Construct a new PdfOutputDevice that writes all data to a std::ostr eam. /** Construct a new PdfOutputDevice that writes all data to a std::ostr eam.
* *
skipping to change at line 95 skipping to change at line 108
/** The number of bytes written to this object. /** The number of bytes written to this object.
* \returns the number of bytes written to this object. * \returns the number of bytes written to this object.
* *
* \see Init * \see Init
*/ */
virtual inline unsigned long GetLength() const; virtual inline unsigned long GetLength() const;
/** Write to the PdfOutputDevice. Usage is as the usage of printf. /** Write to the PdfOutputDevice. Usage is as the usage of printf.
* *
* WARNING: Do not use this for doubles or floating point values
* as the output might depend on the current locale.
*
* \param pszFormat a format string as you would use it with printf * \param pszFormat a format string as you would use it with printf
* \returns ErrOk on success * \returns ErrOk on success
* *
* \see Write * \see Write
*/ */
virtual void Print( const char* pszFormat, ... ); virtual void Print( const char* pszFormat, ... );
/** Write data to the buffer. Use this call instead of Print if you /** Write data to the buffer. Use this call instead of Print if you
* want to write binary data to the PdfOutputDevice. * want to write binary data to the PdfOutputDevice.
* *
 End of changes. 2 change blocks. 
0 lines changed or deleted 16 lines changed or added


 PdfPage.h   PdfPage.h 
skipping to change at line 58 skipping to change at line 58
class PODOFO_API PdfPage : public PdfElement, public PdfCanvas { class PODOFO_API PdfPage : public PdfElement, public PdfCanvas {
public: public:
/** Create a new PdfPage object. /** Create a new PdfPage object.
* \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
* \param pParent add the page to this parent * \param pParent add the page to this parent
*/ */
PdfPage( const PdfRect & rSize, PdfVecObjects* pParent ); PdfPage( const PdfRect & rSize, PdfVecObjects* pParent );
/** Create a PdfPage based on an existing PdfObject /** Create a PdfPage based on an existing PdfObject
* \param pObject an existing PdfObject * \param pObject an existing PdfObject
* \param listOfParents a list of PdfObjects that are
* parents of this page and can be
* queried for inherited attributes.
* The last object in the list is the
* most direct parent of this page.
*/ */
PdfPage( PdfObject* pObject ); PdfPage( PdfObject* pObject, const std::deque<PdfObject*> & listOfParen ts );
virtual ~PdfPage(); virtual ~PdfPage();
/** Get the current page size in PDF Units /** Get the current page size in PDF Units
* \returns a PdfRect containing the page size available for drawing * \returns a PdfRect containing the page size available for drawing
*/ */
inline virtual const PdfRect GetPageSize() const; inline virtual const PdfRect GetPageSize() const;
/** Page number inside of the document. The first page /** Page number inside of the document. The first page
* has the number 1, the last page has the number * has the number 1, the last page has the number
skipping to change at line 196 skipping to change at line 201
/** Get a PdfField with a certain index. /** Get a PdfField with a certain index.
* \param index of the PdfField (must be smaller than GetNumFields() ) * \param index of the PdfField (must be smaller than GetNumFields() )
* *
* \see GetNumFields * \see GetNumFields
* *
* \returns a constP dfField * \returns a constP dfField
*/ */
const PdfField GetField( int index ) const; const PdfField GetField( int index ) const;
/** Get an element from the pages resources dictionary,
* using a type (category) and a key.
*
* \param rType the type of resource to fetch (e.g. /Font, or /XObject
)
* \param rKey the key of the resource
*
* \returns the object of the resource or NULL if it was not found
*/
PdfObject* GetFromResources( const PdfName & rType, const PdfName & rKe
y );
private: private:
/** Get the bounds of a specified page box in PDF units. /** Get the bounds of a specified page box in PDF units.
* This function is internal, since there are wrappers for all standard boxes * This function is internal, since there are wrappers for all standard boxes
* \returns PdfRect the page box * \returns PdfRect the page box
*/ */
const PdfRect GetPageBox( const char* inBox ) const; const PdfRect GetPageBox( const char* inBox ) const;
/** Private method for getting a key value that could be inherited (suc h as the boxes, resources, etc.) /** Private method for getting a key value that could be inherited (suc h as the boxes, resources, etc.)
* \returns PdfVariant - the result of the key fetching * \returns PdfVariant - the result of the key fetching
*/ */
 End of changes. 3 change blocks. 
1 lines changed or deleted 18 lines changed or added


 PdfPagesTree.h   PdfPagesTree.h 
skipping to change at line 34 skipping to change at line 34
#include "PdfArray.h" #include "PdfArray.h"
#include "PdfDefines.h" #include "PdfDefines.h"
#include "PdfElement.h" #include "PdfElement.h"
namespace PoDoFo { namespace PoDoFo {
class PdfObject; class PdfObject;
class PdfPage; class PdfPage;
class PdfRect; class PdfRect;
typedef std::deque< PdfPage* > PdfPageObjects;
typedef enum { typedef enum {
PageInsertBeforeFirstPage = -1, PageInsertBeforeFirstPage = -1,
PageInsertLastPage = -2, PageInsertLastPage = -2,
PageInsertAllPages = -3, PageInsertAllPages = -3,
PageInsertOddPagesOnly = -4, PageInsertOddPagesOnly = -4,
PageInsertEvenPagesOnly = -5 PageInsertEvenPagesOnly = -5
} PageInsertionPoints; } PageInsertionPoints;
/** Class for managing the tree of Pages in a PDF document /** Class for managing the tree of Pages in a PDF document
* Don't use this class directly. Use PdfDocument instead. * Don't use this class directly. Use PdfDocument instead.
* *
* \see PdfDocument * \see PdfDocument
*/ */
class PODOFO_API PdfPagesTree : public PdfElement class PODOFO_API PdfPagesTree : public PdfElement
{ {
typedef std::deque< PdfPage* > PdfPageObjects;
public: public:
/** Construct a new PdfPagesTree /** Construct a new PdfPagesTree
*/ */
PdfPagesTree( PdfVecObjects* pParent ); PdfPagesTree( PdfVecObjects* pParent );
/** Construct a PdfPagesTree from the root /Pages object /** Construct a PdfPagesTree from the root /Pages object
* \param pPagesRoot pointer to page tree dictionary * \param pPagesRoot pointer to page tree dictionary
*/ */
PdfPagesTree( PdfObject* pPagesRoot ); PdfPagesTree( PdfObject* pPagesRoot );
skipping to change at line 115 skipping to change at line 114
* 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 );
/** Delete the specified page object from the internal pages tree. /** Delete the specified page object from the internal pages tree.
* It does NOT remove anything from memory - just the reference from * It does NOT remove any PdfObjects from memory - just the reference
the tree 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!
*/ */
void DeletePage( int inPageNumber ); void DeletePage( int inPageNumber );
private: private:
PdfPagesTree(); // don't allow construction from nothing! PdfPagesTree(); // don't allow construction from nothing!
/** Private method for actually traversing the /Pages tree /** Private method for actually traversing the /Pages tree
*
* \param rListOfParents all parents of the page node will be added to
this lists,
* so that the PdfPage can later access inherite
d attributes
*/ */
PdfObject* GetPageNode( int nPageNum, PdfObject* pPagesObject ); PdfObject* GetPageNode( int nPageNum, PdfObject* pPagesObject, std::deq ue<PdfObject*> & rListOfParents );
/** Private method for actually traversing the /Pages tree /** Private method for actually traversing the /Pages tree
* This method directly traverses the tree and does no * This method directly traverses the tree and does no
* optimization for nodes with only one element like GetPageNode does. * optimization for nodes with only one element like GetPageNode does.
*
* \param rListOfParents all parents of the page node will be added to
this lists,
* so that the PdfPage can later access inherite
d attributes
*/ */
PdfObject* GetPageNodeFromTree( int nPageNum, const PdfArray & kidsArra y ); PdfObject* GetPageNodeFromTree( int nPageNum, const PdfArray & kidsArra y, std::deque<PdfObject*> & rListOfParents );
/** Private method to access the Root of the tree using a logical name /** Private method to access the Root of the tree using a logical name
*/ */
PdfObject* GetRoot() { return m_pObject; } PdfObject* GetRoot() { return m_pObject; }
const PdfObject* GetRoot() const { return m_pObject; } const PdfObject* GetRoot() const { return m_pObject; }
/** Private method for getting the Parent of a node in the /Pages tree /** Private method for getting the Parent of a node in the /Pages tree
*/ */
static PdfObject* GetParent( PdfObject* inObject ); static PdfObject* GetParent( PdfObject* inObject );
 End of changes. 8 change blocks. 
7 lines changed or deleted 18 lines changed or added


 PdfPainter.h   PdfPainter.h 
skipping to change at line 377 skipping to change at line 377
/** 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 eAlignmet alignment of the text line * \param eAlignmet 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 );
/** Begin drawing multiple text strings on a page using a given font ob
ject.
* You have to call SetFont before calling this function.
*
* If you want more simpler text output and do not need
* the advanced text position features of MoveTextPos
* use DrawText which is easier.
*
* \param dX the x coordinate
* \param dY the y coordinate
*
* \see SetFont()
* \see AddText()
* \see MoveTextPos()
* \see EndText()
*/
void BeginText( double dX, double dY );
/** Draw a string on a page.
* You have to call BeginText before the first call of this function
* and EndText after the last call.
*
* If you want more simpler text output and do not need
* the advanced text position features of MoveTextPos
* use DrawText which is easier.
*
* \param sText the text string which should be printed
*
* \see SetFont()
* \see MoveTextPos()
* \see EndText()
*/
void AddText( const PdfString & sText );
/** Draw a string on a page.
* You have to call BeginText before the first call of this function
* and EndText after the last call.
*
* If you want more simpler text output and do not need
* the advanced text position features of MoveTextPos
* use DrawText which is easier.
*
* \param sText the text string which should be printed
* \param lLen draw only lLen characters of pszText
*
* \see SetFont()
* \see MoveTextPos()
* \see EndText()
*/
void AddText( const PdfString & sText, long lStringLen );
/** Move position for text drawing on a page.
* You have to call BeginText before calling this function
*
* If you want more simpler text output and do not need
* the advanced text position features of MoveTextPos
* use DrawText which is easier.
*
* \param dX the x offset relative to pos of BeginText or last MoveTex
tPos
* \param dY the y offset relative to pos of BeginText or last MoveTex
tPos
*
* \see BeginText()
* \see AddText()
* \see EndText()
*/
void MoveTextPos( double dX, double dY );
/** End drawing multiple text strings on a page
*
* If you want more simpler text output and do not need
* the advanced text position features of MoveTextPos
* use DrawText which is easier.
*
* \see BeginText()
* \see AddText()
* \see MoveTextPos()
*/
void EndText();
/** Draw an image on the current page. /** Draw an image on the current page.
* \param dX the x coordinate (bottom left position of the image) * \param dX the x coordinate (bottom left position of the image)
* \param dY the y coordinate (bottom position of the image) * \param dY the y coordinate (bottom position of the image)
* \param pObject an PdfXObject * \param pObject an PdfXObject
* \param dScaleX option scaling factor in x direction * \param dScaleX option scaling factor in x direction
* \param dScaleY option scaling factor in y direction * \param dScaleY option scaling factor in y direction
*/ */
void DrawImage( double dX, double dY, PdfImage* pObject, double dScaleX = 1.0, double dScaleY = 1.0); void DrawImage( double dX, double dY, PdfImage* pObject, double dSca leX = 1.0, double dScaleY = 1.0);
/** Draw an XObject on the current page. For PdfImage use DrawImage. /** Draw an XObject on the current page. For PdfImage use DrawImage.
* *
* \param dX the x coordinate (bottom left position of the XObject) * \param dX the x coordinate (bottom left position of the XObject)
* \param dY the y coordinate (bottom position of the XObject) * \param dY the y coordinate (bottom position of the XObject)
* \param pObject an PdfXObject * \param pObject an PdfXObject
* \param dScaleX option scaling factor in x direction * \param dScaleX option scaling factor in x direction
* \param dScaleY option scaling factor in y direction * \param dScaleY option scaling factor in y direction
* *
* \see DrawImage * \see DrawImage
skipping to change at line 632 skipping to change at line 710
/** Expand all tab characters in a string /** Expand all tab characters in a string
* using spaces. * using spaces.
* *
* \param rsString expand all tabs in this string using spaces * \param rsString expand all tabs in this string using spaces
* \param lLen use only lLen characters of rsString * \param lLen use only lLen characters of rsString
* \returns an expanded copy of the passed string * \returns an expanded copy of the passed string
* \see SetTabWidth * \see SetTabWidth
*/ */
PdfString ExpandTabs( const PdfString & rsString, long lLen ) const; PdfString ExpandTabs( const PdfString & rsString, long lLen ) const;
#if defined(_MSC_VER) && _MSC_VER <= 1200 // MSC 6.0 has a template-bu
g
PdfString ExpandTabs_char( const char* pszText, long lStringLen, int nT
abCnt, const char cTab, const char cSpace ) const;
PdfString ExpandTabs_pdf_utf16be( const pdf_utf16be* pszText, long lStr
ingLen, int nTabCnt, const pdf_utf16be cTab, const pdf_utf16be cSpace ) con
st;
#else
template<typename C> template<typename C>
PdfString ExpandTabsPrivate( const C* pszText, long lStringLen, int nTabCnt, const C cTab, const C cSpace ) const; PdfString ExpandTabsPrivate( const C* pszText, long lStringLen, int nTabCnt, const C cTab, const C cSpace ) const;
#endif
protected: protected:
/** All drawing operations work on this stream. /** All drawing operations work on this stream.
* This object may not be NULL. If it is NULL any function accessing i t should * This object may not be NULL. If it is NULL any function accessing i t should
* return ERROR_PDF_INVALID_HANDLE * return ERROR_PDF_INVALID_HANDLE
*/ */
PdfStream* m_pCanvas; PdfStream* m_pCanvas;
/** The page object is needed so that fonts etc. can be added /** The page object is needed so that fonts etc. can be added
* to the page resource dictionary as appropriate. * to the page resource dictionary as appropriate.
skipping to change at line 664 skipping to change at line 747
unsigned short m_nTabWidth; unsigned short m_nTabWidth;
/** The current color space for non stroking colors /** The current color space for non stroking colors
*/ */
EPdfColorSpace m_eCurColorSpace; EPdfColorSpace m_eCurColorSpace;
/** Save the current color /** Save the current color
*/ */
double m_curColor1, m_curColor2, m_curColor3, m_curColor4; double m_curColor1, m_curColor2, m_curColor3, m_curColor4;
/** Is between BT and ET
*/
bool m_isTextOpen;
/** temporary stream buffer /** temporary stream buffer
*/ */
std::ostringstream m_oss; std::ostringstream m_oss;
double lpx, lpy, lpx2, lpy2, lpx3, lpy3, // points fo r this operation double lpx, lpy, lpx2, lpy2, lpx3, lpy3, // points fo r this operation
lcx, lcy, // l ast "current" point lcx, lcy, // l ast "current" point
lrx, lry; // " reflect points" lrx, lry; // " reflect points"
}; };
// ----------------------------------------------------- // -----------------------------------------------------
 End of changes. 5 change blocks. 
1 lines changed or deleted 95 lines changed or added


 PdfParser.h   PdfParser.h 
skipping to change at line 78 skipping to change at line 78
* file in memory. * file in memory.
* *
* This might throw a PdfError( ePdfError_InvalidPassword ) exception * This might throw a PdfError( ePdfError_InvalidPassword ) exception
* if a password is required to read this PDF. * if a password is required to read this PDF.
* Call SetPassword with the correct password in this case. * Call SetPassword with the correct password in this case.
* *
* \see SetPassword * \see SetPassword
*/ */
PdfParser( PdfVecObjects* pVecObjects, const char* pszFilename, bool bL oadOnDemand = true ); PdfParser( PdfVecObjects* pVecObjects, const char* pszFilename, bool bL oadOnDemand = true );
#ifdef _WIN32
#if defined(_MSC_VER) && _MSC_VER <= 1200 // nicht f
#else
/** Create a new PdfParser object and open a PDF file and parse
* it into memory.
*
* \param pVecObjects vector to write the parsed PdfObjects to
* \param pszFilename filename of the file which is going to be parsed
* \param bLoadOnDemand If true all objects will be read from the file
at
* the time they are accesed first.
* If false all objects will be read immediately.
* This is faster if you do not need the complete
PDF
* file in memory.
*
* This might throw a PdfError( ePdfError_InvalidPassword ) exception
* if a password is required to read this PDF.
* Call SetPassword with the correct password in this case.
*
* This is an overloaded member function to allow working
* with unicode characters. On Unix systes you can also path
* UTF-8 to the const char* overload.
*
* \see SetPassword
*/
PdfParser( PdfVecObjects* pVecObjects, const wchar_t* pszFilename, bool
bLoadOnDemand = true );
#endif
#endif // _WIN32
/** Create a new PdfParser object and open a PDF file and parse /** Create a new PdfParser object and open a PDF file and parse
* it into memory. * it into memory.
* *
* \param pVecObjects vector to write the parsed PdfObjects to * \param pVecObjects vector to write the parsed PdfObjects to
* \param pBuffer buffer containing a PDF file in memory * \param pBuffer buffer containing a PDF file in memory
* \param lLen length of the buffer containing the PDF file * \param lLen length of the buffer containing the PDF file
* \param bLoadOnDemand If true all objects will be read from the file at * \param bLoadOnDemand If true all objects will be read from the file at
* the time they are accesed first. * the time they are accesed first.
* If false all objects will be read immediately. * If false all objects will be read immediately.
* This is faster if you do not need the complete PDF * This is faster if you do not need the complete PDF
skipping to change at line 140 skipping to change at line 168
* *
* *
* This might throw a PdfError( ePdfError_InvalidPassword ) exception * This might throw a PdfError( ePdfError_InvalidPassword ) exception
* if a password is required to read this PDF. * if a password is required to read this PDF.
* Call SetPassword with the correct password in this case. * Call SetPassword with the correct password in this case.
* *
* \see SetPassword * \see SetPassword
*/ */
void ParseFile( const char* pszFilename, bool bLoadOnDemand = true ); void ParseFile( const char* pszFilename, bool bLoadOnDemand = true );
#ifdef _WIN32
/** Open a PDF file and parse it.
*
* \param pszFilename filename of the file which is going to be parsed
* \param bLoadOnDemand If true all objects will be read from the file
at
* the time they are accesed first.
* If false all objects will be read immediately.
* This is faster if you do not need the complete
PDF
* file in memory.
*
*
* This might throw a PdfError( ePdfError_InvalidPassword ) exception
* if a password is required to read this PDF.
* Call SetPassword with the correct password in this case.
*
* This is an overloaded member function to allow working
* with unicode characters. On Unix systes you can also path
* UTF-8 to the const char* overload.
*
* \see SetPassword
*/
void ParseFile( const wchar_t* pszFilename, bool bLoadOnDemand = true )
;
#endif // _WIN32
/** Open a PDF file and parse it. /** Open a PDF file and parse it.
* *
* \param pBuffer buffer containing a PDF file in memory * \param pBuffer buffer containing a PDF file in memory
* \param lLen length of the buffer containing the PDF file * \param lLen length of the buffer containing the PDF file
* \param bLoadOnDemand If true all objects will be read from the file at * \param bLoadOnDemand If true all objects will be read from the file at
* the time they are accesed first. * the time they are accesed first.
* If false all objects will be read immediately. * If false all objects will be read immediately.
* This is faster if you do not need the complete PDF * This is faster if you do not need the complete PDF
* file in memory. * file in memory.
* *
* *
* This might throw a PdfError( ePdfError_InvalidPassword ) exception * This might throw a PdfError( ePdfError_InvalidPassword ) exception
* if a password is required to read this PDF. * if a password is required to read this PDF.
* Call SetPassword with the correct password in this case. * Call SetPassword with the correct password in this case.
* *
* \see SetPassword * \see SetPassword
*/ */
void ParseFile( const char* pBuffer, long lLen, bool bLoadOnDemand = t rue ); void ParseFile( const char* pBuffer, long lLen, bool bLoadOnDemand = tr ue );
/** Open a PDF file and parse it. /** Open a PDF file and parse it.
* *
* \param rDevice the input device to read from * \param rDevice the input device to read from
* \param bLoadOnDemand If true all objects will be read from the file at * \param bLoadOnDemand If true all objects will be read from the file at
* the time they are accesed first. * the time they are accesed first.
* If false all objects will be read immediately. * If false all objects will be read immediately.
* This is faster if you do not need the complete PDF * This is faster if you do not need the complete PDF
* file in memory. * file in memory.
* *
* *
* This might throw a PdfError( ePdfError_InvalidPassword ) exception * This might throw a PdfError( ePdfError_InvalidPassword ) exception
* if a password is required to read this PDF. * if a password is required to read this PDF.
* Call SetPassword with the correct password in this case. * Call SetPassword with the correct password in this case.
* *
* \see SetPassword * \see SetPassword
*/ */
void ParseFile( const PdfRefCountedInputDevice & rDevice, bool bLoadOnD emand = true ); void ParseFile( const PdfRefCountedInputDevice & rDevice, bool bLoadOnD emand = true );
/** Quick method to detect secured PDF files, i.e.
* a PDF with an /Encrypt key in the trailer directory.
*
* \returns true if document is secured, false otherwise
*/
bool QuickEncryptedCheck( const char* pszFilename );
/** Get a reference to the sorted internal objects vector. /** Get a reference to the sorted internal objects vector.
* \returns the internal objects vector. * \returns the internal objects vector.
*/ */
inline const PdfVecObjects* GetObjects() const; inline const PdfVecObjects* GetObjects() const;
/** Get the file format version of the pdf /** Get the file format version of the pdf
* \returns the file format version as enum * \returns the file format version as enum
*/ */
inline EPdfVersion GetPdfVersion() const; inline EPdfVersion GetPdfVersion() const;
skipping to change at line 413 skipping to change at line 472
long m_nXRefLinearizedOffset; long m_nXRefLinearizedOffset;
size_t m_nFileSize; size_t m_nFileSize;
TVecOffsets m_offsets; TVecOffsets m_offsets;
PdfVecObjects* m_vecObjects; PdfVecObjects* m_vecObjects;
PdfObject* m_pTrailer; PdfObject* m_pTrailer;
PdfObject* m_pLinearization; PdfObject* m_pLinearization;
PdfEncrypt* m_pEncrypt; PdfEncrypt* m_pEncrypt;
bool m_xrefSizeUnknown;
std::set<int> m_setObjectStreams; std::set<int> m_setObjectStreams;
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
bool PdfParser::GetLoadOnDemand() const bool PdfParser::GetLoadOnDemand() const
{ {
return m_bLoadOnDemand; return m_bLoadOnDemand;
} }
 End of changes. 5 change blocks. 
3 lines changed or deleted 66 lines changed or added


 PdfParserObject.h   PdfParserObject.h 
skipping to change at line 105 skipping to change at line 105
inline void SetLoadOnDemand( bool bDelayed ); inline void SetLoadOnDemand( bool bDelayed );
/** Set the object number of this object. /** Set the object number of this object.
* It is almost never necessary to use this call. * It is almost never necessary to use this call.
* It is only included for usage in the PdfParser. * It is only included for usage in the PdfParser.
* *
* \param nObjNo the new object number of this object * \param nObjNo the new object number of this object
*/ */
inline void SetObjectNumber( unsigned int nObjNo ); inline void SetObjectNumber( unsigned int nObjNo );
/** Tries to free all memory allocated by this
* PdfObject (variables and streams) and reads
* it from disk again if it is requested another time.
*
* This will only work if load on demand is used.
* If the object is dirty if will not be free'd.
*
* \param bForce if true the object will be free'd
* even if IsDirty() returns true.
* So you will loose any changes made
* to this object.
*
* \see IsLoadOnDemand
* \see IsDirty
*/
void FreeObjectMemory( bool bForce = false );
protected: protected:
/** Load all data of the object if load object on demand is enabled. /** Load all data of the object if load object on demand is enabled.
* Reimplemented from PdfVariant. Do not call this directly, use * Reimplemented from PdfVariant. Do not call this directly, use
* DelayedLoad(). * DelayedLoad().
*/ */
virtual void DelayedLoadImpl(); virtual void DelayedLoadImpl();
/** Load the stream of the object if it has one and if loading on deman d is enabled. /** Load the stream of the object if it has one and if loading on deman d is enabled.
* Reimplemented from PdfObject. Do not call this directly, use * Reimplemented from PdfObject. Do not call this directly, use
* DelayedStreamLoad(). * DelayedStreamLoad().
 End of changes. 1 change blocks. 
0 lines changed or deleted 17 lines changed or added


 PdfRefCountedInputDevice.h   PdfRefCountedInputDevice.h 
skipping to change at line 49 skipping to change at line 49
*/ */
PdfRefCountedInputDevice(); PdfRefCountedInputDevice();
/** Create a new PdfRefCountedInputDevice which reads from a file. /** Create a new PdfRefCountedInputDevice which reads from a file.
* The file is opened using fopen() * The file is opened using fopen()
* \param pszFilename a filename to be passed to fopen * \param pszFilename a filename to be passed to fopen
* \param pszMode a mode string that can be passed to fopen * \param pszMode a mode string that can be passed to fopen
*/ */
PdfRefCountedInputDevice( const char* pszFilename, const char* pszMode ); PdfRefCountedInputDevice( const char* pszFilename, const char* pszMode );
#ifdef _WIN32
#if defined(_MSC_VER) && _MSC_VER <= 1200 // nicht f
#else
/** Create a new PdfRefCountedInputDevice which reads from a file.
* The file is opened using fopen()
* \param pszFilename a filename to be passed to fopen
* \param pszMode a mode string that can be passed to fopen
*
* This is an overloaded member function to allow working
* with unicode characters. On Unix systes you can also path
* UTF-8 to the const char* overload.
*
*/
PdfRefCountedInputDevice( const wchar_t* pszFilename, const char* pszMo
de );
#endif
#endif // _WIN32
/** Create a new PdfRefCountedInputDevice which operates on a in memory buffer /** Create a new PdfRefCountedInputDevice which operates on a in memory buffer
* *
* \param pBuffer pointer to the buffer * \param pBuffer pointer to the buffer
* \param lLen length of the buffer * \param lLen length of the buffer
*/ */
PdfRefCountedInputDevice( const char* pBuffer, long lLen ); PdfRefCountedInputDevice( const char* pBuffer, long lLen );
/** Create a new PdfRefCountedInputDevice from an PdfInputDevice /** Create a new PdfRefCountedInputDevice from an PdfInputDevice
* *
* \param pDevice the input device. It will be owned and deleted by th is object. * \param pDevice the input device. It will be owned and deleted by th is object.
 End of changes. 1 change blocks. 
0 lines changed or deleted 18 lines changed or added


 PdfReference.h   PdfReference.h 
skipping to change at line 81 skipping to change at line 81
PODOFO_NOTHROW virtual ~PdfReference() { } PODOFO_NOTHROW virtual ~PdfReference() { }
/** Convert the reference to a string. /** Convert the reference to a string.
* \returns a string representation of the object. * \returns a string representation of the object.
* *
* \see PdfVariant::ToString * \see PdfVariant::ToString
*/ */
const std::string ToString() const; const std::string ToString() const;
/** /**
* Assigne the value of another object to this PdfReference. * Assign the value of another object to this PdfReference.
* *
* \param rhs the object to copy * \param rhs the object to copy
*/ */
PODOFO_NOTHROW inline const PdfReference & operator=( const PdfReferenc e & rhs ); PODOFO_NOTHROW inline const PdfReference & operator=( const PdfReferenc e & rhs );
/** Write the complete variant to an output device. /** Write the complete variant to an output device.
* This is an overloaded member function. * This is an overloaded member function.
* *
* \param pDevice write the object to this device * \param pDevice write the object to this device
*/ */
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 PdfStreamedDocument.h   PdfStreamedDocument.h 
skipping to change at line 82 skipping to change at line 82
* immediately. * immediately.
* *
* \param pDevice an output device * \param pDevice an output device
* \param eVersion the PDF version of the document to write. * \param eVersion the PDF version of the document to write.
* The PDF version can only be set in the constructor * The PDF version can only be set in the constructor
* as it is the first item written to the document on disk. * as it is the first item written to the document on disk.
* \param pEncrypt pointer to an encryption object or NULL. If not NUL L * \param pEncrypt pointer to an encryption object or NULL. If not NUL L
* the PdfEncrypt object will be copied and used to en crypt the * the PdfEncrypt object will be copied and used to en crypt the
* created document. * created document.
*/ */
PdfStreamedDocument( PdfOutputDevice* pDevice, EPdfVersion eVersion = e PdfVersion_1_5, PdfEncrypt* pEncrypt = NULL ); PdfStreamedDocument( PdfOutputDevice* pDevice, EPdfVersion eVersion = e PdfVersion_Default, PdfEncrypt* pEncrypt = NULL );
/** Create a new PdfStreamedDocument. /** Create a new PdfStreamedDocument.
* All data is written to a file immediately. * All data is written to a file immediately.
* *
* \param pszFilename resulting PDF file * \param pszFilename resulting PDF file
* \param eVersion the PDF version of the document to write. * \param eVersion the PDF version of the document to write.
* The PDF version can only be set in the constructor * The PDF version can only be set in the constructor
* as it is the first item written to the document on disk. * as it is the first item written to the document on disk.
* \param pEncrypt pointer to an encryption object or NULL. If not NUL L * \param pEncrypt pointer to an encryption object or NULL. If not NUL L
* the PdfEncrypt object will be copied and used to en crypt the * the PdfEncrypt object will be copied and used to en crypt the
* created document. * created document.
*/ */
PdfStreamedDocument( const char* pszFilename, EPdfVersion eVersion = eP PdfStreamedDocument( const char* pszFilename, EPdfVersion eVersion = eP
dfVersion_1_5, PdfEncrypt* pEncrypt = NULL ); dfVersion_Default, PdfEncrypt* pEncrypt = NULL );
#ifdef _WIN32
/** Create a new PdfStreamedDocument.
* All data is written to a file immediately.
*
* \param pszFilename resulting PDF file
* \param eVersion the PDF version of the document to write.
* The PDF version can only be set in the constructor
* as it is the first item written to the document on
disk.
* \param pEncrypt pointer to an encryption object or NULL. If not NUL
L
* the PdfEncrypt object will be copied and used to en
crypt the
* created document.
*
* This is an overloaded member function to allow working
* with unicode characters. On Unix systes you can also path
* UTF-8 to the const char* overload.
*/
PdfStreamedDocument( const wchar_t* pszFilename, EPdfVersion eVersion =
ePdfVersion_Default, PdfEncrypt* pEncrypt = NULL );
#endif // _WIN32
~PdfStreamedDocument(); ~PdfStreamedDocument();
/** Close the document. The PDF file on disk is finished. /** Close the document. The PDF file on disk is finished.
* No other member function of this class maybe called * No other member function of this class maybe called
* after calling this function. * after calling this function.
*/ */
void Close(); void Close();
/** Get the PDF version of the document /** Get the PDF version of the document
skipping to change at line 198 skipping to change at line 217
private: private:
/** Initialize the PdfStreamedDocument with an output device /** Initialize the PdfStreamedDocument with an output device
* \param pDevice write to this device * \param pDevice write to this device
* \param eVersion the PDF version of the document to write. * \param eVersion the PDF version of the document to write.
* The PDF version can only be set in the constructor * The PDF version can only be set in the constructor
* as it is the first item written to the document on disk. * as it is the first item written to the document on disk.
* \param pEncrypt pointer to an encryption object or NULL. If not NUL L * \param pEncrypt pointer to an encryption object or NULL. If not NUL L
* the PdfEncrypt object will be copied and used to en crypt the * the PdfEncrypt object will be copied and used to en crypt the
* created document. * created document.
*/ */
void Init( PdfOutputDevice* pDevice, EPdfVersion eVersion = ePdfVersion _1_5, PdfEncrypt* pEncrypt = NULL ); void Init( PdfOutputDevice* pDevice, EPdfVersion eVersion = ePdfVersion _Default, PdfEncrypt* pEncrypt = NULL );
private: private:
PdfImmediateWriter* m_pWriter; PdfImmediateWriter* m_pWriter;
PdfOutputDevice* m_pDevice; PdfOutputDevice* m_pDevice;
PdfEncrypt* m_pEncrypt; PdfEncrypt* m_pEncrypt;
bool m_bOwnDevice; ///< If true m_pDevice is owned by th is object and has to be deleted bool m_bOwnDevice; ///< If true m_pDevice is owned by th is object and has to be deleted
}; };
 End of changes. 3 change blocks. 
4 lines changed or deleted 27 lines changed or added


 PdfString.h   PdfString.h 
skipping to change at line 32 skipping to change at line 32
#define _PDF_STRING_H_ #define _PDF_STRING_H_
#include "PdfDefines.h" #include "PdfDefines.h"
#include "PdfDataType.h" #include "PdfDataType.h"
#include "PdfRefCountedBuffer.h" #include "PdfRefCountedBuffer.h"
namespace PoDoFo { namespace PoDoFo {
#define PDF_STRING_BUFFER_SIZE 24 #define PDF_STRING_BUFFER_SIZE 24
class PdfEncoding;
class PdfOutputDevice; class PdfOutputDevice;
enum EPdfStringConversion { enum EPdfStringConversion {
ePdfStringConversion_Strict, ePdfStringConversion_Strict,
ePdfStringConversion_Lenient ePdfStringConversion_Lenient
}; };
/** A string that can be written to a PDF document. /** A string that can be written to a PDF document.
* If it contains binary data it is automatically * If it contains binary data it is automatically
* converted into a hex string, otherwise a normal PDF * converted into a hex string, otherwise a normal PDF
skipping to change at line 70 skipping to change at line 71
* The internal string buffer is guaranteed to be always terminated * The internal string buffer is guaranteed to be always terminated
* by 2 zeros. * by 2 zeros.
*/ */
class PODOFO_API PdfString : public PdfDataType{ class PODOFO_API PdfString : public PdfDataType{
public: public:
/** Create an empty and invalid string /** Create an empty and invalid string
*/ */
PdfString(); PdfString();
/** Construct a new PdfString from a std::string. /** Construct a new PdfString from a std::string.
* The input string will be copied. * The input string will be copied.
* If the first to bytes of the string are 0xFE and 0xFF * If the first to bytes of the string are 0xFE and 0xFF
* this string is treated as UTF-16BE encoded unicode string. * this string is treated as UTF-16BE encoded unicode string.
* *
* \param sString the string to copy * \param sString the string to copy
*/ * \param pEncoding the encoding of this string, if it is no unicode s
PdfString( const std::string& sString ); tring.
* This is ignored for unicode strings. If NULL PdfDocEncodi
ng will be used as a default.
*/
PdfString( const std::string& sString, const PdfEncoding * const pEncod
ing = NULL );
/** Construct a new PdfString from a 0 terminated
* string.
* The input string will be copied.
*
* \param pszString the string to copy
* \param pEncoding the encoding of this string, if it is no unicod
e string.
* This is ignored for unicode strings. If NULL PdfDocEncodi
ng will be used as a default.
*/
PdfString( const char* pszString, const PdfEncoding * const pEncoding =
NULL );
/** Construct a new PdfString from a 0 terminated /** Construct a new PdfString from a 0 terminated
* string. * string.
* The input string will be copied. * The input string will be copied.
* *
* \param pszString the string to copy * \param pszString the string to copy
*/ */
PdfString( const char* pszString ); #if defined(_MSC_VER) && _MSC_VER <= 1200 // nicht f
#else
PdfString( const wchar_t* pszString );
#endif
/** Construct a new PdfString from a string. /** Construct a new PdfString from a string.
* The input string will be copied. * The input string will be copied.
* If the first to bytes of the string are 0xFE and 0xFF * If the first to bytes of the string are 0xFE and 0xFF
* this string is treated as UTF-16BE encoded unicode string. * this string is treated as UTF-16BE encoded unicode string.
* *
* \param pszString the string to copy * \param pszString the string to copy
* \param lLen length of the string data to encode * \param lLen length of the string data to encode
* \param bHex if true the data will be * \param bHex if true the data will be
* hex encoded during writeout of the string and IsHex() w ill return true. * hex encoded during writeout of the string and IsHex() w ill return true.
* \param pEncoding the encoding of this string, if it is no unicod
e string.
* This is ignored for unicode strings. If NULL PdfDocEncodi
ng will be used as a default.
*/ */
PdfString( const char* pszString, long lLen, bool bHex = false ); PdfString( const char* pszString, long lLen, bool bHex = false, const P dfEncoding * const pEncoding = NULL );
/** Construct a new PdfString from an UTF-8 encoded string. /** Construct a new PdfString from an UTF-8 encoded string.
* *
* The string is converted to UTF-16BE internally. * The string is converted to UTF-16BE internally.
* *
* \param pszStringUtf8 a UTF-8 encoded string. * \param pszStringUtf8 a UTF-8 encoded string.
*/ */
PdfString( const pdf_utf8* pszStringUtf8 ); PdfString( const pdf_utf8* pszStringUtf8 );
/** Construct a new PdfString from an UTF-16be encoded zero terminated string. /** Construct a new PdfString from an UTF-16be encoded zero terminated string.
skipping to change at line 122 skipping to change at line 140
/** Construct a new PdfString from an UTF-8 encoded string. /** Construct a new PdfString from an UTF-8 encoded string.
* *
* The string is converted to UTF-16BE internally. * The string is converted to UTF-16BE internally.
* *
* \param pszStringUtf8 a UTF-8 encoded string. * \param pszStringUtf8 a UTF-8 encoded string.
* \param lLen number of bytes to convert * \param lLen number of bytes to convert
*/ */
PdfString( const pdf_utf8* pszStringUtf8, long lLen ); PdfString( const pdf_utf8* pszStringUtf8, long lLen );
/** Construct a new PdfString from an UTF-16be encoded zero terminated
string.
*
* \param pszStringUtf16 a UTF-16BE encoded string.
* \param lLen number of words to convert
*/
PdfString( const pdf_utf16be* pszStringUtf16, long lLen );
/** Copy an existing PdfString /** Copy an existing PdfString
* \param rhs another PdfString to copy * \param rhs another PdfString to copy
*/ */
PdfString( const PdfString & rhs ); PdfString( const PdfString & rhs );
~PdfString(); ~PdfString();
/** Set hex encoded data as the strings data. /** Set hex encoded data as the strings data.
* \param pszHex must be hex encoded data. * \param pszHex must be hex encoded data.
* \param lLen length of the hex encoded data. * \param lLen length of the hex encoded data.
skipping to change at line 212 skipping to change at line 237
* The strings contents are always returned as * The strings contents are always returned as
* UTF8 by this function. Works for unicode strings * UTF8 by this function. Works for unicode strings
* and for non unicode strings. * and for non unicode strings.
* *
* This is the prefered way to access the strings contents. * This is the prefered way to access the strings contents.
* *
* \returns the string contents always as UTF8. * \returns the string contents always as UTF8.
*/ */
inline const std::string & GetStringUtf8() const; inline const std::string & GetStringUtf8() const;
#ifdef _WIN32
/** The contents of the string as wide character string.
*
* \returns the string contents as wide character string.
*/
const std::wstring GetStringW() const;
#endif // _WIN32
/** The length of the string data returned by GetString() /** The length of the string data returned by GetString()
* in bytes not including terminating zeros. * in bytes not including terminating zeros.
* *
* \returns the length of the string. * \returns the length of the string.
* *
* \see GetCharacterLength to determine the number of characters in th e string * \see GetCharacterLength to determine the number of characters in th e string
*/ */
inline long GetLength() const; inline long GetLength() const;
/** The length of the string data returned by GetUnicode() /** The length of the string data returned by GetUnicode()
skipping to change at line 389 skipping to change at line 422
static const char* s_pszUnicodeMarkerHex; ///< The unicode marke r converted to HEX static const char* s_pszUnicodeMarkerHex; ///< The unicode marke r converted to HEX
static const pdf_utf16be s_cPdfDocEncoding[256]; ///< conversion table from PDFDocEncoding to UTF16 static const pdf_utf16be s_cPdfDocEncoding[256]; ///< conversion table from PDFDocEncoding to UTF16
private: private:
PdfRefCountedBuffer m_buffer; ///< String data (alwa ys binary), may contain 0 bytes PdfRefCountedBuffer m_buffer; ///< String data (alwa ys binary), may contain 0 bytes
bool m_bHex; ///< This string is co nverted to hex during write out bool m_bHex; ///< This string is co nverted to hex during write out
bool m_bUnicode; ///< This string conta ins unicode data bool m_bUnicode; ///< This string conta ins unicode data
std::string m_sUtf8; ///< The UTF8 version of the strings contents. std::string m_sUtf8; ///< The UTF8 version of the strings contents.
const PdfEncoding* m_pEncoding; ///< Encoding for non Unicode strings. NULL for unicode strings.
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
bool PdfString::IsValid() const bool PdfString::IsValid() const
{ {
return (m_buffer.GetBuffer() != NULL); return (m_buffer.GetBuffer() != NULL);
} }
 End of changes. 8 change blocks. 
10 lines changed or deleted 53 lines changed or added


 PdfTokenizer.h   PdfTokenizer.h 
skipping to change at line 227 skipping to change at line 227
protected: protected:
PdfRefCountedInputDevice m_device; PdfRefCountedInputDevice m_device;
PdfRefCountedBuffer m_buffer; PdfRefCountedBuffer m_buffer;
private: private:
// 256-byte array mapping character ordinal values to a truth value // 256-byte array mapping character ordinal values to a truth value
// indicating whether or not they are whitespace according to the PDF // indicating whether or not they are whitespace according to the PDF
// standard. // standard.
static const char * const m_delimiterMap; static const char * const m_delimiterMap;
static const char * const m_whitespaceMap; static const char * const m_whitespaceMap;
static const char m_octMap[]; static const char m_octMap[]; ///< Map of bool values, if a certain cha
r
///< is a valid octal digit
static const char * const m_escMap; ///< Mapping of escape sequences to
there value
TTokenizerQueque m_deqQueque; TTokenizerQueque m_deqQueque;
// A vector which is used as a buffer to read strings. // A vector which is used as a buffer to read strings.
// It is a member of the class to avoid reallocations while parsing. // It is a member of the class to avoid reallocations while parsing.
std::vector<char> m_vecBuffer; // we use a vector instead of a string std::vector<char> m_vecBuffer; // we use a vector instead of a string
// because we might read a unicode // because we might read a unicode
// string which is allowed to contain 0 bytes. // string which is allowed to contain 0 bytes.
}; };
 End of changes. 1 change blocks. 
1 lines changed or deleted 5 lines changed or added


 PdfVariant.h   PdfVariant.h 
skipping to change at line 55 skipping to change at line 55
* The data can be parsed directly from a string or set by one of the membe rs. * The data can be parsed directly from a string or set by one of the membe rs.
* One can also convert the variant back to a string after setting the valu es. * One can also convert the variant back to a string after setting the valu es.
* *
* \warning All methods not marked otherwise may trigger a deferred load. T his means * \warning All methods not marked otherwise may trigger a deferred load. T his means
* that they are unsafe to call while a deferred load is already i n progress * that they are unsafe to call while a deferred load is already i n progress
* (as recursion will occurr). * (as recursion will occurr).
* *
* TODO: domseichter: Make this class implicitly shared * TODO: domseichter: Make this class implicitly shared
*/ */
class PODOFO_API PdfVariant { class PODOFO_API PdfVariant {
friend class PdfArray;
friend class PdfDictionary;
public: public:
static PdfVariant NullValue; static PdfVariant NullValue;
/** Construct an empty variant type /** Construct an empty variant type
* IsNull() will return true. * IsNull() will return true.
*/ */
PdfVariant(); PdfVariant();
/** Construct a PdfVariant that is a bool. /** Construct a PdfVariant that is a bool.
skipping to change at line 134 skipping to change at line 137
virtual ~PdfVariant(); virtual ~PdfVariant();
/** \returns true if this PdfVariant is empty. /** \returns true if this PdfVariant is empty.
* i.e. m_eDataType == ePdfDataType_Null * i.e. m_eDataType == ePdfDataType_Null
*/ */
inline bool IsEmpty() const; inline bool IsEmpty() const;
/** Clear all internal member variables and free the memory /** Clear all internal member variables and free the memory
* they have allocated. * they have allocated.
* Sets the datatype to ePdfDataType_Null * Sets the datatype to ePdfDataType_Null
*
* This will reset the dirty flag of this object to be clean.
* \see IsDirty
*/ */
void Clear(); void Clear();
/** \returns the datatype of this object or ePdfDataType_Unknown /** \returns the datatype of this object or ePdfDataType_Unknown
* if it does not have a value. * if it does not have a value.
*/ */
inline EPdfDataType GetDataType() const; inline EPdfDataType GetDataType() const;
/** \returns a human readable string representation of GetDataType() /** \returns a human readable string representation of GetDataType()
* The returned string must not be free'd. * The returned string must not be free'd.
skipping to change at line 218 skipping to change at line 224
virtual void Write( PdfOutputDevice* pDevice, const PdfEncrypt* pEncryp t, const PdfName & keyStop ) const; virtual void Write( PdfOutputDevice* pDevice, const PdfEncrypt* pEncryp t, const PdfName & keyStop ) const;
/** Converts the current object into a string representation /** Converts the current object into a string representation
* which can be written directly to a PDF file on disc. * which can be written directly to a PDF file on disc.
* \param rsData the object string is returned in this object. * \param rsData the object string is returned in this object.
*/ */
void ToString( std::string & rsData ) const; void ToString( std::string & rsData ) const;
/** Set the value of this object as bool /** Set the value of this object as bool
* \param b the value as bool. * \param b the value as bool.
*
* This will set the dirty flag of this object.
* \see IsDirty
*/ */
inline void SetBool( bool b ); inline void SetBool( bool b );
/** Get the value if this object is a bool. /** Get the value if this object is a bool.
* \returns the bool value. * \returns the bool value.
*/ */
inline bool GetBool() const; inline bool GetBool() const;
/** Set the value of this object as long /** Set the value of this object as long
* \param l the value as long. * \param l the value as long.
*
* This will set the dirty flag of this object.
* \see IsDirty
*/ */
inline void SetNumber( long l ); inline void SetNumber( long l );
/** Get the value of the object as long. /** Get the value of the object as long.
* \return the value of the number * \return the value of the number
*/ */
inline long GetNumber() const; inline long GetNumber() const;
/** Set the value of this object as double /** Set the value of this object as double
* \param d the value as double. * \param d the value as double.
*
* This will set the dirty flag of this object.
* \see IsDirty
*/ */
inline void SetReal( double d ); inline void SetReal( double d );
/** Get the value of the object as double. /** Get the value of the object as double.
* \return the value of the number * \return the value of the number
*/ */
inline double GetReal() const; inline double GetReal() const;
/** \returns the value of the object as string. /** \returns the value of the object as string.
*/ */
skipping to change at line 279 skipping to change at line 294
/** Returns the dictionary value of this object /** Returns the dictionary value of this object
* \returns a PdfDictionary * \returns a PdfDictionary
*/ */
inline PdfDictionary & GetDictionary(); inline PdfDictionary & GetDictionary();
/** Get the reference values of this object. /** Get the reference values of this object.
* \returns a PdfReference * \returns a PdfReference
*/ */
inline const PdfReference & GetReference() const; inline const PdfReference & GetReference() const;
/** Get the reference values of this object.
* \returns a PdfReference
*/
inline PdfReference & GetReference();
/** Assign the values of another PdfVariant to this one. /** Assign the values of another PdfVariant to this one.
* \param rhs an existing variant which is copied. * \param rhs an existing variant which is copied.
*
* This will set the dirty flag of this object.
* \see IsDirty
*/ */
const PdfVariant & operator=( const PdfVariant & rhs ); const PdfVariant & operator=( const PdfVariant & rhs );
/** /**
* Test to see if the value contained by this variant is the same * Test to see if the value contained by this variant is the same
* as the value of the other variant. * as the value of the other variant.
*/ */
bool operator==( const PdfVariant & rhs ) const; bool operator==( const PdfVariant & rhs ) const;
/** /**
* \see operator== * \see operator==
*/ */
inline bool operator!=( const PdfVariant & rhs) const; inline bool operator!=( const PdfVariant & rhs) const;
/** The dirty flag is set if this variant
* has been modified after construction.
*
* Usually the dirty flag is also set
* if you call any non-const member function
* (e.g. GetDictionary()) as PdfVariant cannot
* determine if you actually changed the dictionary
* or not.
*
* \returns true if the value is dirty and has been
* modified since construction
*/
inline bool IsDirty() const;
protected: protected:
/** Sets the dirty flag of this PdfVariant
*
* \param bDirty true if this PdfVariant has been
* modified from the outside
*
* \see IsDirty
*/
inline void SetDirty( bool bDirty );
/** /**
* Dynamically load the contents of this object from a PDF file by call ing * Dynamically load the contents of this object from a PDF file by call ing
* the virtual method DelayedLoadImpl() if the object is not already lo aded. * the virtual method DelayedLoadImpl() if the object is not already lo aded.
* *
* For objects complete created in memory and those that do not support * For objects complete created in memory and those that do not support
* deferred loading this function does nothing, since deferred loading * deferred loading this function does nothing, since deferred loading
* will not be enabled. * will not be enabled.
*/ */
inline void DelayedLoad() const; inline void DelayedLoad() const;
skipping to change at line 415 skipping to change at line 451
*/ */
PdfDataType* pData; PdfDataType* pData;
bool bBoolValue; bool bBoolValue;
double dNumber; double dNumber;
long nNumber; long nNumber;
} UVariant; } UVariant;
UVariant m_Data; UVariant m_Data;
bool m_bDirty; ///< Indicates if this object was modified after
construction
/** Datatype of the variant. /** Datatype of the variant.
* required to access the correct member of * required to access the correct member of
* the union UVariant. * the union UVariant.
*/ */
EPdfDataType m_eDataType; EPdfDataType m_eDataType;
// No touchy. Only for use by PdfVariant's internal tracking of the del ayed // No touchy. Only for use by PdfVariant's internal tracking of the del ayed
// loading state. Use DelayedLoadDone() to test this if you need to. // loading state. Use DelayedLoadDone() to test this if you need to.
mutable bool m_bDelayedLoadDone; mutable bool m_bDelayedLoadDone;
skipping to change at line 495 skipping to change at line 533
void PdfVariant::SetBool( bool b ) void PdfVariant::SetBool( bool b )
{ {
DelayedLoad(); DelayedLoad();
if( !IsBool() ) if( !IsBool() )
{ {
PODOFO_RAISE_ERROR( ePdfError_InvalidDataType ); PODOFO_RAISE_ERROR( ePdfError_InvalidDataType );
} }
m_Data.bBoolValue = b; m_Data.bBoolValue = b;
SetDirty( true );
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
bool PdfVariant::GetBool() const bool PdfVariant::GetBool() const
{ {
DelayedLoad(); DelayedLoad();
if( !IsBool() ) if( !IsBool() )
skipping to change at line 528 skipping to change at line 567
if( !IsReal() && !IsNumber() ) if( !IsReal() && !IsNumber() )
{ {
PODOFO_RAISE_ERROR( ePdfError_InvalidDataType ); PODOFO_RAISE_ERROR( ePdfError_InvalidDataType );
} }
if ( IsReal() ) if ( IsReal() )
m_Data.dNumber = static_cast<double>(l); m_Data.dNumber = static_cast<double>(l);
else else
m_Data.nNumber = l; m_Data.nNumber = l;
SetDirty( true );
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
long PdfVariant::GetNumber() const long PdfVariant::GetNumber() const
{ {
DelayedLoad(); DelayedLoad();
if( !IsReal() && !IsNumber() ) if( !IsReal() && !IsNumber() )
skipping to change at line 564 skipping to change at line 605
if( !IsReal() && !IsNumber() ) if( !IsReal() && !IsNumber() )
{ {
PODOFO_RAISE_ERROR( ePdfError_InvalidDataType ); PODOFO_RAISE_ERROR( ePdfError_InvalidDataType );
} }
if ( IsReal() ) if ( IsReal() )
m_Data.dNumber = d; m_Data.dNumber = d;
else else
m_Data.nNumber = static_cast<long>(floor( d )); m_Data.nNumber = static_cast<long>(floor( d ));
SetDirty( true );
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
double PdfVariant::GetReal() const double PdfVariant::GetReal() const
{ {
DelayedLoad(); DelayedLoad();
if( !IsReal() && !IsNumber() ) if( !IsReal() && !IsNumber() )
skipping to change at line 623 skipping to change at line 666
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
const PdfArray & PdfVariant::GetArray() const const PdfArray & PdfVariant::GetArray() const
{ {
DelayedLoad(); DelayedLoad();
return GetArray_NoDL(); return GetArray_NoDL();
} }
// -----------------------------------------------------
//
// -----------------------------------------------------
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 );
} }
skipping to change at line 645 skipping to change at line 691
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
PdfArray & PdfVariant::GetArray() PdfArray & PdfVariant::GetArray()
{ {
DelayedLoad(); DelayedLoad();
return GetArray_NoDL(); return GetArray_NoDL();
} }
// -----------------------------------------------------
//
// -----------------------------------------------------
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)); return *(reinterpret_cast<PdfArray* const>(m_Data.pData));
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
const PdfDictionary & PdfVariant::GetDictionary() const const PdfDictionary & PdfVariant::GetDictionary() const
{ {
DelayedLoad(); DelayedLoad();
return GetDictionary_NoDL(); return GetDictionary_NoDL();
} }
// -----------------------------------------------------
//
// -----------------------------------------------------
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 );
} }
skipping to change at line 689 skipping to change at line 740
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
PdfDictionary & PdfVariant::GetDictionary() PdfDictionary & PdfVariant::GetDictionary()
{ {
DelayedLoad(); DelayedLoad();
return GetDictionary_NoDL(); return GetDictionary_NoDL();
} }
// -----------------------------------------------------
//
// -----------------------------------------------------
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 );
} }
skipping to change at line 720 skipping to change at line 774
{ {
PODOFO_RAISE_ERROR( ePdfError_InvalidDataType ); PODOFO_RAISE_ERROR( ePdfError_InvalidDataType );
} }
return *(reinterpret_cast<PdfReference* const>(m_Data.pData)); return *(reinterpret_cast<PdfReference* const>(m_Data.pData));
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline PdfReference & PdfVariant::GetReference()
{
DelayedLoad();
if( !IsReference() )
{
PODOFO_RAISE_ERROR( ePdfError_InvalidDataType );
}
return *(reinterpret_cast<PdfReference* const>(m_Data.pData));
}
// -----------------------------------------------------
//
// -----------------------------------------------------
bool PdfVariant::DelayedLoadDone() const bool PdfVariant::DelayedLoadDone() const
{ {
return m_bDelayedLoadDone; return m_bDelayedLoadDone;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
void PdfVariant::EnableDelayedLoading() void PdfVariant::EnableDelayedLoading()
{ {
skipping to change at line 766 skipping to change at line 805
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
bool PdfVariant::operator!=( const PdfVariant & rhs) const bool PdfVariant::operator!=( const PdfVariant & rhs) const
{ {
return !(*this == rhs); return !(*this == rhs);
} }
// -----------------------------------------------------
//
// -----------------------------------------------------
bool PdfVariant::IsDirty() const
{
// If this is a object with
// stream, the streams dirty
// flag might be set.
if( m_bDirty )
return m_bDirty;
switch( m_eDataType )
{
case ePdfDataType_Array:
case ePdfDataType_Dictionary:
// Arrays and Dictionaries
// handle dirty status by themselfes
return m_Data.pData->IsDirty();
case ePdfDataType_Bool:
case ePdfDataType_Number:
case ePdfDataType_Real:
case ePdfDataType_HexString:
case ePdfDataType_String:
case ePdfDataType_Name:
case ePdfDataType_RawData:
case ePdfDataType_Reference:
case ePdfDataType_Null:
case ePdfDataType_Unknown:
default:
return m_bDirty;
};
}
// -----------------------------------------------------
//
// -----------------------------------------------------
void PdfVariant::SetDirty( bool bDirty )
{
m_bDirty = bDirty;
if( !m_bDirty )
{
// Propogate new dirty state to subclasses
switch( m_eDataType )
{
case ePdfDataType_Array:
case ePdfDataType_Dictionary:
// Arrays and Dictionaries
// handle dirty status by themselfes
m_Data.pData->SetDirty( m_bDirty );
case ePdfDataType_Bool:
case ePdfDataType_Number:
case ePdfDataType_Real:
case ePdfDataType_HexString:
case ePdfDataType_String:
case ePdfDataType_Name:
case ePdfDataType_RawData:
case ePdfDataType_Reference:
case ePdfDataType_Null:
case ePdfDataType_Unknown:
default:
break;
};
}
}
}; };
#endif // _PDF_VARIANT_H_ #endif // _PDF_VARIANT_H_
 End of changes. 20 change blocks. 
21 lines changed or deleted 129 lines changed or added


 PdfVersion.h   PdfVersion.h 
#ifndef PODOFO_PDFVERSION_H #ifndef PODOFO_PDFVERSION_H
#define PODOFO_PDFVERSION_H #define PODOFO_PDFVERSION_H
#define PODOFO_MAJOR 0 #define PODOFO_MAJOR 0
#define PODOFO_MINOR 6 #define PODOFO_MINOR 7
#define PODOFO_REVISION 0 #define PODOFO_REVISION 0
#define PODOFO_VERSION_STRING "0.6.0" #define PODOFO_VERSION_STRING "0.7.0"
#endif #endif
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 PdfWriter.h   PdfWriter.h 
skipping to change at line 79 skipping to change at line 79
PdfWriter( PdfVecObjects* pVecObjects, const PdfObject* pTrailer ); PdfWriter( PdfVecObjects* pVecObjects, const PdfObject* pTrailer );
virtual ~PdfWriter(); virtual ~PdfWriter();
/** Writes the complete document to a PDF file. /** Writes the complete document to a PDF file.
* *
* \param pszFilename filename of a PDF file. * \param pszFilename filename of a PDF file.
*/ */
void Write( const char* pszFilename ); void Write( const char* pszFilename );
#ifdef _WIN32
/** Writes the complete document to a PDF file.
*
* \param pszFilename filename of a PDF file.
*
* This is an overloaded member function to allow working
* with unicode characters. On Unix systes you can also path
* UTF-8 to the const char* overload.
*/
void Write( const wchar_t* pszFilename );
#endif // _WIN32
/** Writes the complete document to a PdfOutputDevice /** Writes the complete document to a PdfOutputDevice
* *
* \param pDevice write to the specified device * \param pDevice write to the specified device
*/ */
void Write( PdfOutputDevice* pDevice ); void Write( PdfOutputDevice* pDevice );
/** Set the PDF Version of the document. Has to be called before Write( ) to /** Set the PDF Version of the document. Has to be called before Write( ) to
* have an effect. * have an effect.
* \param eVersion version of the pdf document * \param eVersion version of the pdf document
*/ */
 End of changes. 1 change blocks. 
0 lines changed or deleted 12 lines changed or added


 PdfXRefStream.h   PdfXRefStream.h 
skipping to change at line 110 skipping to change at line 110
* should be written. * should be written.
*/ */
virtual void EndWrite( PdfOutputDevice* pDevice ); virtual void EndWrite( PdfOutputDevice* pDevice );
private: private:
PdfVecObjects* m_pParent; PdfVecObjects* m_pParent;
PdfWriter* m_pWriter; PdfWriter* m_pWriter;
PdfObject* m_pObject; PdfObject* m_pObject;
PdfArray m_indeces; PdfArray m_indeces;
bool m_bLittle; ///< Wether we run on a little or big endi an machine
size_t m_lBufferLen; ///< The length of the internal buffer for one XRef entry size_t m_lBufferLen; ///< The length of the internal buffer for one XRef entry
long m_lOffset; ///< Offset of the XRefStream object long m_lOffset; ///< Offset of the XRefStream object
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline size_t PdfXRefStream::GetOffset() const inline size_t PdfXRefStream::GetOffset() const
{ {
return m_lOffset; return m_lOffset;
 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 47 skipping to change at line 47
#include "PdfAcroForm.h" #include "PdfAcroForm.h"
#include "PdfAnnotation.h" #include "PdfAnnotation.h"
#include "PdfArray.h" #include "PdfArray.h"
#include "PdfCanvas.h" #include "PdfCanvas.h"
#include "PdfColor.h" #include "PdfColor.h"
#include "PdfContentsTokenizer.h" #include "PdfContentsTokenizer.h"
#include "PdfData.h" #include "PdfData.h"
#include "PdfDataType.h" #include "PdfDataType.h"
#include "PdfDate.h" #include "PdfDate.h"
#include "PdfDestination.h" #include "PdfDestination.h"
#include "PdfDictionary.h"
#include "PdfDifferenceEncoding.h"
#include "PdfDocument.h" #include "PdfDocument.h"
#include "PdfElement.h" #include "PdfElement.h"
#include "PdfEncoding.h" #include "PdfEncoding.h"
#include "PdfEncodingFactory.h"
#include "PdfEncrypt.h" #include "PdfEncrypt.h"
#include "PdfError.h" #include "PdfError.h"
#include "PdfExtGState.h" #include "PdfExtGState.h"
#include "PdfField.h" #include "PdfField.h"
#include "PdfFileSpec.h" #include "PdfFileSpec.h"
#include "PdfFilter.h" #include "PdfFilter.h"
#include "PdfFont.h" #include "PdfFont.h"
#include "PdfFontCache.h" #include "PdfFontCache.h"
#include "PdfFontFactory.h" #include "PdfFontFactory.h"
#include "PdfFontMetrics.h" #include "PdfFontMetrics.h"
#include "PdfFontTTFSubset.h"
#include "PdfFunction.h" #include "PdfFunction.h"
#include "PdfImage.h" #include "PdfImage.h"
#include "PdfInfo.h" #include "PdfInfo.h"
#include "PdfInputDevice.h" #include "PdfInputDevice.h"
#include "PdfMemDocument.h" #include "PdfMemDocument.h"
#include "PdfMemStream.h" #include "PdfMemStream.h"
#include "PdfName.h" #include "PdfName.h"
#include "PdfNamesTree.h" #include "PdfNamesTree.h"
#include "PdfObject.h" #include "PdfObject.h"
#include "PdfOutlines.h" #include "PdfOutlines.h"
skipping to change at line 92 skipping to change at line 96
#include "PdfStreamedDocument.h" #include "PdfStreamedDocument.h"
#include "PdfString.h" #include "PdfString.h"
#include "PdfTable.h" #include "PdfTable.h"
#include "PdfTokenizer.h" #include "PdfTokenizer.h"
#include "PdfVariant.h" #include "PdfVariant.h"
#include "PdfVecObjects.h" #include "PdfVecObjects.h"
#include "PdfWriter.h" #include "PdfWriter.h"
#include "PdfXObject.h" #include "PdfXObject.h"
#include "PdfXRef.h" #include "PdfXRef.h"
#include "PdfXRefStream.h" #include "PdfXRefStream.h"
#include "util/PdfMutex.h"
#include "util/PdfMutexWrapper.h"
#if 0 #if 0
#ifndef _PODOFO_NO_NAMESPACE_ #ifndef _PODOFO_NO_NAMESPACE_
using namespace PoDoFo; using namespace PoDoFo;
#endif /* _PODOFO_NO_NAMESPACE_ */ #endif /* _PODOFO_NO_NAMESPACE_ */
#endif #endif
#endif /* _PODOFO_H_ */ #endif /* _PODOFO_H_ */
 End of changes. 4 change blocks. 
0 lines changed or deleted 6 lines changed or added


 podofoapi.h   podofoapi.h 
skipping to change at line 68 skipping to change at line 68
* (available as PODOFO_DEPRECATED) * (available as PODOFO_DEPRECATED)
* *
* __attribute__((pure)) for functions w/o side effects * __attribute__((pure)) for functions w/o side effects
* (available as PODOFO_PURE_FUNCTION) * (available as PODOFO_PURE_FUNCTION)
* *
*/ */
/* Automatically defined by CMake when building a shared library */ /* Automatically defined by CMake when building a shared library */
#if defined(podofo_shared_EXPORTS) #if defined(podofo_shared_EXPORTS)
#define COMPILING_SHARED_PODOFO #define COMPILING_SHARED_PODOFO
#undef USING_SHARED_PODOFO
#endif #endif
/* Sanity check - can't be both compiling and using shared podofo */ /* Sanity check - can't be both compiling and using shared podofo */
#if defined(COMPILING_SHARED_PODOFO) && defined(USING_SHARED_PODOFO) #if defined(COMPILING_SHARED_PODOFO) && defined(USING_SHARED_PODOFO)
#error "Both COMPILING_SHARED_PODOFO and USING_SHARED_PODOFO defined!" #error "Both COMPILING_SHARED_PODOFO and USING_SHARED_PODOFO defined!"
#endif #endif
/* /*
* Define COMPILING_SHARED_PODOFO when building the PoDoFo library as a * Define COMPILING_SHARED_PODOFO when building the PoDoFo library as a
* DLL. When building code that uses that DLL, define USING_SHARED_PODOFO. * DLL. When building code that uses that DLL, define USING_SHARED_PODOFO.
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 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/