Pdf3rdPtyForwardDecl.h   Pdf3rdPtyForwardDecl.h 
skipping to change at line 33 skipping to change at line 33
#endif #endif
// Provide access to FT_Library // Provide access to FT_Library
struct FT_LibraryRec_; struct FT_LibraryRec_;
typedef struct FT_LibraryRec_ *FT_Library; typedef struct FT_LibraryRec_ *FT_Library;
// Provide access to FT_Face // Provide access to FT_Face
struct FT_FaceRec_; struct FT_FaceRec_;
typedef struct FT_FaceRec_* FT_Face; typedef struct FT_FaceRec_* FT_Face;
#if defined(HAVE_FONTCONFIG) #if defined(PODOFO_HAVE_FONTCONFIG)
// Fontconfig // Fontconfig
struct _FcConfig; struct _FcConfig;
typedef struct _FcConfig FcConfig; typedef struct _FcConfig FcConfig;
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
}; // end extern "C" }; // end extern "C"
#endif #endif
// end PDF_FT_FORWARD_DECL // end PDF_FT_FORWARD_DECL
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 PdfAcroForm.h   PdfAcroForm.h 
skipping to change at line 33 skipping to change at line 33
#include "PdfDefines.h" #include "PdfDefines.h"
#include "PdfElement.h" #include "PdfElement.h"
namespace PoDoFo { namespace PoDoFo {
class PdfDocument; class PdfDocument;
class PODOFO_API PdfAcroForm : public PdfElement { class PODOFO_API PdfAcroForm : public PdfElement {
public: public:
enum EPdfAcroFormDefaulAppearance {
ePdfAcroFormDefaultAppearance_None, ///< Do not add a default appea
rrance
ePdfAcroFormDefaultAppearance_BlackText12pt ///< Add a default appe
arance with Arial embedded and black text 12pt if no other DA key is presen
t
};
/** Create a new PdfAcroForm dictionary object /** Create a new PdfAcroForm dictionary object
* \param pParent parent of this action * \param pDoc parent of this action
* \param eDefaultAppearance specifies if a default appearance should
be added
*/ */
PdfAcroForm( PdfDocument* pDoc ); PdfAcroForm( PdfDocument* pDoc,
EPdfAcroFormDefaulAppearance eDefaultAppearance = ePdfAcro
FormDefaultAppearance_BlackText12pt );
/** Create a PdfAcroForm dictionary object from an existing PdfObject /** Create a PdfAcroForm dictionary object from an existing PdfObject
* \param pDoc parent document
* \param pObject the object to create from * \param pObject the object to create from
* \param pCatalog the Catalog dictionary of the owning PDF * \param eDefaultAppearance specifies if a default appearance should be added
*/ */
PdfAcroForm( PdfDocument* pDoc, PdfObject* pObject ); PdfAcroForm( PdfDocument* pDoc, PdfObject* pObject,
EPdfAcroFormDefaulAppearance eDefaultAppearance = ePdfAcro
FormDefaultAppearance_BlackText12pt );
virtual ~PdfAcroForm() { } virtual ~PdfAcroForm() { }
/** Get the document that is associated with this /** Get the document that is associated with this
* acro forms dictionary. * acro forms dictionary.
* *
* \returns a valid pointer to the parent document * \returns a valid pointer to the parent document
*/ */
inline PdfDocument* GetDocument(); inline PdfDocument* GetDocument();
/** Set the value of the NeedAppearances key in the interactive forms
* dictionary.
*
* \param bNeedAppearances A flag specifying whether to construct appe
arance streams
* and appearance dictionaries for all widget
annotations in
* the document. Default value is false.
*/
void SetNeedAppearances( bool bNeedAppearances );
/** Retrieve the value of the NeedAppearances key in the interactive fo
rms
* dictionary.
*
* \returns value of the NeedAppearances key
*
* \see SetNeedAppearances
*/
bool GetNeedAppearances() const;
private: private:
/** Initialize this object /** Initialize this object
* with a default appearance * with a default appearance
* \param eDefaultAppearance specifies if a default appearance should be added
*/ */
void Init(); void Init( EPdfAcroFormDefaulAppearance eDefaultAppearance );
private: private:
PdfDocument* m_pDocument; PdfDocument* m_pDocument;
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
PdfDocument* PdfAcroForm::GetDocument() PdfDocument* PdfAcroForm::GetDocument()
{ {
 End of changes. 9 change blocks. 
5 lines changed or deleted 42 lines changed or added


 PdfAction.h   PdfAction.h 
skipping to change at line 118 skipping to change at line 118
PdfString GetScript() const; PdfString GetScript() const;
bool HasScript() const; bool HasScript() const;
/** Get the type of this action /** Get the type of this action
* \returns the type of this action * \returns the type of this action
*/ */
inline EPdfAction GetType() const; inline EPdfAction GetType() const;
/** Adds this action to an dictionary.
* This method handles the all the complexities of making sure it's ad
ded correctly
*
* If this action is empty. Nothing will be added.
*
* \param dictionary the action will be added to this dictionary
*/
void AddToDictionary( PdfDictionary & dictionary ) const;
private: private:
PdfAction( const PdfAction & rhs ); PdfAction( const PdfAction & rhs );
private: private:
static const long s_lNumActions; static const long s_lNumActions;
static const char* s_names[]; static const char* s_names[];
private: private:
EPdfAction m_eType; EPdfAction m_eType;
 End of changes. 1 change blocks. 
0 lines changed or deleted 10 lines changed or added


 PdfArray.h   PdfArray.h 
skipping to change at line 261 skipping to change at line 261
private: private:
bool m_bDirty; ///< Indicates if this object was modified after construction bool m_bDirty; ///< Indicates if this object was modified after construction
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
void PdfArray::Clear() void PdfArray::Clear()
{ {
AssertMutable();
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 ) void PdfArray::push_back( const PdfObject & var )
{ {
AssertMutable();
PdfArrayBaseClass::push_back( var ); PdfArrayBaseClass::push_back( var );
m_bDirty = true; m_bDirty = true;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
size_t PdfArray::size() const size_t PdfArray::size() const
{ {
return PdfArrayBaseClass::size(); return PdfArrayBaseClass::size();
skipping to change at line 302 skipping to change at line 306
bool PdfArray::empty() const bool PdfArray::empty() const
{ {
return PdfArrayBaseClass::empty(); return PdfArrayBaseClass::empty();
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
PdfObject& PdfArray::operator[](size_type __n) PdfObject& PdfArray::operator[](size_type __n)
{ {
AssertMutable();
m_bDirty = true; m_bDirty = true;
return PdfArrayBaseClass::operator[](__n); return PdfArrayBaseClass::operator[](__n);
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
const PdfObject& PdfArray::operator[](size_type __n) const const PdfObject& PdfArray::operator[](size_type __n) const
{ {
return PdfArrayBaseClass::operator[](__n); return PdfArrayBaseClass::operator[](__n);
skipping to change at line 392 skipping to change at line 398
void PdfArray::insert(PdfArray::iterator __position, void PdfArray::insert(PdfArray::iterator __position,
PdfArray::iterator __first, PdfArray::iterator __first,
PdfArray::iterator __last) PdfArray::iterator __last)
#else #else
template<typename _InputIterator> template<typename _InputIterator>
void PdfArray::insert(PdfArray::iterator __position, void PdfArray::insert(PdfArray::iterator __position,
_InputIterator __first, _InputIterator __first,
_InputIterator __last) _InputIterator __last)
#endif #endif
{ {
AssertMutable();
PdfArrayBaseClass::insert( __position, __first, __last ); PdfArrayBaseClass::insert( __position, __first, __last );
m_bDirty = true; m_bDirty = true;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
PdfArray::iterator PdfArray::insert(PdfArray::iterator __position, const Pd fObject & val ) PdfArray::iterator PdfArray::insert(PdfArray::iterator __position, const Pd fObject & val )
{ {
AssertMutable();
m_bDirty = true; m_bDirty = true;
return PdfArrayBaseClass::insert( __position, val ); return PdfArrayBaseClass::insert( __position, val );
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
void PdfArray::erase( iterator pos ) void PdfArray::erase( iterator pos )
{ {
AssertMutable();
PdfArrayBaseClass::erase( pos ); PdfArrayBaseClass::erase( pos );
m_bDirty = true; m_bDirty = true;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
void PdfArray::erase( iterator first, iterator last ) void PdfArray::erase( iterator first, iterator last )
{ {
AssertMutable();
PdfArrayBaseClass::erase( first, last ); PdfArrayBaseClass::erase( first, last );
m_bDirty = true; m_bDirty = true;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
void PdfArray::reserve(size_type __n) void PdfArray::reserve(size_type __n)
{ {
PdfArrayBaseClass::reserve( __n ); PdfArrayBaseClass::reserve( __n );
 End of changes. 7 change blocks. 
0 lines changed or deleted 14 lines changed or added


 PdfCanvas.h   PdfCanvas.h 
skipping to change at line 32 skipping to change at line 32
#define _PDF_CANVAS_H_ #define _PDF_CANVAS_H_
#include "PdfDefines.h" #include "PdfDefines.h"
#include "PdfArray.h" #include "PdfArray.h"
namespace PoDoFo { namespace PoDoFo {
class PdfDictionary; class PdfDictionary;
class PdfObject; class PdfObject;
class PdfRect; class PdfRect;
class PdfColor;
/** A interface that provides the necessary features /** A interface that provides the necessary features
* for a painter to draw onto a PdfObject. * for a painter to draw onto a PdfObject.
*/ */
class PODOFO_API PdfCanvas { class PODOFO_API PdfCanvas {
public: public:
/** Virtual destructor /** Virtual destructor
* to avoid compiler warnings * to avoid compiler warnings
*/ */
virtual ~PdfCanvas() {}; virtual ~PdfCanvas() {};
skipping to change at line 73 skipping to change at line 74
/** 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
*/ */
virtual const PdfRect GetPageSize() const = 0; virtual const PdfRect GetPageSize() const = 0;
/** Get a reference to a static procset PdfArray. /** Get a reference to a static procset PdfArray.
* \returns a reference to a static procset PdfArray * \returns a reference to a static procset PdfArray
*/ */
static const PdfArray & GetProcSet(); static const PdfArray & GetProcSet();
/** Register an object in the resource dictionary of this page or XObbj /** Register a colourspace for a (separation) colour in the resource
ect dictionary
* of this page or XObbject so that it can be used for any followin
g drawing
* operations.
*
* \param rColor reference to the PdfColor
*/
void AddColorResource( const PdfColor & rColor );
/** Register an object in the resource dictionary of this page or XO
bbject
* so that it can be used for any following drawing operations. * so that it can be used for any following drawing operations.
* *
* \param rIdentifier identifier of this object, e.g. /Ft0 * \param rIdentifier identifier of this object, e.g. /Ft0
* \param rRef reference to the object you want to register * \param rRef reference to the object you want to register
* \param rName register under this key in the resource dictionary * \param rName register under this key in the resource dictionary
*/ */
void AddResource( const PdfName & rIdentifier, const PdfReference & rRe f, const PdfName & rName ); void AddResource( const PdfName & rIdentifier, const PdfReference & rRe f, const PdfName & rName );
private: private:
/** The procset is the same for all /** The procset is the same for all
 End of changes. 2 change blocks. 
2 lines changed or deleted 13 lines changed or added


 PdfColor.h   PdfColor.h 
skipping to change at line 29 skipping to change at line 29
************************************************************************** */ ************************************************************************** */
#ifndef _PDF_COLOR_H_ #ifndef _PDF_COLOR_H_
#define _PDF_COLOR_H_ #define _PDF_COLOR_H_
#include "PdfDefines.h" #include "PdfDefines.h"
namespace PoDoFo { namespace PoDoFo {
class PdfArray; class PdfArray;
class PdfObject;
class PdfVecObjects;
/** A color object can represent a either a grayscale /** A color object can represent either a grayscale
* value, a RGB color or a CMYK color. * value, a RGB color, a CMYK color, a separation color or
* a CieLab color.
* *
* All drawing functions in PoDoFo accept a PdfColor object * All drawing functions in PoDoFo accept a PdfColor object
* to specify a drawing color in one of these colorspaces. * to specify a drawing color in one of these colorspaces.
*
* Derived classes PdfColorGray, PdfColorRGB, PdfColorCMYK, PdfColorSepara
tion
* and PdfColorCieLab are available for easy construction
*/ */
class PODOFO_API PdfColor { class PODOFO_API PdfColor {
public: public:
/** Create a PdfColor object that is RGB black. /** Create a PdfColor object that is RGB black.
*/ */
PdfColor(); PdfColor();
/** Create a new PdfColor object with /** Create a new PdfColor object with
* a grayscale value. * a grayscale value.
* *
* \param dGray a grayscalue value between 0.0 and 1.0 * \param dGray a grayscalue value between 0.0 and 1.0
*/ */
PdfColor( double dGray ); PdfColor( double dGray );
/** Create a new PdfColor object with /** Create a new PdfColor object with
* a RGB color * a RGB color
* *
* \param dRed the value of the red component, must be between 0.0 and 1.0 * \param dRed the value of the red component, must be between 0.0 and 1.0
* \param dGreen the value of the green component, must be between 0.0 and 1.0 * \param dGreen the value of the green component, must be between 0.0 and 1.0
* \param dBlue the value of the blue component, must be between 0.0 a nd 1.0 * \param dBlue the value of the blue component, must be between 0.0 a nd 1.0
*/ */
PdfColor( double dRed, double dGreen, double dBlue ); PdfColor( double dRed, double dGreen, double dBlue );
/** Create a new PdfColor object with /** Create a new PdfColor object with
* a CMYK color * a CMYK color
* *
* \param dCyan the value of the cyan component, must be between 0.0 a nd 1.0 * \param dCyan the value of the cyan component, must be between 0.0 a nd 1.0
* \param dMagenta the value of the magenta component, must be between 0.0 and 1.0 * \param dMagenta the value of the magenta component, must be between 0.0 and 1.0
* \param dYellow the value of the yellow component, must be between 0 .0 and 1.0 * \param dYellow the value of the yellow component, must be between 0 .0 and 1.0
* \param dBlack the value of the black component, must be between 0.0 and 1.0 * \param dBlack the value of the black component, must be between 0.0 and 1.0
*/ */
PdfColor( double dCyan, double dMagenta, double dYellow, double dBlack ); PdfColor( double dCyan, double dMagenta, double dYellow, double dBlack );
/** Copy constructor /** Copy constructor
* *
* \param rhs copy rhs into this object * \param rhs copy rhs into this object
*/ */
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
skipping to change at line 116 skipping to change at line 122
* \returns true if this is a RGB PdfColor object * \returns true if this is a RGB PdfColor object
*/ */
inline bool IsRGB() const; inline bool IsRGB() const;
/** Test if this is a CMYK color. /** Test if this is a CMYK color.
* *
* \returns true if this is a CMYK PdfColor object * \returns true if this is a CMYK PdfColor object
*/ */
inline bool IsCMYK() const; inline bool IsCMYK() const;
/** Get the colorspace of this PdfColor object /** Test if this is a separation color.
*
* \returns true if this is a separation PdfColor object
*/
inline bool IsSeparation() const;
/** Test if this is a CIE-Lab color.
*
* \returns true if this is a lab Color object
*/
inline bool IsCieLab() const;
/** Get the colorspace of this PdfColor object
* *
* \returns the colorspace of this PdfColor object * \returns the colorspace of this PdfColor object
*/ */
inline EPdfColorSpace GetColorSpace() const; inline EPdfColorSpace GetColorSpace() const;
/** Get the grayscale color value /** Get the alternate colorspace of this PdfColor object
*
* \returns the colorspace of this PdfColor object (must be separation
)
*/
inline EPdfColorSpace GetAlternateColorSpace() const;
/** Get the grayscale color value
* of this object. * of this object.
* *
* Throws an exception if this is no grayscale color object. * Throws an exception if this is no grayscale color object.
* *
* \returns the grayscale color value of this object (between 0.0 and 1.0) * \returns the grayscale color value of this object (between 0.0 and 1.0)
* *
* \see IsGrayScale * \see IsGrayScale
*/ */
inline double GetGrayScale() const; inline double GetGrayScale() const;
skipping to change at line 169 skipping to change at line 193
* *
* \returns the blue color value of this object (between 0.0 and 1.0) * \returns the blue color value of this object (between 0.0 and 1.0)
* *
* \see IsRGB * \see IsRGB
*/ */
inline double GetBlue() const; inline double GetBlue() const;
/** Get the cyan color value /** Get the cyan color value
* of this object. * of this object.
* *
* Throws an exception if this is no CMYK color object. * Throws an exception if this is no CMYK or separation color object.
* *
* \returns the cyan color value of this object (between 0.0 and 1.0) * \returns the cyan color value of this object (between 0.0 and 1.0)
* *
* \see IsCMYK * \see IsCMYK
*/ */
inline double GetCyan() const; inline double GetCyan() const;
/** Get the magenta color value /** Get the magenta color value
* of this object. * of this object.
* *
* Throws an exception if this is no CMYK color object. * Throws an exception if this is no CMYK or separation color object.
* *
* \returns the magenta color value of this object (between 0.0 and 1. 0) * \returns the magenta color value of this object (between 0.0 and 1. 0)
* *
* \see IsCMYK * \see IsCMYK
*/ */
inline double GetMagenta() const; inline double GetMagenta() const;
/** Get the yellow color value /** Get the yellow color value
* of this object. * of this object.
* *
* Throws an exception if this is no CMYK color object. * Throws an exception if this is no CMYK or separation color object.
* *
* \returns the yellow color value of this object (between 0.0 and 1.0 ) * \returns the yellow color value of this object (between 0.0 and 1.0 )
* *
* \see IsCMYK * \see IsCMYK
*/ */
inline double GetYellow() const; inline double GetYellow() const;
/** Get the black color value /** Get the black color value
* of this object. * of this object.
* *
* Throws an exception if this is no CMYK color object. * Throws an exception if this is no CMYK or separation color object.
* *
* \returns the black color value of this object (between 0.0 and 1.0) * \returns the black color value of this object (between 0.0 and 1.0)
* *
* \see IsCMYK * \see IsCMYK
*/ */
inline double GetBlack() const; inline double GetBlack() const;
/** Converts the color object into a grayscale /** Get the separation name of this object.
*
* Throws an exception if this is no separation color object.
*
* \returns the name of this object
*
* \see IsSeparation
*/
inline const std::string GetName() const;
/** Get the density color value
* of this object.
*
* Throws an exception if this is no separation color object.
*
* \returns the density value of this object (between 0.0 and 1.0)
*
* \see IsSeparation
*/
inline double GetDensity() const;
/** Get the L color value
* of this object.
*
* Throws an exception if this is no CIE-Lab color object.
*
* \returns the L color value of this object (between 0.0 and 100.0)
*
* \see IsCieLab
*/
inline double GetCieL() const;
/** Get the A color value
* of this object.
*
* Throws an exception if this is no CIE-Lab color object.
*
* \returns the A color value of this object (between -128.0 and 127.0
)
*
* \see IsCieLab
*/
inline double GetCieA() const;
/** Get the B color value
* of this object.
*
* Throws an exception if this is no CIE-Lab color object.
*
* \returns the B color value of this object (between -128.0 and 127.0
)
*
* \see IsCieLab
*/
inline double GetCieB() const;
/** Converts the color object into a grayscale
* color object. * color object.
* *
* This is only a convinience function. It might be useful * This is only a convinience function. It might be useful
* for on screen display but is in NO WAY suitable to * for on screen display but is in NO WAY suitable to
* professional printing! * professional printing!
* *
* \returns a grayscale color object * \returns a grayscale color object
* \see IsGrayScale() * \see IsGrayScale()
*/ */
PdfColor ConvertToGrayScale() const; PdfColor ConvertToGrayScale() const;
skipping to change at line 274 skipping to change at line 352
/** Creates a color object from a PdfArray which represents a color. /** Creates a color object from a PdfArray which represents a color.
* *
* Raises an exception if this is no PdfColor! * Raises an exception if this is no PdfColor!
* *
* \param rArray an array that must be a color PdfArray * \param rArray an array that must be a color PdfArray
* \returns a PdfColor object * \returns a PdfColor object
*/ */
static PdfColor FromArray( const PdfArray & rArray ); static PdfColor FromArray( const PdfArray & rArray );
private: /** Creates a colorspace object from a color to insert into resources.
*
* \param pOwner a pointer to the owner of the generated object
* \returns a PdfObject pointer, which can be insert into resources, N
ULL if not needed
*/
PdfObject* BuildColorSpace( PdfVecObjects* pOwner ) const;
protected:
union { union {
double cmyk[4]; double cmyk[4];
double rgb[3]; double rgb[3];
double lab[3];
double gray; double gray;
} m_uColor; } m_uColor;
std::string m_separationName;
double m_separationDensity;
EPdfColorSpace m_eColorSpace; EPdfColorSpace m_eColorSpace;
EPdfColorSpace m_eAlternateColorSpace;
};
class PODOFO_API PdfColorGray : public PdfColor {
public:
/** Create a new PdfColor object with
* a grayscale value.
*
* \param dGray a grayscalue value between 0.0 and 1.0
*/
PdfColorGray( double dGray );
};
class PODOFO_API PdfColorRGB : public PdfColor {
public:
/** Create a new PdfColor object with
* a RGB color
*
* \param dRed the value of the red component, must be between 0.0 and
1.0
* \param dGreen the value of the green component, must be between 0.0
and 1.0
* \param dBlue the value of the blue component, must be between 0.0 a
nd 1.0
*/
PdfColorRGB( double dRed, double dGreen, double dBlue );
};
class PODOFO_API PdfColorCMYK : public PdfColor {
public:
/** Create a new PdfColor object with
* a CMYK color
*
* \param dCyan the value of the cyan component, must be between 0.0 a
nd 1.0
* \param dMagenta the value of the magenta component, must be between
0.0 and 1.0
* \param dYellow the value of the yellow component, must be between 0
.0 and 1.0
* \param dBlack the value of the black component, must be between 0.0
and 1.0
*/
PdfColorCMYK( double dCyan, double dMagenta, double dYellow, double dBl
ack );
};
class PODOFO_API PdfColorSeparationAll : public PdfColor {
public:
/** Create a new PdfColor object with
* Separation color All.
*
*/
PdfColorSeparationAll();
};
class PODOFO_API PdfColorSeparationNone : public PdfColor {
public:
/** Create a new PdfColor object with
* Separation color None.
*
*/
PdfColorSeparationNone();
};
class PODOFO_API PdfColorSeparation : public PdfColor {
public:
/** Create a new PdfColor object with
* a separation-name and an equivalent color
*
* \param sName Name of the separation color
* \param sDensity the density value of the separation color
* \param alternateColor the alternate color, must be of typ gray, rgb
, cmyk or cie
*/
PdfColorSeparation( const std::string & sName, double dDensity, cons
t PdfColor & alternateColor );
};
class PODOFO_API PdfColorCieLab : public PdfColor {
public:
/** Create a new PdfColor object with
* a CIE-LAB-values
*
* \param dCieL the value of the L component, must be between 0.0 and
100.0
* \param dCieA the value of the A component, must be between -128.0 a
nd 127.0
* \param dCieB the value of the B component, must be between -128.0 a
nd 127.0
*/
PdfColorCieLab( double dCieL, double dCieA, double dCieB );
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
PdfColor::PdfColor( const PdfColor & rhs ) PdfColor::PdfColor( const PdfColor & rhs )
{ {
this->operator=( rhs ); this->operator=( rhs );
} }
skipping to change at line 321 skipping to change at line 492
return true; return true;
if ( if (
m_eColorSpace == ePdfColorSpace_DeviceCMYK && m_eColorSpace == ePdfColorSpace_DeviceCMYK &&
m_uColor.cmyk[0] == rhs.m_uColor.cmyk[0] && m_uColor.cmyk[0] == rhs.m_uColor.cmyk[0] &&
m_uColor.cmyk[1] == rhs.m_uColor.cmyk[1] && m_uColor.cmyk[1] == rhs.m_uColor.cmyk[1] &&
m_uColor.cmyk[2] == rhs.m_uColor.cmyk[2] && m_uColor.cmyk[2] == rhs.m_uColor.cmyk[2] &&
m_uColor.cmyk[3] == rhs.m_uColor.cmyk[3] m_uColor.cmyk[3] == rhs.m_uColor.cmyk[3]
) )
return true; return true;
if (
m_eColorSpace == ePdfColorSpace_CieLab
&&
m_uColor.lab[0] == rhs.m_uColor.lab[0]
&&
m_uColor.lab[1] == rhs.m_uColor.lab[1]
&&
m_uColor.lab[2] == rhs.m_uColor.lab[2]
)
return true;
if (
m_eColorSpace == ePdfColorSpace_Separation
&&
m_separationDensity == rhs.m_separationDensity
&&
m_separationName == rhs.m_separationName
&&
m_eAlternateColorSpace == rhs.m_eAlternateColorSpace
&&
(
(
m_eAlternateColorSpace == ePdfColorSpace_DeviceGra
y &&
m_uColor.gray == rhs.m_uColor.gray
)
||
(
m_eAlternateColorSpace == 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]
)
||
(
m_eAlternateColorSpace == ePdfColorSpace_DeviceCMY
K &&
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]
)
||
(
m_eAlternateColorSpace == ePdfColorSpace_CieLab
&&
m_uColor.lab[0] == rhs.m_uColor.lab[0]
&&
m_uColor.lab[1] == rhs.m_uColor.lab[1]
&&
m_uColor.lab[2] == rhs.m_uColor.lab[2]
)
)
)
return true;
} }
return false; return false;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline bool PdfColor::operator!=( const PdfColor & rhs ) const inline bool PdfColor::operator!=( const PdfColor & rhs ) const
{ {
return ! (*this == rhs); return ! (*this == rhs);
skipping to change at line 360 skipping to change at line 573
// //
// ----------------------------------------------------- // -----------------------------------------------------
bool PdfColor::IsCMYK() const bool PdfColor::IsCMYK() const
{ {
return (m_eColorSpace == ePdfColorSpace_DeviceCMYK); return (m_eColorSpace == ePdfColorSpace_DeviceCMYK);
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
bool PdfColor::IsSeparation() const
{
return (m_eColorSpace == ePdfColorSpace_Separation);
}
// -----------------------------------------------------
//
// -----------------------------------------------------
bool PdfColor::IsCieLab() const
{
return (m_eColorSpace == ePdfColorSpace_CieLab);
}
// -----------------------------------------------------
//
// -----------------------------------------------------
EPdfColorSpace PdfColor::GetColorSpace() const EPdfColorSpace PdfColor::GetColorSpace() const
{ {
return m_eColorSpace; return m_eColorSpace;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
EPdfColorSpace PdfColor::GetAlternateColorSpace() const
{
PODOFO_RAISE_LOGIC_IF( !this->IsSeparation(), "PdfColor::GetAlternateCo
lorSpace cannot be called on non separation color objects!");
return m_eAlternateColorSpace;
}
// -----------------------------------------------------
//
// -----------------------------------------------------
double PdfColor::GetGrayScale() const double PdfColor::GetGrayScale() const
{ {
PODOFO_RAISE_LOGIC_IF( (!this->IsGrayScale()), "PdfColor::GetGrayScale PODOFO_RAISE_LOGIC_IF( !this->IsGrayScale() &&
cannot be called on non grayscale color objects!"); !(this->IsSeparation() &&
this->m_eAlternateColorSpace == ePdfColorSpace_DeviceGray),
"PdfColor::GetGrayScale c
annot be called on non grayscale color objects!");
return m_uColor.gray; return m_uColor.gray;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
double PdfColor::GetRed() const double PdfColor::GetRed() const
{ {
PODOFO_RAISE_LOGIC_IF( !this->IsRGB(), "PdfColor::GetRed cannot be call PODOFO_RAISE_LOGIC_IF( !this->IsRGB() &&
ed on non RGB color objects!"); !(this->IsSeparation() &&
this->m_eAlternateColorSpace == ePdfColorSpace_DeviceRGB),
"PdfColor::GetRed cannot
be called on non RGB color objects!");
return m_uColor.rgb[0]; return m_uColor.rgb[0];
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
double PdfColor::GetGreen() const double PdfColor::GetGreen() const
{ {
PODOFO_RAISE_LOGIC_IF( !this->IsRGB(), "PdfColor::GetGreen cannot be ca PODOFO_RAISE_LOGIC_IF( !this->IsRGB() &&
lled on non RGB color objects!"); !(this->IsSeparation() &&
this->m_eAlternateColorSpace == ePdfColorSpace_DeviceRGB),
"PdfColor::GetGreen canno
t be called on non RGB color objects!");
return m_uColor.rgb[1]; return m_uColor.rgb[1];
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
double PdfColor::GetBlue() const double PdfColor::GetBlue() const
{ {
PODOFO_RAISE_LOGIC_IF( !this->IsRGB(), "PdfColor::GetBlue cannot be cal PODOFO_RAISE_LOGIC_IF( !this->IsRGB() &&
led on non RGB color objects!"); !(this->IsSeparation() &&
this->m_eAlternateColorSpace == ePdfColorSpace_DeviceRGB),
"PdfColor::GetBlue cannot
be called on non RGB color objects!");
return m_uColor.rgb[2]; return m_uColor.rgb[2];
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
double PdfColor::GetCyan() const double PdfColor::GetCyan() const
{ {
PODOFO_RAISE_LOGIC_IF( !this->IsCMYK(), "PdfColor::GetCyan cannot be ca PODOFO_RAISE_LOGIC_IF( !this->IsCMYK() &&
lled on non CMYK color objects!"); !(this->IsSeparation() &&
this->m_eAlternateColorSpace == ePdfColorSpace_DeviceCMYK),
"PdfColor::GetCyan cannot
be called on non CMYK color objects!");
return m_uColor.cmyk[0]; return m_uColor.cmyk[0];
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
double PdfColor::GetMagenta() const double PdfColor::GetMagenta() const
{ {
PODOFO_RAISE_LOGIC_IF( !this->IsCMYK(), "PdfColor::GetMagenta cannot be PODOFO_RAISE_LOGIC_IF( !this->IsCMYK() &&
called on non CMYK color objects!"); !(this->IsSeparation() &&
this->m_eAlternateColorSpace == ePdfColorSpace_DeviceCMYK),
"PdfColor::GetMagenta can
not be called on non CMYK color objects!");
return m_uColor.cmyk[1]; return m_uColor.cmyk[1];
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
double PdfColor::GetYellow() const double PdfColor::GetYellow() const
{ {
PODOFO_RAISE_LOGIC_IF( !this->IsCMYK(), "PdfColor::GetYellow cannot be PODOFO_RAISE_LOGIC_IF( !this->IsCMYK() &&
called on non CMYK color objects!"); !(this->IsSeparation() &&
this->m_eAlternateColorSpace == ePdfColorSpace_DeviceCMYK),
"PdfColor::GetYellow cann
ot be called on non CMYK color objects!");
return m_uColor.cmyk[2]; return m_uColor.cmyk[2];
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
double PdfColor::GetBlack() const double PdfColor::GetBlack() const
{ {
PODOFO_RAISE_LOGIC_IF( !this->IsCMYK(), "PdfColor::GetBlack cannot be c PODOFO_RAISE_LOGIC_IF( !this->IsCMYK() &&
alled on non CMYK color objects!"); !(this->IsSeparation() &&
this->m_eAlternateColorSpace == ePdfColorSpace_DeviceCMYK),
"PdfColor::GetBlack canno
t be called on non CMYK color objects!");
return m_uColor.cmyk[3]; return m_uColor.cmyk[3];
} }
// -----------------------------------------------------
//
// -----------------------------------------------------
const std::string PdfColor::GetName() const
{
PODOFO_RAISE_LOGIC_IF( !this->IsSeparation(), "PdfColor::GetName cannot
be called on non separation color objects!");
return m_separationName;
}
// -----------------------------------------------------
//
// -----------------------------------------------------
double PdfColor::GetDensity() const
{
PODOFO_RAISE_LOGIC_IF( !this->IsSeparation(), "PdfColor::GetDensity can
not be called on non separation color objects!");
return m_separationDensity;
}
// -----------------------------------------------------
//
// -----------------------------------------------------
double PdfColor::GetCieL() const
{
PODOFO_RAISE_LOGIC_IF( !this->IsCieLab() &&
!(this->IsSeparation() &&
this->m_eAlternateColorSpace == ePdfColorSpace_CieLab),
"PdfColor::GetCieL cannot
be called on non CIE-Lab color objects!");
return m_uColor.lab[0];
}
// -----------------------------------------------------
//
// -----------------------------------------------------
double PdfColor::GetCieA() const
{
PODOFO_RAISE_LOGIC_IF( !this->IsCieLab() &&
!(this->IsSeparation() &&
this->m_eAlternateColorSpace == ePdfColorSpace_CieLab),
"PdfColor::GetCieA cannot
be called on non CIE-Lab color objects!");
return m_uColor.lab[1];
}
// -----------------------------------------------------
//
// -----------------------------------------------------
double PdfColor::GetCieB() const
{
PODOFO_RAISE_LOGIC_IF( !this->IsCieLab() &&
!(this->IsSeparation() &&
this->m_eAlternateColorSpace == ePdfColorSpace_CieLab),
"PdfColor::GetCieB cannot
be called on non CIE-Lab color objects!");
return m_uColor.lab[2];
}
}; };
#endif // _PDF_COLOR_H_ #endif // _PDF_COLOR_H_
 End of changes. 28 change blocks. 
29 lines changed or deleted 395 lines changed or added


 PdfContents.h   PdfContents.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_CONTENTS_H_ #ifndef _PDF_CONTENTS_H_
#define _PDF_CONTENTS_H_ #define _PDF_CONTENTS_H_
#include "PdfDefines.h" #include "PdfDefines.h"
#include "PdfArray.h" #include "PdfElement.h"
#include "PdfObject.h"
namespace PoDoFo { namespace PoDoFo {
class PdfObject;
class PdfPage;
/** A interface that provides a wrapper around "PDF content" - /** A interface that provides a wrapper around "PDF content" -
the instructions that are used to draw on the PDF "canvas". the instructions that are used to draw on the PDF "canvas".
*/ */
class PODOFO_API PdfContents { class PODOFO_API PdfContents : private PdfElement {
public: public:
/** Construct a new/empty set of contents in the owning objects /** Construct a new/empty set of contents in the owning objects
*/ */
PdfContents( PdfDocument* pParent );
/** Construct a new/empty set of contents in the owning objects
*/
PdfContents( PdfVecObjects* pParent ); PdfContents( PdfVecObjects* pParent );
/** Construct the contents from an existing PdfObject /** Construct the contents from an existing PdfObject
*/ */
PdfContents( PdfObject* inObj ); PdfContents( PdfObject* inObj );
/** Create the contents for an existing page which does not yet
* have a contents object.
*
* \param pParent a /Contents key will be added to this page
* and a contents object will be created.
*/
PdfContents( PdfPage* pParent );
/** Virtual destructor - because ALL destructors should be... /** Virtual destructor - because ALL destructors should be...
*/ */
virtual ~PdfContents() {}; virtual ~PdfContents() {};
/** Get access to the raw contents object. /** Get access to the raw contents object.
* It will either be a PdfStream or a PdfArray * It will either be a PdfStream or a PdfArray
* \returns a contents object * \returns a contents object
*/ */
virtual PdfObject* GetContents() const { return mContObj; } virtual PdfObject* GetContents() const { return mContObj; }
 End of changes. 5 change blocks. 
3 lines changed or deleted 17 lines changed or added


 PdfContentsTokenizer.h   PdfContentsTokenizer.h 
skipping to change at line 39 skipping to change at line 39
namespace PoDoFo { namespace PoDoFo {
class PdfDocument; class PdfDocument;
class PdfCanvas; class PdfCanvas;
class PdfObject; class PdfObject;
/** An enum describing the type of a read token /** An enum describing the type of a read token
*/ */
enum EPdfContentsType { enum EPdfContentsType {
ePdfContentsType_Keyword, ///< A keyword is a PDF function ePdfContentsType_Keyword, /**< The token is a PDF keyword. */
ePdfContentsType_Variant ///< A variant is usually a parameter to a ke ePdfContentsType_Variant, /**< The token is a PDF variant. A variant is
yword usually a parameter to a keyword */
ePdfContentsType_ImageData /**< The "token" is raw inline image data fo
und between ID and EI tags (see PDF ref section 4.8.6) */
}; };
/** This class is a parser for content streams in PDF documents. /** This class is a parser for content streams in PDF documents.
* *
* The parsed content stream can be used and modified in various ways. * The parsed content stream can be used and modified in various ways.
* *
* This class is currently work in progress and subject to change! * This class is currently work in progress and subject to change!
*/ */
class PODOFO_API PdfContentsTokenizer : public PdfTokenizer { class PODOFO_API PdfContentsTokenizer : public PdfTokenizer {
public: public:
/** Construct a PdfContentsTokenizer from an existing buffer. /** Construct a PdfContentsTokenizer from an existing buffer.
* Usually a stream from a PdfPage. * Usually a stream from a PdfPage.
* *
* \param pBuffer pointer to a buffer * \param pBuffer pointer to a buffer
* \param lLen length of the buffer * \param lLen length of the buffer
*/ */
PdfContentsTokenizer( const char* pBuffer, long lLen ) PdfContentsTokenizer( const char* pBuffer, long lLen )
: PoDoFo::PdfTokenizer( pBuffer, lLen ) : PoDoFo::PdfTokenizer( pBuffer, lLen ), m_readingInlineImgData(fal se)
{ {
} }
/** Construct a PdfContentsTokenizer from a PdfCanvas /** Construct a PdfContentsTokenizer from a PdfCanvas
* (i.e. PdfPage or a PdfXObject). * (i.e. PdfPage or a PdfXObject).
* *
* This is more convinient as you do not have * This is more convinient as you do not have
* to care about buffers yourself. * to care about buffers yourself.
* *
* \param pCanvas an object that hold a PDF contents stream * \param pCanvas an object that hold a PDF contents stream
skipping to change at line 82 skipping to change at line 83
virtual ~PdfContentsTokenizer() { } virtual ~PdfContentsTokenizer() { }
/** Read the next keyword or variant, returning true and setting reType if something was read. /** Read the next keyword or variant, returning true and setting reType if something was read.
* Either rpszKeyword or rVariant, but never both, have defined and us able values on * Either rpszKeyword or rVariant, but never both, have defined and us able values on
* true return, with which being controlled by the value of eType. * true return, with which being controlled by the value of eType.
* *
* If EOF is encountered, returns false and leaves eType, pszKeyword a nd * If EOF is encountered, returns false and leaves eType, pszKeyword a nd
* rVariant undefined. * rVariant undefined.
* *
* As a special case, reType may be set to ePdfContentsType_ImageData.
In
* this case rpszzKeyword is undefined, and rVariant contains a PdfDat
a
* variant containing the byte sequence between the ID and BI keywords
* sans the one byte of leading- and trailing- white space. No filter
* decoding is performed.
*
* \param[out] reType will be set to either keyword or variant if true is returned. Undefined * \param[out] reType will be set to either keyword or variant if true is returned. Undefined
* if false is returned. * if false is returned.
* *
* \param[out] rpszKeyword if pType is set to ePdfContentsType_Keyword this will point to the keyword, * \param[out] rpszKeyword if pType is set to ePdfContentsType_Keyword this will point to the keyword,
* otherwise the value is undefined. If set, the value poi nts to memory owned by the * otherwise the value is undefined. If set, the value poi nts to memory owned by the
* PdfContentsTokenizer and must not be freed. The value i s invalidated when ReadNext * PdfContentsTokenizer and must not be freed. The value i s invalidated when ReadNext
* is next called or when the PdfContentsTokenizer is dest royed. * is next called or when the PdfContentsTokenizer is dest royed.
* *
* \param[out] rVariant if pType is set to ePdfContentsType_Variant th * \param[out] rVariant if pType is set to ePdfContentsType_Variant or
is will be set to the read variant, ePdfContentsType_ImageData
* otherwise the value is undefined. * this will be set to the read variant, otherwise the val
ue is undefined.
* *
*/ */
bool ReadNext( EPdfContentsType& reType, const char*& rpszKeyword, PoDo Fo::PdfVariant & rVariant ); bool ReadNext( EPdfContentsType& reType, const char*& rpszKeyword, PoDo Fo::PdfVariant & rVariant );
private: private:
/** Set another objects stream as the current stream for parsing /** Set another objects stream as the current stream for parsing
* *
* \param pObject use the stream of this object for parsing * \param pObject use the stream of this object for parsing
*/ */
void SetCurrentContentsStream( PdfObject* pObject ); void SetCurrentContentsStream( PdfObject* pObject );
bool ReadInlineImgData(EPdfContentsType& reType, const char*& rpszKeywo rd, PoDoFo::PdfVariant & rVariant);
private: private:
PdfRefCountedBuffer m_curBuffer; ///< A copy of the current co ntents stream PdfRefCountedBuffer m_curBuffer; ///< A copy of the current co ntents stream
std::list<PdfObject*> m_lstContents; ///< A list containing pointe rs to all contents objects std::list<PdfObject*> m_lstContents; ///< A list containing pointe rs to all contents objects
bool m_readingInlineImgData; ///< A state of read ing inline image data
}; };
}; };
#endif // _PDF_CONTENTS_TOKENIZER_H_ #endif // _PDF_CONTENTS_TOKENIZER_H_
 End of changes. 6 change blocks. 
7 lines changed or deleted 20 lines changed or added


 PdfData.h   PdfData.h 
skipping to change at line 46 skipping to change at line 46
* for a PDF file! * for a PDF file!
* *
* This class is used in PoDoFo to pad PdfVariants. * This class is used in PoDoFo to pad PdfVariants.
* *
*/ */
class PODOFO_API PdfData : public PdfDataType { class PODOFO_API PdfData : public PdfDataType {
public: public:
/** /**
* Create a new PdfData object with valid PdfData * Create a new PdfData object with valid PdfData
* *
* \param pszData has to be a valid value in a PDF file. * The contained data has to be a valid value in a PDF file.
* It will be written directly to the PDF file. * It will be written directly to the PDF file.
*
* \param pszData a null-terminated string to be copied.
*/ */
PdfData( const char* pszData ) PdfData( const char* pszData )
: PdfDataType(), m_sData( pszData ) : PdfDataType(), m_sData( pszData )
{ {
} }
/**
* Create a new PdfData object with valid PdfData.
*
* \param pszData a char * buffer to be copied.
* \param dataSize size of buffer
*/
PdfData( const char* pszData, size_t dataSize )
: PdfDataType(), m_sData( pszData, dataSize )
{
}
/** Copy an existing PdfData /** Copy an existing PdfData
* \param rhs another PdfData to copy * \param rhs another PdfData to copy
*/ */
PdfData( const PdfData & rhs ) PdfData( const PdfData & rhs )
: PdfDataType() : PdfDataType()
{ {
this->operator=( rhs ); this->operator=( rhs );
} }
/** 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
*/ */
void Write( PdfOutputDevice* pDevice, const PdfEncrypt* pEncrypt = NULL ) const; void Write( PdfOutputDevice* pDevice, const PdfEncrypt* pEncrypt = NULL ) const;
/** Copy an existing PdfData /** Copy an existing PdfData
* \param rhs another PdfData to copy * \param rhs another PdfData to copy
* \returns this object * \returns this object
*/ */
inline const PdfData & operator=( const PdfData & rhs ); inline const PdfData & operator=( const PdfData & rhs );
/**
* Access the data as a std::string
* \returns a const reference to the contained data
*/
inline const std::string & data() const;
private: private:
std::string m_sData; std::string m_sData;
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
const PdfData & PdfData::operator=( const PdfData & rhs ) const PdfData & PdfData::operator=( const PdfData & rhs )
{ {
m_sData = rhs.m_sData; m_sData = rhs.m_sData;
return (*this); return (*this);
} }
// -----------------------------------------------------
//
// -----------------------------------------------------
const std::string & PdfData::data() const {
return m_sData;
}
}; // namespace PoDoFo }; // namespace PoDoFo
#endif /* _PDF_DATATYPE_H_ */ #endif /* _PDF_DATATYPE_H_ */
 End of changes. 4 change blocks. 
2 lines changed or deleted 28 lines changed or added


 PdfDataType.h   PdfDataType.h 
skipping to change at line 77 skipping to change at line 77
/** Sets the dirty flag of this PdfVariant /** Sets the dirty flag of this PdfVariant
* *
* \param bDirty true if this PdfVariant has been * \param bDirty true if this PdfVariant has been
* modified from the outside * modified from the outside
* *
* \see IsDirty * \see IsDirty
*/ */
virtual void SetDirty( bool bDirty ); virtual void SetDirty( bool bDirty );
/**
* Sets this object to immutable,
* so that no keys can be edited or changed.
*
* @param bImmutable if true set the object to be immutable
*
* This is used by PdfImmediateWriter and PdfStreamedDocument so
* that no keys can be added to an object after setting stream data on
it.
*
*/
inline void SetImmutable(bool bImmutable);
/**
* Retrieve if an object is immutable.
*
* This is used by PdfImmediateWriter and PdfStreamedDocument so
* that no keys can be added to an object after setting stream data on
it.
*
* @returns true if the object is immutable
*/
inline bool GetImmutable() const;
protected:
/**
* Will throw an exception if called on an immutable object,
* so this should be called before actually changing a value!
*
*/
inline void AssertMutable() const;
private:
bool m_bImmutable;
}; };
// -----------------------------------------------------
//
// -----------------------------------------------------
inline void PdfDataType::SetImmutable(bool bImmutable)
{
m_bImmutable = bImmutable;
}
// -----------------------------------------------------
//
// -----------------------------------------------------
inline bool PdfDataType::GetImmutable() const
{
return m_bImmutable;
}
// -----------------------------------------------------
//
// -----------------------------------------------------
inline void PdfDataType::AssertMutable() const
{
if(m_bImmutable)
{
throw new PdfError( ePdfError_ChangeOnImmutable );
}
}
}; // namespace PoDoFo }; // namespace PoDoFo
#endif /* _PDF_DATATYPE_H_ */ #endif /* _PDF_DATATYPE_H_ */
 End of changes. 2 change blocks. 
0 lines changed or deleted 61 lines changed or added


 PdfDate.h   PdfDate.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_DATE_H_ #ifndef _PDF_DATE_H_
#define _PDF_DATE_H_ #define _PDF_DATE_H_
#include "PdfDefines.h" #include "PdfDefines.h"
#include "PdfString.h" #include "PdfString.h"
#include <ctime>
// a PDF date has a maximum of 26 bytes incuding the terminating \0 // a PDF date has a maximum of 26 bytes incuding the terminating \0
#define PDF_DATE_BUFFER_SIZE 26 #define PDF_DATE_BUFFER_SIZE 26
namespace PoDoFo { namespace PoDoFo {
/** This class is a date datatype as specified in the PDF /** This class is a date datatype as specified in the PDF
* reference. You can easily convert from Unix time_t to * reference. You can easily convert from Unix time_t to
* the PDF time representation and back. Dates like these * the PDF time representation and back. Dates like these
* are used for example in the PDF info dictionary for the * are used for example in the PDF info dictionary for the
* creation time and date of the PDF file. * creation time and date of the PDF file.
 End of changes. 1 change blocks. 
0 lines changed or deleted 2 lines changed or added


 PdfDefines.h   PdfDefines.h 
skipping to change at line 31 skipping to change at line 31
#ifndef _PDF_DEFINES_H_ #ifndef _PDF_DEFINES_H_
#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 #include "PdfCompilerCompat.h"
#if _MSC_VER <= 1200 // Visual Studio 6
#pragma warning(disable: 4786) /**
#pragma warning(disable: 4251) * PoDoFo version - 24-bit integer representation.
#elif _MSC_VER <= 1400 // Visual Studio 2005 * Version is 0xMMmmpp where M is major, m is minor and p is patch
#pragma warning(disable: 4251) * eg 0.7.0 is represented as 0x000700
#pragma warning(disable: 4275) * eg 0.7.99 is represented as 0x000763
#endif // _MSC_VER *
#endif // _MSC_VER * Note that the PoDoFo version is available in parts as individual 8-bit
* integer literals in PODOFO_VERSION_MAJOR, PODOFO_VERSION_MINOR and
* PODOFO_VERSION_PATCH .
*/
#define PODOFO_MAKE_VERSION_REAL(M,m,p) ( (M<<16)+(m<<8)+(p) )
#define PODOFO_MAKE_VERSION(M,m,p) PODOFO_MAKE_VERSION_REAL(M,m,p)
#define PODOFO_VERSION PODOFO_MAKE_VERSION(PODOFO_VERSION_MAJOR, PODOFO_VER
SION_MINOR, PODOFO_VERSION_PATCH)
/**
* PoDoFo version represented as a string literal, eg '0.7.99'
*/
#define PODOFO_MAKE_VERSION_STR_REAL(M,m,p) ("\"" #M "." #m "." #p "\"")
#define PODOFO_MAKE_VERSION_STR(M,m,p) PODOFO_MAKE_VERSION_STR_REAL(M,m,p)
#define PODOFO_VERSION_STR PODOFO_MAKE_VERSION_STR(PODOFO_VERSION_MAJOR, PO
DOFO_VERSION_MINOR, PODOFO_VERSION_PATCH)
// Include common system files // Include common system files
#include <cstdio> // (most are now pulled in my PdfCompilerCompat.h)
#include <wchar.h>
// Include common STL files // Include common STL files
#include <map> #include <map>
#include <string> #include <string>
#include <vector> #include <vector>
#include <set> #include <set>
// Include common BOOST settings // Include common BOOST settings
#ifdef HAVE_BOOST #ifdef PODOFO_HAVE_BOOST
#include <boost/config.hpp> #include <boost/config.hpp>
#endif // HAVE_BOOST #endif // PODOFO_HAVE_BOOST
/** \def PODOFO_VERBOSE_DEBUG /** \def PODOFO_VERBOSE_DEBUG
* Debug define. Enable it, if you need * Debug define. Enable it, if you need
* 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> #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.
//
// If you don't know you need this, avoid it.
//
#ifndef PODOFO_EXTRA_CHECKS #ifndef PODOFO_EXTRA_CHECKS
//#define PODOFO_EXTRA_CHECKS //#define PODOFO_EXTRA_CHECKS
#endif //PODOFO_EXTRA_CHECKS #endif //PODOFO_EXTRA_CHECKS
// Error Handling Defines // Error Handling Defines
#include "PdfError.h" #include "PdfError.h"
// Memory management
#include "PdfMemoryManagement.h"
// Include API macro definitions // Include API macro definitions
#include "podofoapi.h" #include "podofoapi.h"
// By default, PoDoFo will use C++ locale support to ensure that // By default, PoDoFo will use C++ locale support to ensure that
// it doesn't write bad PDF data - particularly floating point numbers. // it doesn't write bad PDF data - particularly floating point numbers.
// If your standard library does not support locales this won't work, but // If your standard library does not support locales this won't work, but
// your STL probably writes all data in a POSIX-like way irrespective of // your STL probably writes all data in a POSIX-like way irrespective of
// locale. If you set this to 0, you MUST use some other method to ensure // locale. If you set this to 0, you MUST use some other method to ensure
// that streams used by PoDoFo will write data in a POSIX locale like manne r. // that streams used by PoDoFo will write data in a POSIX locale like manne r.
#ifndef USE_CXX_LOCALE #ifndef USE_CXX_LOCALE
skipping to change at line 120 skipping to change at line 131
* *
* All classes, functions, types and enums of PoDoFo * All classes, functions, types and enums of PoDoFo
* are members of these namespace. * are members of these namespace.
* *
* If you use PoDoFo, you might want to add the line: * If you use PoDoFo, you might want to add the line:
* using namespace PoDoFo; * using namespace PoDoFo;
* to your application. * to your application.
*/ */
namespace PoDoFo { namespace PoDoFo {
// Datatypes which are required to have a certain size when porting /* Explicitly big-endian short, suitable for unicode text */
/**
* unsigned int which is defined to be 32 bits wide.
*/
typedef unsigned int pdf_uint32;
typedef unsigned short pdf_uint16;
typedef signed short pdf_int16;
typedef pdf_uint16 pdf_utf16be; typedef pdf_uint16 pdf_utf16be;
/* Typedef to indicate utf-8 encoded data */
typedef unsigned char pdf_utf8; typedef unsigned char pdf_utf8;
// Enums // Enums
/** /**
* Enum to identify diferent versions of the PDF file format * Enum to identify diferent versions of the PDF file format
*/ */
enum EPdfVersion { enum EPdfVersion {
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 */
skipping to change at line 198 skipping to change at line 202
ePdfFilter_FlateDecode, /**< Compress data using the Flat e algorithm of ZLib. This filter is recommended to be used always. \see Pdf FlateFilter */ ePdfFilter_FlateDecode, /**< Compress data using the Flat e algorithm of ZLib. This filter is recommended to be used always. \see Pdf FlateFilter */
ePdfFilter_RunLengthDecode, /**< Run length decode data. \see PdfRLEFilter */ ePdfFilter_RunLengthDecode, /**< Run length decode data. \see PdfRLEFilter */
ePdfFilter_CCITTFaxDecode, ePdfFilter_CCITTFaxDecode,
ePdfFilter_JBIG2Decode, ePdfFilter_JBIG2Decode,
ePdfFilter_DCTDecode, ePdfFilter_DCTDecode,
ePdfFilter_JPXDecode, ePdfFilter_JPXDecode,
ePdfFilter_Crypt ePdfFilter_Crypt
}; };
/** /**
* Enum for the three colorspaces supported * Enum for the colorspaces supported
* by PDF. * by PDF.
*/ */
enum EPdfColorSpace { enum EPdfColorSpace {
ePdfColorSpace_DeviceGray, /**< Gray */ ePdfColorSpace_DeviceGray, /**< Gray */
ePdfColorSpace_DeviceRGB, /**< RGB */ ePdfColorSpace_DeviceRGB, /**< RGB */
ePdfColorSpace_DeviceCMYK /**< CMYK */ ePdfColorSpace_DeviceCMYK, /**< CMYK */
ePdfColorSpace_Separation, /**< Separation */
ePdfColorSpace_CieLab /**< CIE-Lab */
}; };
/** /**
* Enum for the different stroke styles that can be set * Enum for the different stroke styles that can be set
* when drawing to a PDF file (mostly for line drawing). * when drawing to a PDF file (mostly for line drawing).
*/ */
enum EPdfStrokeStyle { enum EPdfStrokeStyle {
ePdfStrokeStyle_Solid, ePdfStrokeStyle_Solid,
ePdfStrokeStyle_Dash, ePdfStrokeStyle_Dash,
ePdfStrokeStyle_Dot, ePdfStrokeStyle_Dot,
skipping to change at line 399 skipping to change at line 405
'>', '>',
'[', '[',
']', ']',
'{', '{',
'}', '}',
'/', '/',
'%', '%',
'\0' // end marker '\0' // end marker
}; };
};
// macros
/** /**
* \def PDF_MAX(x,y) * PDF_MAX(x,y)
*
* \returns the maximum of x and y * \returns the maximum of x and y
*/ */
#define PDF_MAX(x,y) ((x)>(y)?(x):(y)) // Not actually a macro, because function-like macros are evil and
// prone to nasty issues with double-evaluation of arguments.
template <typename T> const T PDF_MAX ( const T a, const T b ) {
return (b<a)?a:b;
}
/** /**
* \def PDF_MIN(x,y) * 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)) // Not actually a macro, because function-like macros are evil and
// prone to nasty issues with double-evaluation of arguments.
template <typename T> const T PDF_MIN ( const T a, const T b ) {
return (a<b)?a:b;
}
/** }; // end namespace PoDoFo
* \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
*/
#ifdef _MSC_VER
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#endif
/** /**
* \mainpage * \mainpage
* *
* <b>PoDoFo</b> is a library to work with the PDF file format and includes also a few * <b>PoDoFo</b> is a library to work with the PDF file format and includes also a few
* tools. The name comes from the first letter of PDF (Portable Document * tools. The name comes from the first letter of PDF (Portable Document
* Format). * Format).
* *
* The <b>PoDoFo</b> library is a free portable C++ library which includes * The <b>PoDoFo</b> library is a free portable C++ library which includes
* classes to parse a PDF file and modify its contents into memory. The cha nges * classes to parse a PDF file and modify its contents into memory. The cha nges
 End of changes. 17 change blocks. 
59 lines changed or deleted 54 lines changed or added


 PdfDictionary.h   PdfDictionary.h 
skipping to change at line 30 skipping to change at line 30
#ifndef _PDF_DICTIONARY_H_ #ifndef _PDF_DICTIONARY_H_
#define _PDF_DICTIONARY_H_ #define _PDF_DICTIONARY_H_
#include "PdfDefines.h" #include "PdfDefines.h"
#include "PdfDataType.h" #include "PdfDataType.h"
#include "PdfName.h" #include "PdfName.h"
#include "PdfObject.h" #include "PdfObject.h"
/**
* PODOFO_USE_UNORDERED_MAP
*
* If you set this define, PoDoFo
* will use std::tr1::unordered_map instead
* of std::map for PdfDictionary.
*
* Some benchmarking tests using callgrind have shown
* that unordered_map is a little faster for writing and AddKey
* but of course slower for GetKey and HasKey. As PdfDictionaries
* are usually very small the difference for GetKey and HasKey is
* not very large and should therefore be rarely noticeable.
*
* By default this define is not set and std::map will be used.
*/
#ifdef PODOFO_USE_UNORDERED_MAP
#include <tr1/unordered_map>
#endif // PODOFO_USE_ORDERED_MAP
namespace PoDoFo { namespace PoDoFo {
#ifdef PODOFO_USE_UNORDERED_MAP
class PdfNameHash : public std::unary_function<PdfName, size_t>
{
public:
size_t operator()( const PdfName& v ) const
{
std::tr1::hash<std::string> hasher;
return hasher( v.GetName() );
}
};
typedef std::tr1::unordered_map<PdfName,PdfObject*, PdfNameHash> TKeyM
ap;
#else
typedef std::map<PdfName,PdfObject*> TKeyMap; typedef std::map<PdfName,PdfObject*> TKeyMap;
#endif // PODOFO_USE_UNORDERED_MAP
typedef TKeyMap::iterator TIKeyMap; typedef TKeyMap::iterator TIKeyMap;
typedef TKeyMap::const_iterator TCIKeyMap; typedef TKeyMap::const_iterator TCIKeyMap;
class PdfOutputDevice; class PdfOutputDevice;
class PODOFO_API PdfDictionary : public PdfDataType { class PODOFO_API PdfDictionary : public PdfDataType {
public: public:
/** Create a new, empty dictionary /** Create a new, empty dictionary
*/ */
PdfDictionary(); PdfDictionary();
skipping to change at line 132 skipping to change at line 167
* 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.
* It may be modified but is still owned by the dictionary so it MUST n ot * It may be modified but is still owned by the dictionary so it MUST n ot
* 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 long GetKeyAsLong( const PdfName & key, long long lDefault = 0 ) c onst;
double GetKeyAsReal( const PdfName & key, double dDefault = 0.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
* *
skipping to change at line 219 skipping to change at line 254
*/ */
virtual void SetDirty( bool bDirty ); virtual void SetDirty( bool bDirty );
private: private:
TKeyMap m_mapKeys; TKeyMap m_mapKeys;
bool m_bDirty; ///< Indicates if this object was modified after construction bool m_bDirty; ///< Indicates if this object was modified after construction
}; };
typedef std::vector<PdfDictionary*> TVecDictionaries; typedef std::vector<PdfDictionary*> TVecDictionaries;
typedef TVecDictionaries::iterator oTIVecDictionaries; typedef TVecDictionaries::iterator TIVecDictionaries;
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. 5 change blocks. 
2 lines changed or deleted 38 lines changed or added


 PdfDifferenceEncoding.h   PdfDifferenceEncoding.h 
skipping to change at line 99 skipping to change at line 99
* \param rArray write to this array * \param rArray write to this array
*/ */
void ToArray( PdfArray & rArray ); void ToArray( PdfArray & rArray );
/** Get the number of differences in this object. /** Get the number of differences in this object.
* If the user added .notdef as a difference it is * If the user added .notdef as a difference it is
* counted, even it is no real difference in the final encoding. * counted, even it is no real difference in the final encoding.
* *
* \returns the number of differences in this object * \returns the number of differences in this object
*/ */
inline int GetCount() const; inline size_t GetCount() const;
private: private:
struct DifferenceComparatorPredicate { struct DifferenceComparatorPredicate {
public: public:
inline bool operator()( const TDifference & rDif1, inline bool operator()( const TDifference & rDif1,
const TDifference & rDif2 ) const { const TDifference & rDif2 ) const {
return rDif1.nCode < rDif2.nCode; return rDif1.nCode < rDif2.nCode;
} }
}; };
TVecDifferences m_vecDifferences; TVecDifferences m_vecDifferences;
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline int PdfEncodingDifference::GetCount() const inline size_t PdfEncodingDifference::GetCount() const
{ {
return m_vecDifferences.size(); return m_vecDifferences.size();
} }
/** PdfDifferenceEncoding is an encoding, which is based /** PdfDifferenceEncoding is an encoding, which is based
* on either the fonts encoding or a predefined encoding * on either the fonts encoding or a predefined encoding
* and defines differences to this base encoding. * and defines differences to this base encoding.
*/ */
class PODOFO_API PdfDifferenceEncoding : public PdfEncoding, private PdfEle ment { class PODOFO_API PdfDifferenceEncoding : public PdfEncoding, private PdfEle ment {
public: public:
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 PdfDocument.h   PdfDocument.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_DOCUMENT_H_ #ifndef _PDF_DOCUMENT_H_
#define _PDF_DOCUMENT_H_ #define _PDF_DOCUMENT_H_
#include "PdfDefines.h" #include "PdfDefines.h"
#include "PdfAcroForm.h"
#include "PdfFontCache.h" #include "PdfFontCache.h"
#include "PdfInfo.h" #include "PdfInfo.h"
#include "PdfObject.h" #include "PdfObject.h"
#include "PdfParser.h" #include "PdfParser.h"
#include "PdfWriter.h" #include "PdfWriter.h"
namespace PoDoFo { namespace PoDoFo {
class PdfAcroForm;
class PdfDestination; class PdfDestination;
class PdfDictionary; class PdfDictionary;
class PdfFileSpec; class PdfFileSpec;
class PdfFont; class PdfFont;
class PdfInfo; class PdfInfo;
class PdfMemDocument; class PdfMemDocument;
class PdfNamesTree; class PdfNamesTree;
class PdfOutlines; class PdfOutlines;
class PdfPage; class PdfPage;
class PdfPagesTree; class PdfPagesTree;
skipping to change at line 93 skipping to change at line 93
* You can set the author, title etc. of the * You can set the author, title etc. of the
* document using the info dictionary. * document using the info dictionary.
* *
* \returns the info dictionary * \returns the info dictionary
*/ */
PdfInfo* GetInfo() const { return m_pInfo; } PdfInfo* GetInfo() const { return m_pInfo; }
/** Get access to the Outlines (Bookmarks) dictionary /** Get access to the Outlines (Bookmarks) dictionary
* The returned outlines object is owned by the PdfDocument. * The returned outlines object is owned by the PdfDocument.
* *
* \param bCreate create the object if it does not exist (ePdfCreateOb
ject)
* or return NULL if it does not exist
* \returns the Outlines/Bookmarks dictionary * \returns the Outlines/Bookmarks dictionary
*/ */
PdfOutlines* GetOutlines( bool bCreate = ePdfCreateObject ); PdfOutlines* GetOutlines( bool bCreate = ePdfCreateObject );
/** Get access to the Names dictionary (where all the named objects are stored) /** Get access to the Names dictionary (where all the named objects are stored)
* The returned PdfNamesTree object is owned by the PdfDocument. * The returned PdfNamesTree object is owned by the PdfDocument.
* *
* \param bCreate create the object if it does not exist (ePdfCreateOb
ject)
* or return NULL if it does not exist
* \returns the Names dictionary * \returns the Names dictionary
*/ */
PdfNamesTree* GetNamesTree( bool bCreate = ePdfCreateObject ); PdfNamesTree* GetNamesTree( bool bCreate = ePdfCreateObject );
/** Get access to the AcroForm dictionary /** Get access to the AcroForm dictionary
*
* \param bCreate create the object if it does not exist (ePdfCreateOb
ject)
* or return NULL if it does not exist
* \param eDefaultAppearance specifies if a default appearence shall b
e created
*
* \returns PdfObject the AcroForm dictionary * \returns PdfObject the AcroForm dictionary
*/ */
PdfAcroForm* GetAcroForm( bool bCreate = ePdfCreateObject ); PdfAcroForm* GetAcroForm( bool bCreate = ePdfCreateObject,
PdfAcroForm::EPdfAcroFormDefaulAppearance eDe
faultAppearance = PdfAcroForm::ePdfAcroFormDefaultAppearance_BlackText12pt)
;
/** Get access to the pages tree. /** Get access to the pages tree.
* Better use GetPage and CreatePage methods. * Better use GetPage and CreatePage methods.
* \returns the PdfPagesTree of this document. * \returns the PdfPagesTree of this document.
*/ */
inline PdfPagesTree* GetPagesTree() const; inline PdfPagesTree* GetPagesTree() const;
/** Get the total number of pages in a document /** Get the total number of pages in a document
* \returns int number of pages * \returns int number of pages
*/ */
skipping to change at line 139 skipping to change at line 149
/** 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 = PdfEncodingFactory::GlobalPdfDocEncodingInstance(), PdfFont* CreateFont( const char* pszFontName, const PdfEncoding * const pEncoding = PdfEncodingFactory::GlobalWinAnsiEncodingInstance(),
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 = PdfEncodingF actory::GlobalPdfDocEncodingInstance(), const PdfEncoding * const pEncoding = PdfEncodingF actory::GlobalWinAnsiEncodingInstance(),
bool bEmbedd = true, const char* pszFileName = NUL L ); bool bEmbedd = true, const char* pszFileName = NUL L );
#ifdef _WIN32 #ifdef _WIN32
/** 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.
* *
* This is an overloaded member function to allow working * This is an overloaded member function to allow working
* with unicode characters. On Unix systes you can also path * with unicode characters. On Unix systes you can also path
* UTF-8 to the const char* overload. * UTF-8 to the const char* overload.
*/ */
PdfFont* CreateFont( const wchar_t* pszFontName, const PdfEncoding * co nst pEncoding = PdfEncodingFactory::GlobalPdfDocEncodingInstance(), PdfFont* CreateFont( const wchar_t* pszFontName, const PdfEncoding * co nst pEncoding = PdfEncodingFactory::GlobalWinAnsiEncodingInstance(),
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.
* *
* This is an overloaded member function to allow working * This is an overloaded member function to allow working
* with unicode characters. On Unix systes you can also path * with unicode characters. On Unix systes you can also path
* UTF-8 to the const char* overload. * UTF-8 to the const char* overload.
*/ */
PdfFont* CreateFont( const wchar_t* pszFontName, bool bBold, bool bItal ic, PdfFont* CreateFont( const wchar_t* pszFontName, bool bBold, bool bItal ic,
const PdfEncoding * const pEncoding = PdfEncodingF actory::GlobalPdfDocEncodingInstance(), const PdfEncoding * const pEncoding = PdfEncodingF actory::GlobalWinAnsiEncodingInstance(),
bool bEmbedd = true); bool bEmbedd = true);
#endif // _WIN32 #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 = PdfEncodingFactory::GlobalPdfDocEncodingInstance(), bool bEmbedd = true ) ; PdfFont* CreateFont( FT_Face face, const PdfEncoding * const pEncoding = PdfEncodingFactory::GlobalWinAnsiEncodingInstance(), bool bEmbedd = true );
/** Creates a font subset which contains only a few characters and is e /** Creates a duplicate Type1-PdfFont with a new Id
mbedded. * \param pFont is the existing font
* \param pszSuffix Suffix to add to font-id
* The returned object is owned by the PdfDocument.
*
* TODO: DS: Make this generic so that it will work
* for any font type!
*/
PdfFont* CreateDuplicateFontType1( PdfFont * pFont, const char * psz
Suffix );
/** Creates a font subset which contains only a few characters and i
s embedded.
* *
* THIS WORKS ONLY FOR TTF FONTS! * THIS WORKS ONLY FOR TTF FONTS!
* *
* \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.
* *
* \returns PdfFont* a pointer to a new PdfFont object. * \returns PdfFont* a pointer to a new PdfFont object.
*/ */
PdfFont* CreateFontSubset( const char* pszFontName, bool bBold, bool bI talic, PdfFont* CreateFontSubset( const char* pszFontName, bool bBold, bool bI talic,
const PdfEncoding * const = PdfEncodingFactor y::GlobalPdfDocEncodingInstance(), const PdfEncoding * const = PdfEncodingFactor y::GlobalWinAnsiEncodingInstance(),
const char* pszFileName = NULL); const char* pszFileName = NULL);
#ifdef _WIN32 #ifdef _WIN32
/** Creates a font subset which contains only a few characters and is e mbedded. /** Creates a font subset which contains only a few characters and is e mbedded.
* *
* THIS WORKS ONLY FOR TTF FONTS! * THIS WORKS ONLY FOR TTF FONTS!
* *
* \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.
* *
* \returns PdfFont* a pointer to a new PdfFont object. * \returns PdfFont* a pointer to a new PdfFont object.
* *
* This is an overloaded member function to allow working * This is an overloaded member function to allow working
* with unicode characters. On Unix systes you can also path * with unicode characters. On Unix systes you can also path
* UTF-8 to the const char* overload. * UTF-8 to the const char* overload.
*/ */
PdfFont* CreateFontSubset( const wchar_t* pszFontName, bool bBold, bool bItalic, PdfFont* CreateFontSubset( const wchar_t* pszFontName, bool bBold, bool bItalic,
const PdfEncoding * const = PdfEncodingFactor y::GlobalPdfDocEncodingInstance() ); const PdfEncoding * const = PdfEncodingFactor y::GlobalWinAnsiEncodingInstance() );
#endif // _WIN32 #endif // _WIN32
// Peter Petrov 26 April 2008 // Peter Petrov 26 April 2008
/** Returns the font library from font cache /** Returns the font library from font cache
* *
* \returns the internal handle to the freetype library * \returns the internal handle to the freetype library
*/ */
inline FT_Library GetFontLibrary() const; inline FT_Library GetFontLibrary() const;
/** Creates a new page object and inserts it into the internal /** Creates a new page object and inserts it into the internal
skipping to change at line 430 skipping to change at line 450
/** 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.
*/ */
virtual bool IsHighPrintAllowed() const = 0; virtual bool IsHighPrintAllowed() const = 0;
// Peter Petrov 26 April 2008
/** Get access to the internal vector of objects
* or root object.
*
* \returns the vector of objects
*/
inline PdfVecObjects* GetObjects();
// Peter Petrov 26 April 2008
/** Get access to the internal vector of objects
* or root object.
*
* \returns the vector of objects
*/
inline const PdfVecObjects* GetObjects() const;
protected: protected:
/** Construct a new (empty) PdfDocument /** Construct a new (empty) PdfDocument
*/ */
PdfDocument(); PdfDocument();
/** Set the info object containing meta information. /** Set the info object containing meta information.
* Deletes any old info object. * Deletes any old info object.
* *
* @param pInfo the new info object (will be owned by PdfDocument) * @param pInfo the new info object (will be owned by PdfDocument)
*/ */
skipping to change at line 484 skipping to change at line 520
* \returns PdfObject the documents catalog * \returns PdfObject the documents catalog
*/ */
inline const PdfObject* GetTrailer() const; inline const PdfObject* GetTrailer() const;
/** Set the trailer of this PdfDocument /** Set the trailer of this PdfDocument
* deleting the old one. * deleting the old one.
* *
* @param pObject the new trailer object * @param pObject the new trailer object
* It will be owned by PdfDocument. * It will be owned by PdfDocument.
*/ */
inline void SetTrailer( PdfObject* pObject ); void SetTrailer( PdfObject* pObject );
/** Get access to the internal vector of objects
* or root object.
*
* \returns the vector of objects
*/
inline PdfVecObjects* GetObjects();
/** Get access to the internal vector of objects
* or root object.
*
* \returns the vector of objects
*/
inline const PdfVecObjects* GetObjects() const;
/** 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 for initializing the pages tree for this document /** Internal method for initializing the pages tree for this document
*/ */
void InitPagesTree(); void InitPagesTree();
skipping to change at line 567 skipping to change at line 589
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline PdfPagesTree* PdfDocument::GetPagesTree() const inline PdfPagesTree* PdfDocument::GetPagesTree() const
{ {
return m_pPagesTree; return m_pPagesTree;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline void PdfDocument::SetInfo( PdfInfo* pInfo )
{
delete m_pInfo;
m_pInfo = pInfo;
}
// -----------------------------------------------------
//
// -----------------------------------------------------
inline PdfObject* PdfDocument::GetCatalog() inline PdfObject* PdfDocument::GetCatalog()
{ {
return m_pCatalog; return m_pCatalog;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline const PdfObject* PdfDocument::GetCatalog() const inline const PdfObject* PdfDocument::GetCatalog() const
{ {
skipping to change at line 618 skipping to change at line 631
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline const PdfObject* PdfDocument::GetTrailer() const inline const PdfObject* PdfDocument::GetTrailer() const
{ {
return m_pTrailer; return m_pTrailer;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline void PdfDocument::SetTrailer( PdfObject* pObject )
{
delete m_pTrailer;
m_pTrailer = pObject;
// Set owner so that GetIndirectKey will work
m_pTrailer->SetOwner( &m_vecObjects );
}
// -----------------------------------------------------
//
// -----------------------------------------------------
inline PdfVecObjects* PdfDocument::GetObjects() inline PdfVecObjects* PdfDocument::GetObjects()
{ {
return &m_vecObjects; return &m_vecObjects;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline const PdfVecObjects* PdfDocument::GetObjects() const inline const PdfVecObjects* PdfDocument::GetObjects() const
{ {
 End of changes. 18 change blocks. 
46 lines changed or deleted 55 lines changed or added


 PdfElement.h   PdfElement.h 
skipping to change at line 81 skipping to change at line 81
PdfElement( const char* pszType, PdfVecObjects* pParent ); PdfElement( const char* pszType, PdfVecObjects* pParent );
/** Creates a new PdfElement /** Creates a new PdfElement
* \param pszType type entry of the elements object * \param pszType type entry of the elements object
* \param pParent parent PdfDocument. * \param pParent parent PdfDocument.
* Add a newly created object to this vector. * Add a newly created object to this vector.
*/ */
PdfElement( const char* pszType, PdfDocument* pParent ); PdfElement( const char* pszType, PdfDocument* pParent );
/** Create a PdfElement from an existing PdfObject /** Create a PdfElement from an existing PdfObject
* The object must be a dictionary.
*
* \param pszType type entry of the elements object. * \param pszType type entry of the elements object.
* Throws an exception if the type in the * Throws an exception if the type in the
* PdfObject differs from pszType. * PdfObject differs from pszType.
* \param pObject pointer to the PdfObject that is modified * \param pObject pointer to the PdfObject that is modified
* by this PdfElement * by this PdfElement
*/ */
PdfElement( const char* pszType, PdfObject* pObject ); PdfElement( const char* pszType, PdfObject* pObject );
/** Create a PdfElement from an existing PdfObject
* The object might be of any data type,
* PdfElement will throw an exception if the PdfObject
* if not of the same datatype as the expected one.
* This is necessary in rare cases. E.g. in PdfContents.
*
* \param eExpectedDataType the expected datatype of this object
* \param pObject pointer to the PdfObject that is modified
* by this PdfElement
*/
PdfElement( EPdfDataType eExpectedDataType, PdfObject* pObject );
/** Convert an enum or index to its string representation /** Convert an enum or index to its string representation
* which can be written to the PDF file. * which can be written to the PDF file.
* *
* This is a helper function for various PdfElement * This is a helper function for various PdfElement
* subclasses that need strings and enums for their * subclasses that need strings and enums for their
* SubTypes keys. * SubTypes keys.
* *
* \param i the index or enum value * \param i the index or enum value
* \param ppTypes an array of strings containing * \param ppTypes an array of strings containing
* the string mapping of the index * the string mapping of the index
 End of changes. 2 change blocks. 
0 lines changed or deleted 14 lines changed or added


 PdfEncoding.h   PdfEncoding.h 
skipping to change at line 404 skipping to change at line 404
* 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: protected:
Util::PdfMutex m_mutex; ///< Mutex for the creation of the encoding t able Util::PdfMutex * m_mutex; ///< Mutex for the creation of the encoding table
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
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 PdfEncodingFactory.h   PdfEncodingFactory.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_ENCODING_FACTORY_H_ #ifndef _PDF_ENCODING_FACTORY_H_
#define _PDF_ENCODING_FACTORY_H_ #define _PDF_ENCODING_FACTORY_H_
#include "PdfDefines.h" #include "PdfDefines.h"
#include "util/PdfMutex.h" #include "util/PdfMutex.h"
#include "string.h"
namespace PoDoFo { namespace PoDoFo {
class PdfEncoding; class PdfEncoding;
class PdfDocEncoding; class PdfDocEncoding;
class PdfMacRomanEncoding; class PdfMacRomanEncoding;
class PdfObject; class PdfObject;
class PdfWinAnsiEncoding; class PdfWinAnsiEncoding;
/** This factory creates a PdfEncoding /** This factory creates a PdfEncoding
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 PdfEncrypt.h   PdfEncrypt.h 
skipping to change at line 289 skipping to change at line 289
/// Get the P object value (protection) /// Get the P object value (protection)
int GetPValue() const { return m_pValue; } int GetPValue() const { return m_pValue; }
/// Get the revision number of the encryption method /// Get the revision number of the encryption method
int GetRevision() const { return m_rValue; } int GetRevision() const { return m_rValue; }
/// Get the key length of the encryption key in bits /// Get the key length of the encryption key in bits
int GetKeyLength() const { return m_keyLength*8; } int GetKeyLength() const { return m_keyLength*8; }
/// Encrypt a wxString /// Encrypt a wxString
void Encrypt( std::string & str, int inputLen ) const; void Encrypt( std::string & str, pdf_long inputLen ) const;
/// Encrypt a character string /// Encrypt a character string
virtual void Encrypt(unsigned char* str, int len) const = 0; virtual void Encrypt(unsigned char* str, pdf_long len) const = 0;
/// Calculate stream size /// Calculate stream size
virtual int CalculateStreamLength(int length) const; virtual pdf_long CalculateStreamLength(pdf_long length) const;
/// Calculate stream offset /// Calculate stream offset
virtual int CalculateStreamOffset() const; virtual pdf_long CalculateStreamOffset() const;
/** Create a PdfString of MD5 data generated from a buffer in memory. /** Create a PdfString of MD5 data generated from a buffer in memory.
* \param pBuffer the buffer of which to calculate the MD5 sum * \param pBuffer the buffer of which to calculate the MD5 sum
* \param nLength the length of the buffer * \param nLength the length of the buffer
* *
* \returns an MD5 sum as PdfString * \returns an MD5 sum as PdfString
*/ */
static PdfString GetMD5String( const unsigned char* pBuffer, int nLength ); static PdfString GetMD5String( const unsigned char* pBuffer, int nLength );
/** Set the reference of the object that is currently encrypted. /** Set the reference of the object that is currently encrypted.
skipping to change at line 342 skipping to change at line 342
void ComputeEncryptionKey(const std::string & documentID, void ComputeEncryptionKey(const std::string & documentID,
unsigned char userPad[32], unsigned char ownerK ey[32], unsigned char userPad[32], unsigned char ownerK ey[32],
int pValue, int keyLength, int revision, int pValue, int keyLength, int revision,
unsigned char userKey[32]); unsigned char userKey[32]);
/// Check two keys for equality /// Check two keys for equality
bool CheckKey(unsigned char key1[32], unsigned char key2[32]); bool CheckKey(unsigned char key1[32], unsigned char key2[32]);
/// RC4 encryption /// RC4 encryption
void RC4(unsigned char* key, int keylen, void RC4(unsigned char* key, int keylen,
unsigned char* textin, int textlen, unsigned char* textin, pdf_long textlen,
unsigned char* textout); unsigned char* textout);
/// Calculate the binary MD5 message digest of the given data /// Calculate the binary MD5 message digest of the given data
static void GetMD5Binary(const unsigned char* data, int length, unsigned char* digest); static void GetMD5Binary(const unsigned char* data, int length, unsigned char* digest);
/// Generate initial vector /// Generate initial vector
void GenerateInitialVector(unsigned char iv[16]); void GenerateInitialVector(unsigned char iv[16]);
/** Create the encryption key for the current object. /** Create the encryption key for the current object.
* *
skipping to change at line 409 skipping to change at line 409
ePdfPermissions_Accessible | ePdfPermissions_Accessible |
ePdfPermissions_DocAssembly | ePdfPermissions_DocAssembly |
ePdfPermissions_HighPrint ePdfPermissions_HighPrint
); );
/* /*
* Destruct PdfEncryptAES object * Destruct PdfEncryptAES object
*/ */
~PdfEncryptAES(); ~PdfEncryptAES();
void Encrypt(unsigned char* str, int len) const; void Encrypt(unsigned char* str, pdf_long len) const;
/// Calculate stream offset /// Calculate stream offset
int CalculateStreamOffset() const; pdf_long CalculateStreamOffset() const;
PdfInputStream* CreateEncryptionInputStream( PdfInputStream* pInputS tream ); PdfInputStream* CreateEncryptionInputStream( PdfInputStream* pInputS tream );
PdfOutputStream* CreateEncryptionOutputStream( PdfOutputStream* pOut putStream ); PdfOutputStream* CreateEncryptionOutputStream( PdfOutputStream* pOut putStream );
int CalculateStreamLength(int length) const; pdf_long CalculateStreamLength(pdf_long length) const;
void CreateEncryptionDictionary( PdfDictionary & rDictionary ) const ; void CreateEncryptionDictionary( PdfDictionary & rDictionary ) const ;
private: private:
/// AES encryption /// AES encryption
void AES(unsigned char* key, int keylen, void AES(unsigned char* key, int keylen,
unsigned char* textin, int textlen, unsigned char* textin, pdf_long textlen,
unsigned char* textout); unsigned char* textout);
PdfRijndael* m_aes; ///< AES encryptor PdfRijndael* m_aes; ///< AES encryptor
}; };
/** A class that is used to encrypt a PDF file (RC4 40-bit and 128-bit) /** A class that is used to encrypt a PDF file (RC4 40-bit and 128-bit)
* *
* Client code is working only with PdfEncrypt class and knows nothing * Client code is working only with PdfEncrypt class and knows nothing
* about PdfEncryptRC4, it is created through CreatePdfEncrypt factory method * about PdfEncryptRC4, it is created through CreatePdfEncrypt factory method
skipping to change at line 459 skipping to change at line 459
ePdfPermissions_Copy | ePdfPermissions_Copy |
ePdfPermissions_EditNotes | ePdfPermissions_EditNotes |
ePdfPermissions_FillAndSign | ePdfPermissions_FillAndSign |
ePdfPermissions_Accessible | ePdfPermissions_Accessible |
ePdfPermissions_DocAssembly | ePdfPermissions_DocAssembly |
ePdfPermissions_HighPrint, ePdfPermissions_HighPrint,
EPdfEncryptAlgorithm eAlgorithm = ePdfEncryptAlgorithm_RC 4V1, EPdfEncryptAlgorithm eAlgorithm = ePdfEncryptAlgorithm_RC 4V1,
EPdfKeyLength eKeyLength = ePdfKeyLength_40 ); EPdfKeyLength eKeyLength = ePdfKeyLength_40 );
PdfEncryptRC4(const PdfEncrypt & rhs) : PdfEncrypt(rhs) {} PdfEncryptRC4(const PdfEncrypt & rhs) : PdfEncrypt(rhs) {}
void Encrypt(unsigned char* str, int len) const; void Encrypt(unsigned char* str, pdf_long len) const;
PdfInputStream* CreateEncryptionInputStream( PdfInputStream* pInputS tream ); PdfInputStream* CreateEncryptionInputStream( PdfInputStream* pInputS tream );
PdfOutputStream* CreateEncryptionOutputStream( PdfOutputStream* pOut putStream ); PdfOutputStream* CreateEncryptionOutputStream( PdfOutputStream* pOut putStream );
void CreateEncryptionDictionary( PdfDictionary & rDictionary ) const ; void CreateEncryptionDictionary( PdfDictionary & rDictionary ) const ;
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
 End of changes. 10 change blocks. 
10 lines changed or deleted 10 lines changed or added


 PdfError.h   PdfError.h 
skipping to change at line 30 skipping to change at line 30
#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>
#include <cstdarg>
#if defined(_MSC_VER) && _MSC_VER <= 1200 // same pragma as in PdfDefines .h which we cannot include here #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 {
skipping to change at line 62 skipping to change at line 63
ePdfError_InvalidHandle, /**< Null pointer was passed, but n ull pointer is not allowed. */ ePdfError_InvalidHandle, /**< Null pointer was passed, but n ull pointer is not allowed. */
ePdfError_FileNotFound, /**< A file was not found or cannot be opened. */ ePdfError_FileNotFound, /**< A file was not found or cannot be opened. */
ePdfError_InvalidDeviceOperation, /**< Tried to do something unsupport ed to an I/O device like seek a non-seekable input device */ ePdfError_InvalidDeviceOperation, /**< Tried to do something unsupport ed to an I/O device like seek a non-seekable input device */
ePdfError_UnexpectedEOF, /**< End of file was reached but da ta was expected. */ ePdfError_UnexpectedEOF, /**< End of file was reached but da ta was expected. */
ePdfError_OutOfMemory, /**< Not enough memory to complete an operation. */ ePdfError_OutOfMemory, /**< Not enough memory to complete an operation. */
ePdfError_ValueOutOfRange, /**< The specified memory is out of the allowed range. */ ePdfError_ValueOutOfRange, /**< The specified memory is out of the allowed range. */
ePdfError_InternalLogic, /**< An internal sanity check or as sertion failed. */ ePdfError_InternalLogic, /**< An internal sanity check or as sertion failed. */
ePdfError_InvalidEnumValue, /**< An invalid enum value was spec ified. */ ePdfError_InvalidEnumValue, /**< An invalid enum value was spec ified. */
ePdfError_PageNotFound, /**< The requested page could not b
e found in the PDF. */
ePdfError_NoPdfFile, /**< The file is no PDF file. */ ePdfError_NoPdfFile, /**< The file is no PDF file. */
ePdfError_NoXRef, /**< The PDF file has no or an inva lid XRef table. */ ePdfError_NoXRef, /**< The PDF file has no or an inva lid XRef table. */
ePdfError_NoTrailer, /**< The PDF file has no or an inva lid trailer. */ ePdfError_NoTrailer, /**< The PDF file has no or an inva lid trailer. */
ePdfError_NoNumber, /**< A number was expected in the P DF file, but the read string is no number. */ ePdfError_NoNumber, /**< A number was expected in the P DF file, but the read string is no number. */
ePdfError_NoObject, /**< A object was expected and non was found. */ ePdfError_NoObject, /**< A object was expected and non was found. */
ePdfError_InvalidTrailerSize, /**< The trailer size is invalid. * / ePdfError_InvalidTrailerSize, /**< The trailer size is invalid. * /
ePdfError_InvalidLinearization, /**< The linearization directory of a web-optimized PDF file is invalid. */ ePdfError_InvalidLinearization, /**< The linearization directory of a web-optimized PDF file is invalid. */
ePdfError_InvalidDataType, /**< The passed datatype is invalid or was not recognized */ ePdfError_InvalidDataType, /**< The passed datatype is invalid or was not recognized */
ePdfError_InvalidXRef, /**< The XRef table is invalid */ ePdfError_InvalidXRef, /**< The XRef table is invalid */
skipping to change at line 99 skipping to change at line 102
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_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_CannotConvertColor, /**< This color format cannot be co nverted. */
ePdfError_NotImplemented, /**< This feature is currently not implemented. */ ePdfError_NotImplemented, /**< This feature is currently not implemented. */
ePdfError_DestinationAlreadyPresent,/**< An destination was already pre
sent when trying to add a Action */
ePdfError_ChangeOnImmutable, /**< Changing values on immutable o
bjects is not allowed. */
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 374 skipping to change at line 381
/** 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:
/** Log a message to the logging system defined for PoDoFo.
*
* This call does not check if logging is enabled and always
* prints the error message
*
* \param eLogSeverity the sevirity of the log message
* \param pszMsg the message to be logged
*/
static void LogErrorMessage( ELogSeverity eLogSeverity, const char* psz
Msg, ... );
/** Log a message to the logging system defined for PoDoFo.
*
* This call does not check if logging is enabled and always
* prints the error message
*
* \param eLogSeverity the sevirity of the log message
* \param pszMsg the message to be logged
*/
static void LogErrorMessage( ELogSeverity eLogSeverity, const wchar_t*
pszMsg, ... );
static void LogMessageInternal( ELogSeverity eLogSeverity, const char*
pszMsg, va_list & args );
static void LogMessageInternal( ELogSeverity eLogSeverity, const wchar_
t* pszMsg, va_list & args );
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; static bool s_LogEnabled;
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
 End of changes. 5 change blocks. 
0 lines changed or deleted 38 lines changed or added


 PdfExtGState.h   PdfExtGState.h 
skipping to change at line 86 skipping to change at line 86
/** Enables/Disables non-zero overprint mode /** Enables/Disables non-zero overprint mode
* \param enable enable or disable * \param enable enable or disable
*/ */
void SetNonZeroOverprint( bool enable=true ); void SetNonZeroOverprint( bool enable=true );
/** Set the Rendering Intent /** Set the Rendering Intent
* \param intent one of the predefined intents (see Podofo.h) * \param intent one of the predefined intents (see Podofo.h)
*/ */
void SetRenderingIntent( char* intent ); void SetRenderingIntent( char* intent );
/** Set the frequency for halftones
* \param screen frequency, measured in halftone cells per inch in dev
ice space
*/
void SetFrequency( double frequency );
private: private:
/** Initialize the object /** Initialize the object
*/ */
void Init( void ); void Init( void );
private: private:
PdfName m_Identifier; PdfName m_Identifier;
}; };
const PdfName & PdfExtGState::GetIdentifier() const const PdfName & PdfExtGState::GetIdentifier() const
 End of changes. 1 change blocks. 
0 lines changed or deleted 6 lines changed or added


 PdfField.h   PdfField.h 
skipping to change at line 327 skipping to change at line 327
inline void SetFocusEnterAction( const PdfAction & rAction ); inline void SetFocusEnterAction( const PdfAction & rAction );
inline void SetFocusLeaveAction( const PdfAction & rAction ); inline void SetFocusLeaveAction( const PdfAction & rAction );
inline void SetPageOpenAction( const PdfAction & rAction ); inline void SetPageOpenAction( const PdfAction & rAction );
inline void SetPageCloseAction( const PdfAction & rAction ); inline void SetPageCloseAction( const PdfAction & rAction );
inline void SetPageVisibleAction( const PdfAction & rAction ); inline void SetPageVisibleAction( const PdfAction & rAction );
inline void SetPageInvisibleAction( const PdfAction & rAction ); inline void SetPageInvisibleAction( const PdfAction & rAction );
/* Peter Petrov 15 October 2008 */
inline void SetKeystrokeAction( const PdfAction & rAction );
inline void SetValidateAction( const PdfAction & rAction );
/** /**
* \returns the type of this field * \returns the type of this field
*/ */
inline EPdfField GetType() const; inline EPdfField GetType() const;
private: private:
/** /**
* Initialize this PdfField. * Initialize this PdfField.
* *
skipping to change at line 349 skipping to change at line 353
void Init( PdfAcroForm* pParent ); void Init( PdfAcroForm* pParent );
void AddAlternativeAction( const PdfName & rsName, const PdfAction & rA ction ); void AddAlternativeAction( const PdfName & rsName, const PdfAction & rA ction );
protected: protected:
PdfObject* m_pObject; PdfObject* m_pObject;
PdfAnnotation* m_pWidget; PdfAnnotation* m_pWidget;
private: private:
EPdfField m_eField; EPdfField m_eField;
// Peter Petrov 27 April 2008
public:
inline PdfAnnotation* GetWidgetAnnotation() const;
inline PdfObject* GetFieldObject() const;
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
/* /*
inline const PdfField & PdfField::operator=( const PdfField & rhs ) inline const PdfField & PdfField::operator=( const PdfField & rhs )
{ {
// DominikS: Reference counted vectors could be nice here. In case // DominikS: Reference counted vectors could be nice here. In case
// the PdfField handling makes sense the way it is now, // the PdfField handling makes sense the way it is now,
// we could discuss using reference counted vectors // we could discuss using reference counted vectors
// and implement PdfAction, PdfAnnotation ... similar to PdfF ield // and implement PdfAction, PdfAnnotation ... similar to PdfF ield
m_pObject = rhs.m_pObject; m_pObject = rhs.m_pObject;
m_pWidget = rhs.m_pWidget; m_pWidget = rhs.m_pWidget;
m_eField = rhs.m_eField; m_eField = rhs.m_eField;
return *this; return *this;
} }*/
*/
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline void PdfField::SetReadOnly( bool bReadOnly ) inline void PdfField::SetReadOnly( bool bReadOnly )
{ {
this->SetFieldFlag( static_cast<int>(ePdfField_ReadOnly), bReadOnly ); this->SetFieldFlag( static_cast<int>(ePdfField_ReadOnly), bReadOnly );
} }
// ----------------------------------------------------- // -----------------------------------------------------
skipping to change at line 505 skipping to change at line 513
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline void PdfField::SetPageInvisibleAction( const PdfAction & rAction ) inline void PdfField::SetPageInvisibleAction( const PdfAction & rAction )
{ {
this->AddAlternativeAction( PdfName("PI"), rAction ); this->AddAlternativeAction( PdfName("PI"), rAction );
} }
/* Peter Petrov 15 October 2008 */
// -----------------------------------------------------
//
// -----------------------------------------------------
inline void PdfField::SetKeystrokeAction( const PdfAction & rAction )
{
this->AddAlternativeAction( PdfName("K"), rAction);
}
/* Peter Petrov 15 October 2008 */
// -----------------------------------------------------
//
// -----------------------------------------------------
inline void PdfField::SetValidateAction( const PdfAction & rAction )
{
this->AddAlternativeAction( PdfName("V"), rAction);
}
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline EPdfField PdfField::GetType() const inline EPdfField PdfField::GetType() const
{ {
return m_eField; return m_eField;
} }
// Peter Petrov 27 April 2008
// -----------------------------------------------------
//
// -----------------------------------------------------
inline PdfAnnotation* PdfField::GetWidgetAnnotation() const
{
return m_pWidget;
}
// Peter Petrov 27 April 2008
// -----------------------------------------------------
//
// -----------------------------------------------------
inline PdfObject* PdfField::GetFieldObject() const
{
return m_pObject;
}
class PODOFO_API PdfButton : public PdfField { class PODOFO_API PdfButton : public PdfField {
protected: protected:
enum { ePdfButton_NoToggleOff = 0x0004000, enum { ePdfButton_NoToggleOff = 0x0004000,
ePdfButton_Radio = 0x0008000, ePdfButton_Radio = 0x0008000,
ePdfButton_PushButton = 0x0010000, ePdfButton_PushButton = 0x0010000,
ePdfButton_RadioInUnison = 0x2000000 ePdfButton_RadioInUnison = 0x2000000
}; };
/** Create a new PdfButton /** Create a new PdfButton
*/ */
skipping to change at line 778 skipping to change at line 822
void SetText( const PdfString & rsText ); void SetText( const PdfString & rsText );
/** /**
* \returns the text contents of this text field * \returns the text contents of this text field
*/ */
PdfString GetText() const; PdfString GetText() const;
/** Sets the max length in characters of this textfield /** Sets the max length in characters of this textfield
* \param nMaxLen the max length of this textfields in characters * \param nMaxLen the max length of this textfields in characters
*/ */
void SetMaxLen( int nMaxLen ); void SetMaxLen( pdf_long nMaxLen );
/** /**
* \returns the max length of this textfield in characters or -1 * \returns the max length of this textfield in characters or -1
* if no max length was specified * if no max length was specified
*/ */
int GetMaxLen() const; pdf_long GetMaxLen() const;
/** /**
* Create a multi-line text field that can contains multiple lines of text. * Create a multi-line text field that can contains multiple lines of text.
* \param bMultiLine if true a multi line field is generated, otherwis e * \param bMultiLine if true a multi line field is generated, otherwis e
* the text field can contain only a single line of text. * the text field can contain only a single line of text.
* *
* The default is to create a single line text field. * The default is to create a single line text field.
*/ */
inline void SetMultiLine( bool bMultiLine ); inline void SetMultiLine( bool bMultiLine );
skipping to change at line 1086 skipping to change at line 1130
* its value is returned. This call is equivalent to GetItem() * its value is returned. This call is equivalent to GetItem()
* in this case * in this case
* *
* \see GetItem * \see GetItem
*/ */
const PdfString & GetItemDisplayText( int nIndex ) const; const PdfString & GetItemDisplayText( int nIndex ) const;
/** /**
* \returns the number of items in this list * \returns the number of items in this list
*/ */
int GetItemCount() const; size_t GetItemCount() const;
/** Sets the currently selected item /** Sets the currently selected item
* \param nIndex index of the currently selected item * \param nIndex index of the currently selected item
*/ */
void SetSelectedItem( int nIndex ); void SetSelectedItem( int nIndex );
/** Sets the currently selected item /** Sets the currently selected item
* *
* \returns the selected item or -1 if no item was selected * \returns the selected item or -1 if no item was selected
*/ */
 End of changes. 8 change blocks. 
5 lines changed or deleted 49 lines changed or added


 PdfFileStream.h   PdfFileStream.h 
skipping to change at line 89 skipping to change at line 89
* *
* The caller has to free() the buffer. * The caller has to free() the buffer.
* *
* This is currently not implemented for PdfFileStreams * This is currently not implemented for PdfFileStreams
* and will raise an ePdfError_InternalLogic exception * and will raise an ePdfError_InternalLogic exception
* *
* \param pBuffer pointer to the buffer * \param pBuffer pointer to the buffer
* \param lLen pointer to the buffer length * \param lLen pointer to the buffer length
* \returns ErrOk on success. * \returns ErrOk on success.
*/ */
virtual void GetCopy( char** pBuffer, long* lLen ) const; virtual void GetCopy( char** pBuffer, pdf_long* lLen ) const;
/** Get a copy of a the stream and write it to a PdfOutputStream
*
* \param pStream data is written to this stream.
*/
virtual void GetCopy( PdfOutputStream* pStream ) const;
/** Get the streams length with all filters applied (eg the compressed /** Get the streams length with all filters applied (eg the compressed
* length of a Flate compressed stream). * length of a Flate compressed stream).
* *
* \returns the length of the stream with all filters applied * \returns the length of the stream with all filters applied
*/ */
inline virtual unsigned long GetLength() const; inline virtual pdf_long GetLength() const;
protected: protected:
/** Required for the GetFilteredCopy implementation /** Required for the GetFilteredCopy implementation
* \returns a handle to the internal buffer * \returns a handle to the internal buffer
*/ */
inline virtual const char* GetInternalBuffer() const; inline virtual const char* GetInternalBuffer() const;
/** Required for the GetFilteredCopy implementation /** Required for the GetFilteredCopy implementation
* \returns the size of the internal buffer * \returns the size of the internal buffer
*/ */
inline virtual unsigned long GetInternalBufferSize() const; inline virtual pdf_long GetInternalBufferSize() const;
/** Begin appending data to this stream. /** Begin appending data to this stream.
* Clears the current stream contents. * Clears the current stream contents.
* *
* \param vecFilters use this filters to encode any data written to th e stream. * \param vecFilters use this filters to encode any data written to th e stream.
*/ */
virtual void BeginAppendImpl( const TVecFilters & vecFilters ); virtual void BeginAppendImpl( const TVecFilters & vecFilters );
/** Append a binary buffer to the current stream contents. /** Append a binary buffer to the current stream contents.
* *
skipping to change at line 137 skipping to change at line 143
/** Finish appending data to the stream /** Finish appending data to the stream
*/ */
virtual void EndAppendImpl(); virtual void EndAppendImpl();
private: private:
PdfOutputDevice* m_pDevice; PdfOutputDevice* m_pDevice;
PdfOutputStream* m_pStream; PdfOutputStream* m_pStream;
PdfOutputStream* m_pDeviceStream; PdfOutputStream* m_pDeviceStream;
PdfOutputStream* m_pEncryptStream; PdfOutputStream* m_pEncryptStream;
unsigned long m_lLenInitial; pdf_long m_lLenInitial;
unsigned long m_lLength; pdf_long m_lLength;
PdfObject* m_pLength; PdfObject* m_pLength;
PdfEncrypt* m_pCurEncrypt; PdfEncrypt* m_pCurEncrypt;
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
unsigned long PdfFileStream::GetLength() const pdf_long PdfFileStream::GetLength() const
{ {
return m_lLength; return m_lLength;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
const char* PdfFileStream::GetInternalBuffer() const const char* PdfFileStream::GetInternalBuffer() const
{ {
return NULL; return NULL;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
unsigned long PdfFileStream::GetInternalBufferSize() const pdf_long PdfFileStream::GetInternalBufferSize() const
{ {
return 0; return 0;
} }
}; };
#endif // _PDF_FILE_STREAM_H_ #endif // _PDF_FILE_STREAM_H_
 End of changes. 6 change blocks. 
7 lines changed or deleted 13 lines changed or added


 PdfFilter.h   PdfFilter.h 
skipping to change at line 79 skipping to change at line 79
* *
* This function uses BeginEncode()/EncodeBlock()/EndEncode() * This function uses BeginEncode()/EncodeBlock()/EndEncode()
* internally, so it's not safe to use when progressive encoding * internally, so it's not safe to use when progressive encoding
* is in progress. * is in progress.
* *
* \param pInBuffer input buffer * \param pInBuffer input buffer
* \param lInLen length of the input buffer * \param lInLen length of the input buffer
* \param ppOutBuffer pointer to the buffer of the encoded data * \param ppOutBuffer pointer to the buffer of the encoded data
* \param plOutLen pointer to the length of the output buffer * \param plOutLen pointer to the length of the output buffer
*/ */
void Encode( const char* pInBuffer, long lInLen, char** ppOutBuffer, lo ng* plOutLen ) const; void Encode( const char* pInBuffer, pdf_long lInLen, char** ppOutBuffer , pdf_long* plOutLen ) const;
/** Begin progressively encoding data using this filter. /** Begin progressively encoding data using this filter.
* *
* This method sets the filter's output stream and may * This method sets the filter's output stream and may
* perform other operations defined by particular filter * perform other operations defined by particular filter
* implementations. It calls BeginEncodeImpl(). * implementations. It calls BeginEncodeImpl().
* *
* \param pOutput encoded data will be written to this stream. * \param pOutput encoded data will be written to this stream.
* *
* Call EncodeBlock() to encode blocks of data and use EndEncode * Call EncodeBlock() to encode blocks of data and use EndEncode
skipping to change at line 118 skipping to change at line 118
* BeginEncode() must be called before this function. * BeginEncode() must be called before this function.
* *
* \param pBuffer pointer to a buffer with data to encode * \param pBuffer pointer to a buffer with data to encode
* \param lLen length of data to encode. * \param lLen length of data to encode.
* *
* Call EndEncode() after all data has been encoded * Call EndEncode() after all data has been encoded
* *
* \see BeginEncode * \see BeginEncode
* \see EndEncode * \see EndEncode
*/ */
inline void EncodeBlock( const char* pBuffer, long lLen ); inline void EncodeBlock( const char* pBuffer, pdf_long lLen );
/** /**
* Finish encoding of data and reset the stream's state. * Finish encoding of data and reset the stream's state.
* *
* \see BeginEncode * \see BeginEncode
* \see EncodeBlock * \see EncodeBlock
*/ */
inline void EndEncode(); inline void EndEncode();
/** Check wether the decoding is implemented for this filter. /** Check wether the decoding is implemented for this filter.
skipping to change at line 146 skipping to change at line 146
* *
* \param pInBuffer input buffer * \param pInBuffer input buffer
* \param lInLen length of the input buffer * \param lInLen length of the input buffer
* \param ppOutBuffer pointer to the buffer of the decoded data * \param ppOutBuffer pointer to the buffer of the decoded data
* \param plOutLen pointer to the length of the output buffer * \param plOutLen pointer to the length of the output buffer
* \param pDecodeParms optional pointer to an decode parameters dictio nary * \param pDecodeParms optional pointer to an decode parameters dictio nary
* containing additional information to decode the data. * containing additional information to decode the data.
* This pointer must be NULL if no decode paramete r dictionary * This pointer must be NULL if no decode paramete r dictionary
* is available. * is available.
*/ */
void Decode( const char* pInBuffer, long lInLen, char** ppOutBuffer, lo ng* plOutLen, const PdfDictionary* pDecodeParms = NULL ) const; void Decode( const char* pInBuffer, pdf_long lInLen, char** ppOutBuffer , pdf_long* plOutLen, const PdfDictionary* pDecodeParms = NULL ) const;
/** Begin progressively decoding data using this filter. /** Begin progressively decoding data using this filter.
* *
* This method sets the filter's output stream and may * This method sets the filter's output stream and may
* perform other operations defined by particular filter * perform other operations defined by particular filter
* implementations. It calls BeginDecodeImpl(). * implementations. It calls BeginDecodeImpl().
* *
* \param pOutput decoded data will be written to this stream. * \param pOutput decoded data will be written to this stream.
* \param pDecodeParms a dictionary containing addiational information for decoding * \param pDecodeParms a dictionary containing addiational information for decoding
* *
skipping to change at line 186 skipping to change at line 186
* BeginDecode() must be called before this function. * BeginDecode() must be called before this function.
* *
* \param pBuffer pointer to a buffer with data to encode * \param pBuffer pointer to a buffer with data to encode
* \param lLen length of data to encode. * \param lLen length of data to encode.
* *
* Call EndDecode() after all data has been decoded * Call EndDecode() after all data has been decoded
* *
* \see BeginDecode * \see BeginDecode
* \see EndDecode * \see EndDecode
*/ */
inline void DecodeBlock( const char* pBuffer, long lLen ); inline void DecodeBlock( const char* pBuffer, pdf_long lLen );
/** /**
* Finish decoding of data and reset the stream's state. * Finish decoding of data and reset the stream's state.
* *
* \see BeginDecode * \see BeginDecode
* \see DecodeBlock * \see DecodeBlock
*/ */
inline void EndDecode(); inline void EndDecode();
/** Type of this filter. /** Type of this filter.
skipping to change at line 241 skipping to change at line 241
* the passed buffer, but you must ensure that you have processed it a nd * the passed buffer, but you must ensure that you have processed it a nd
* written it out by the end of EndEncodeImpl(). You must copy the buf fer * written it out by the end of EndEncodeImpl(). You must copy the buf fer
* if you're going to store it, as ownership is not transferred to the * if you're going to store it, as ownership is not transferred to the
* filter and the caller may free the buffer at any time. * filter and the caller may free the buffer at any time.
* *
* PdfFilter ensures that a valid stream is available when this method is * PdfFilter ensures that a valid stream is available when this method is
* called, ensures that BeginEncode() has been called, and ensures tha t * called, ensures that BeginEncode() has been called, and ensures tha t
* EndEncode() has not been called since the last BeginEncode(). * EndEncode() has not been called since the last BeginEncode().
* *
* \see EncodeBlock */ * \see EncodeBlock */
virtual void EncodeBlockImpl( const char* pBuffer, long lLen ) = 0; virtual void EncodeBlockImpl( const char* pBuffer, pdf_long lLen ) = 0;
/** Real implementation of `EndEncode()'. NEVER call this method direct ly. /** Real implementation of `EndEncode()'. NEVER call this method direct ly.
* *
* By the time this method returns, all filtered data must be written t o the stream * By the time this method returns, all filtered data must be written t o the stream
* and the filter must be in a state where BeginEncode() can be safely called. * and the filter must be in a state where BeginEncode() can be safely called.
* *
* PdfFilter ensures that a valid stream is available when this method is * PdfFilter ensures that a valid stream is available when this method is
* called, and ensures that BeginEncodeImpl() has been called. * called, and ensures that BeginEncodeImpl() has been called.
* *
* \see EndEncode */ * \see EndEncode */
skipping to change at line 280 skipping to change at line 280
* the passed buffer, but you must ensure that you have processed it a nd * the passed buffer, but you must ensure that you have processed it a nd
* written it out by the end of EndDecodeImpl(). You must copy the buf fer * written it out by the end of EndDecodeImpl(). You must copy the buf fer
* if you're going to store it, as ownership is not transferred to the * if you're going to store it, as ownership is not transferred to the
* filter and the caller may free the buffer at any time. * filter and the caller may free the buffer at any time.
* *
* PdfFilter ensures that a valid stream is available when this method is * PdfFilter ensures that a valid stream is available when this method is
* called, ensures that BeginDecode() has been called, and ensures tha t * called, ensures that BeginDecode() has been called, and ensures tha t
* EndDecode() has not been called since the last BeginDecode(). * EndDecode() has not been called since the last BeginDecode().
* *
* \see DecodeBlock */ * \see DecodeBlock */
virtual void DecodeBlockImpl( const char* pBuffer, long lLen ) = 0; virtual void DecodeBlockImpl( const char* pBuffer, pdf_long lLen ) = 0;
/** Real implementation of `EndDecode()'. NEVER call this method direct ly. /** Real implementation of `EndDecode()'. NEVER call this method direct ly.
* *
* By the time this method returns, all filtered data must be written t o the stream * By the time this method returns, all filtered data must be written t o the stream
* and the filter must be in a state where BeginDecode() can be safely called. * and the filter must be in a state where BeginDecode() can be safely called.
* *
* PdfFilter ensures that a valid stream is available when this method is * PdfFilter ensures that a valid stream is available when this method is
* called, and ensures that BeginDecodeImpl() has been called. * called, and ensures that BeginDecodeImpl() has been called.
* *
* \see EndDecode */ * \see EndDecode */
skipping to change at line 304 skipping to change at line 304
PdfOutputStream* m_pOutputStream; PdfOutputStream* m_pOutputStream;
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
void PdfFilter::BeginEncode( PdfOutputStream* pOutput ) void PdfFilter::BeginEncode( PdfOutputStream* pOutput )
{ {
PODOFO_RAISE_LOGIC_IF( m_pOutputStream, "BeginEncode() on failed filter or without EndEncode()" ); PODOFO_RAISE_LOGIC_IF( m_pOutputStream, "BeginEncode() on failed filter or without EndEncode()" );
m_pOutputStream = pOutput; m_pOutputStream = pOutput;
BeginEncodeImpl();
try {
BeginEncodeImpl();
} catch( const PdfError & e ) {
// Clean up and close stream
this->FailEncodeDecode();
throw e;
}
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
void PdfFilter::EncodeBlock( const char* pBuffer, long lLen ) void PdfFilter::EncodeBlock( const char* pBuffer, pdf_long lLen )
{ {
PODOFO_RAISE_LOGIC_IF( !m_pOutputStream, "EncodeBlock() without BeginEn code() or on failed filter" ); PODOFO_RAISE_LOGIC_IF( !m_pOutputStream, "EncodeBlock() without BeginEn code() or on failed filter" );
EncodeBlockImpl(pBuffer, lLen);
try {
EncodeBlockImpl(pBuffer, lLen);
} catch( const PdfError & e ) {
// Clean up and close stream
this->FailEncodeDecode();
throw e;
}
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
void PdfFilter::EndEncode() void PdfFilter::EndEncode()
{ {
PODOFO_RAISE_LOGIC_IF( !m_pOutputStream, "EndEncode() without BeginEnco de() or on failed filter" ); PODOFO_RAISE_LOGIC_IF( !m_pOutputStream, "EndEncode() without BeginEnco de() or on failed filter" );
EndEncodeImpl();
try {
EndEncodeImpl();
} catch( const PdfError & e ) {
// Clean up and close stream
this->FailEncodeDecode();
throw e;
}
m_pOutputStream->Close(); m_pOutputStream->Close();
m_pOutputStream = NULL; m_pOutputStream = NULL;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
void PdfFilter::BeginDecode( PdfOutputStream* pOutput, const PdfDictionary* pDecodeParms ) void PdfFilter::BeginDecode( PdfOutputStream* pOutput, const PdfDictionary* pDecodeParms )
{ {
PODOFO_RAISE_LOGIC_IF( m_pOutputStream, "BeginDecode() on failed filter or without EndDecode()" ); PODOFO_RAISE_LOGIC_IF( m_pOutputStream, "BeginDecode() on failed filter or without EndDecode()" );
m_pOutputStream = pOutput; m_pOutputStream = pOutput;
BeginDecodeImpl( pDecodeParms );
try {
BeginDecodeImpl( pDecodeParms );
} catch( const PdfError & e ) {
// Clean up and close stream
this->FailEncodeDecode();
throw e;
}
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
void PdfFilter::DecodeBlock( const char* pBuffer, long lLen ) void PdfFilter::DecodeBlock( const char* pBuffer, pdf_long lLen )
{ {
PODOFO_RAISE_LOGIC_IF( !m_pOutputStream, "DecodeBlock() without BeginDe code() or on failed filter" ) PODOFO_RAISE_LOGIC_IF( !m_pOutputStream, "DecodeBlock() without BeginDe code() or on failed filter" )
DecodeBlockImpl(pBuffer, lLen);
try {
DecodeBlockImpl(pBuffer, lLen);
} catch( const PdfError & e ) {
// Clean up and close stream
this->FailEncodeDecode();
throw e;
}
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
void PdfFilter::EndDecode() void PdfFilter::EndDecode()
{ {
PODOFO_RAISE_LOGIC_IF( !m_pOutputStream, "EndDecode() without BeginDeco de() or on failed filter" ) PODOFO_RAISE_LOGIC_IF( !m_pOutputStream, "EndDecode() without BeginDeco de() or on failed filter" )
EndDecodeImpl();
try {
EndDecodeImpl();
} catch( const PdfError & e ) {
// Clean up and close stream
this->FailEncodeDecode();
throw e;
}
m_pOutputStream->Close(); m_pOutputStream->Close();
m_pOutputStream = NULL; m_pOutputStream = NULL;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
void PdfFilter::FailEncodeDecode() void PdfFilter::FailEncodeDecode()
{ {
 End of changes. 14 change blocks. 
14 lines changed or deleted 56 lines changed or added


 PdfFiltersPrivate.h   PdfFiltersPrivate.h 
skipping to change at line 35 skipping to change at line 35
* \file PdfFiltersPrivate.h * \file PdfFiltersPrivate.h
* *
* Provides implementations of various PDF stream filters. * Provides implementations of various PDF stream filters.
* *
* This is an internal header. It should not be included in podofo.h, and * This is an internal header. It should not be included in podofo.h, and
* should not be included directly by client applications. These filters sh ould * should not be included directly by client applications. These filters sh ould
* only be accessed through the factory interface in PdfFilters.h . * only be accessed through the factory interface in PdfFilters.h .
*/ */
#include "PdfDefines.h" #include "PdfDefines.h"
#include "PdfDefinesPrivate.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 #ifdef _WIN32 // Collision between win and jpeg-headers
#define XMD_H #define XMD_H
#undef FAR
#endif #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
skipping to change at line 92 skipping to change at line 94
* *
* \param pBuffer pointer to a buffer with data to encode * \param pBuffer pointer to a buffer with data to encode
* \param lLen length of data to encode. * \param lLen length of data to encode.
* *
* Call EndEncodeImpl() after all data has been encoded * Call EndEncodeImpl() after all data has been encoded
* *
* *
* \see BeginEncodeImpl * \see BeginEncodeImpl
* \see EndEncodeImpl * \see EndEncodeImpl
*/ */
virtual void EncodeBlockImpl( const char* pBuffer, long lLen ); virtual void EncodeBlockImpl( const char* pBuffer, pdf_long lLen );
/** Check wether the decoding is implemented for this filter. /** Check wether the decoding is implemented for this filter.
* *
* \returns true if the filter is able to decode data * \returns true if the filter is able to decode data
*/ */
inline virtual bool CanDecode() const; inline virtual bool CanDecode() const;
/** Real implementation of `BeginDecode()'. NEVER call this method dire ctly. /** Real implementation of `BeginDecode()'. NEVER call this method dire ctly.
* *
* By default this function does nothing. If your filter needs to do s etup for decoding, * By default this function does nothing. If your filter needs to do s etup for decoding,
skipping to change at line 126 skipping to change at line 128
* the passed buffer, but you must ensure that you have processed it a nd * the passed buffer, but you must ensure that you have processed it a nd
* written it out by the end of EndDecodeImpl(). You must copy the buf fer * written it out by the end of EndDecodeImpl(). You must copy the buf fer
* if you're going to store it, as ownership is not transferred to the * if you're going to store it, as ownership is not transferred to the
* filter and the caller may free the buffer at any time. * filter and the caller may free the buffer at any time.
* *
* PdfFilter ensures that a valid stream is available when this method is * PdfFilter ensures that a valid stream is available when this method is
* called, ensures that BeginDecode() has been called, and ensures tha t * called, ensures that BeginDecode() has been called, and ensures tha t
* EndDecode() has not been called since the last BeginDecode(). * EndDecode() has not been called since the last BeginDecode().
* *
* \see DecodeBlock */ * \see DecodeBlock */
virtual void DecodeBlockImpl( const char* pBuffer, long lLen ); virtual void DecodeBlockImpl( const char* pBuffer, pdf_long lLen );
/** Real implementation of `EndDecode()'. NEVER call this method direct ly. /** Real implementation of `EndDecode()'. NEVER call this method direct ly.
* *
* By the time this method returns, all filtered data must be written t o the stream * By the time this method returns, all filtered data must be written t o the stream
* and the filter must be in a state where BeginDecode() can be safely called. * and the filter must be in a state where BeginDecode() can be safely called.
* *
* PdfFilter ensures that a valid stream is available when this method is * PdfFilter ensures that a valid stream is available when this method is
* called, and ensures that BeginDecodeImpl() has been called. * called, and ensures that BeginDecodeImpl() has been called.
* *
* \see EndDecode */ * \see EndDecode */
skipping to change at line 207 skipping to change at line 209
* *
* \param pBuffer pointer to a buffer with data to encode * \param pBuffer pointer to a buffer with data to encode
* \param lLen length of data to encode. * \param lLen length of data to encode.
* *
* Call EndEncodeImpl() after all data has been encoded * Call EndEncodeImpl() after all data has been encoded
* *
* *
* \see BeginEncodeImpl * \see BeginEncodeImpl
* \see EndEncodeImpl * \see EndEncodeImpl
*/ */
virtual void EncodeBlockImpl( const char* pBuffer, long lLen ); virtual void EncodeBlockImpl( const char* pBuffer, pdf_long lLen );
/** /**
* Finish encoding of data. * Finish encoding of data.
* *
* \see BeginEncodeImpl * \see BeginEncodeImpl
* \see EncodeBlockImpl * \see EncodeBlockImpl
*/ */
virtual void EndEncodeImpl(); virtual void EndEncodeImpl();
/** Check wether the decoding is implemented for this filter. /** Check wether the decoding is implemented for this filter.
skipping to change at line 249 skipping to change at line 251
* the passed buffer, but you must ensure that you have processed it a nd * the passed buffer, but you must ensure that you have processed it a nd
* written it out by the end of EndDecodeImpl(). You must copy the buf fer * written it out by the end of EndDecodeImpl(). You must copy the buf fer
* if you're going to store it, as ownership is not transferred to the * if you're going to store it, as ownership is not transferred to the
* filter and the caller may free the buffer at any time. * filter and the caller may free the buffer at any time.
* *
* PdfFilter ensures that a valid stream is available when this method is * PdfFilter ensures that a valid stream is available when this method is
* called, ensures that BeginDecode() has been called, and ensures tha t * called, ensures that BeginDecode() has been called, and ensures tha t
* EndDecode() has not been called since the last BeginDecode(). * EndDecode() has not been called since the last BeginDecode().
* *
* \see DecodeBlock */ * \see DecodeBlock */
virtual void DecodeBlockImpl( const char* pBuffer, long lLen ); virtual void DecodeBlockImpl( const char* pBuffer, pdf_long lLen );
/** Real implementation of `EndDecode()'. NEVER call this method direct ly. /** Real implementation of `EndDecode()'. NEVER call this method direct ly.
* *
* By the time this method returns, all filtered data must be written t o the stream * By the time this method returns, all filtered data must be written t o the stream
* and the filter must be in a state where BeginDecode() can be safely called. * and the filter must be in a state where BeginDecode() can be safely called.
* *
* PdfFilter ensures that a valid stream is available when this method is * PdfFilter ensures that a valid stream is available when this method is
* called, and ensures that BeginDecodeImpl() has been called. * called, and ensures that BeginDecodeImpl() has been called.
* *
* \see EndDecode */ * \see EndDecode */
skipping to change at line 335 skipping to change at line 337
* *
* \param pBuffer pointer to a buffer with data to encode * \param pBuffer pointer to a buffer with data to encode
* \param lLen length of data to encode. * \param lLen length of data to encode.
* *
* Call EndEncodeImpl() after all data has been encoded * Call EndEncodeImpl() after all data has been encoded
* *
* *
* \see BeginEncodeImpl * \see BeginEncodeImpl
* \see EndEncodeImpl * \see EndEncodeImpl
*/ */
virtual void EncodeBlockImpl( const char* pBuffer, long lLen ); virtual void EncodeBlockImpl( const char* pBuffer, pdf_long lLen );
/** /**
* Finish encoding of data. * Finish encoding of data.
* *
* \see BeginEncodeImpl * \see BeginEncodeImpl
* \see EncodeBlockImpl * \see EncodeBlockImpl
*/ */
virtual void EndEncodeImpl(); virtual void EndEncodeImpl();
/** Check wether the decoding is implemented for this filter. /** Check wether the decoding is implemented for this filter.
skipping to change at line 380 skipping to change at line 382
* the passed buffer, but you must ensure that you have processed it a nd * the passed buffer, but you must ensure that you have processed it a nd
* written it out by the end of EndDecodeImpl(). You must copy the buf fer * written it out by the end of EndDecodeImpl(). You must copy the buf fer
* if you're going to store it, as ownership is not transferred to the * if you're going to store it, as ownership is not transferred to the
* filter and the caller may free the buffer at any time. * filter and the caller may free the buffer at any time.
* *
* PdfFilter ensures that a valid stream is available when this method is * PdfFilter ensures that a valid stream is available when this method is
* called, ensures that BeginDecode() has been called, and ensures tha t * called, ensures that BeginDecode() has been called, and ensures tha t
* EndDecode() has not been called since the last BeginDecode(). * EndDecode() has not been called since the last BeginDecode().
* *
* \see DecodeBlock */ * \see DecodeBlock */
virtual void DecodeBlockImpl( const char* pBuffer, long lLen ); virtual void DecodeBlockImpl( const char* pBuffer, pdf_long lLen );
/** Real implementation of `EndDecode()'. NEVER call this method direct ly. /** Real implementation of `EndDecode()'. NEVER call this method direct ly.
* *
* By the time this method returns, all filtered data must be written t o the stream * By the time this method returns, all filtered data must be written t o the stream
* and the filter must be in a state where BeginDecode() can be safely called. * and the filter must be in a state where BeginDecode() can be safely called.
* *
* PdfFilter ensures that a valid stream is available when this method is * PdfFilter ensures that a valid stream is available when this method is
* called, and ensures that BeginDecodeImpl() has been called. * called, and ensures that BeginDecodeImpl() has been called.
* *
* \see EndDecode */ * \see EndDecode */
virtual void EndDecodeImpl(); virtual void EndDecodeImpl();
/** GetType of this filter. /** GetType of this filter.
* \returns the GetType of this filter * \returns the GetType of this filter
*/ */
inline virtual EPdfFilter GetType() const; inline virtual EPdfFilter GetType() const;
private: private:
void EncodeBlockInternal( const char* pBuffer, long lLen, int nMode ); void EncodeBlockInternal( const char* pBuffer, pdf_long lLen, int nMode );
private: private:
unsigned char m_buffer[PODOFO_FILTER_INTERNAL_BUFFER_SIZE]; unsigned char m_buffer[PODOFO_FILTER_INTERNAL_BUFFER_SIZE];
z_stream m_stream; z_stream m_stream;
PdfPredictorDecoder* m_pPredictor; PdfPredictorDecoder* m_pPredictor;
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
skipping to change at line 460 skipping to change at line 462
* *
* \param pBuffer pointer to a buffer with data to encode * \param pBuffer pointer to a buffer with data to encode
* \param lLen length of data to encode. * \param lLen length of data to encode.
* *
* Call EndEncodeImpl() after all data has been encoded * Call EndEncodeImpl() after all data has been encoded
* *
* *
* \see BeginEncodeImpl * \see BeginEncodeImpl
* \see EndEncodeImpl * \see EndEncodeImpl
*/ */
virtual void EncodeBlockImpl( const char* pBuffer, long lLen ); virtual void EncodeBlockImpl( const char* pBuffer, pdf_long lLen );
/** /**
* Finish encoding of data. * Finish encoding of data.
* *
* \see BeginEncodeImpl * \see BeginEncodeImpl
* \see EncodeBlockImpl * \see EncodeBlockImpl
*/ */
virtual void EndEncodeImpl(); virtual void EndEncodeImpl();
/** Check wether the decoding is implemented for this filter. /** Check wether the decoding is implemented for this filter.
skipping to change at line 502 skipping to change at line 504
* the passed buffer, but you must ensure that you have processed it a nd * the passed buffer, but you must ensure that you have processed it a nd
* written it out by the end of EndDecodeImpl(). You must copy the buf fer * written it out by the end of EndDecodeImpl(). You must copy the buf fer
* if you're going to store it, as ownership is not transferred to the * if you're going to store it, as ownership is not transferred to the
* filter and the caller may free the buffer at any time. * filter and the caller may free the buffer at any time.
* *
* PdfFilter ensures that a valid stream is available when this method is * PdfFilter ensures that a valid stream is available when this method is
* called, ensures that BeginDecode() has been called, and ensures tha t * called, ensures that BeginDecode() has been called, and ensures tha t
* EndDecode() has not been called since the last BeginDecode(). * EndDecode() has not been called since the last BeginDecode().
* *
* \see DecodeBlock */ * \see DecodeBlock */
virtual void DecodeBlockImpl( const char* pBuffer, long lLen ); virtual void DecodeBlockImpl( const char* pBuffer, pdf_long lLen );
/** GetType of this filter. /** GetType of this filter.
* \returns the GetType of this filter * \returns the GetType of this filter
*/ */
inline virtual EPdfFilter GetType() const; inline virtual EPdfFilter GetType() const;
private: private:
int m_nCodeLen; int m_nCodeLen;
}; };
skipping to change at line 581 skipping to change at line 583
* *
* \param pBuffer pointer to a buffer with data to encode * \param pBuffer pointer to a buffer with data to encode
* \param lLen length of data to encode. * \param lLen length of data to encode.
* *
* Call EndEncodeImpl() after all data has been encoded * Call EndEncodeImpl() after all data has been encoded
* *
* *
* \see BeginEncodeImpl * \see BeginEncodeImpl
* \see EndEncodeImpl * \see EndEncodeImpl
*/ */
virtual void EncodeBlockImpl( const char* pBuffer, long lLen ); virtual void EncodeBlockImpl( const char* pBuffer, pdf_long lLen );
/** /**
* Finish encoding of data. * Finish encoding of data.
* *
* \see BeginEncodeImpl * \see BeginEncodeImpl
* \see EncodeBlockImpl * \see EncodeBlockImpl
*/ */
virtual void EndEncodeImpl(); virtual void EndEncodeImpl();
/** Check wether the decoding is implemented for this filter. /** Check wether the decoding is implemented for this filter.
skipping to change at line 623 skipping to change at line 625
* the passed buffer, but you must ensure that you have processed it a nd * the passed buffer, but you must ensure that you have processed it a nd
* written it out by the end of EndDecodeImpl(). You must copy the buf fer * written it out by the end of EndDecodeImpl(). You must copy the buf fer
* if you're going to store it, as ownership is not transferred to the * if you're going to store it, as ownership is not transferred to the
* filter and the caller may free the buffer at any time. * filter and the caller may free the buffer at any time.
* *
* PdfFilter ensures that a valid stream is available when this method is * PdfFilter ensures that a valid stream is available when this method is
* called, ensures that BeginDecode() has been called, and ensures tha t * called, ensures that BeginDecode() has been called, and ensures tha t
* EndDecode() has not been called since the last BeginDecode(). * EndDecode() has not been called since the last BeginDecode().
* *
* \see DecodeBlock */ * \see DecodeBlock */
virtual void DecodeBlockImpl( const char* pBuffer, long lLen ); virtual void DecodeBlockImpl( const char* pBuffer, pdf_long lLen );
/** Real implementation of `EndDecode()'. NEVER call this method direct ly. /** Real implementation of `EndDecode()'. NEVER call this method direct ly.
* *
* By the time this method returns, all filtered data must be written t o the stream * By the time this method returns, all filtered data must be written t o the stream
* and the filter must be in a state where BeginDecode() can be safely called. * and the filter must be in a state where BeginDecode() can be safely called.
* *
* PdfFilter ensures that a valid stream is available when this method is * PdfFilter ensures that a valid stream is available when this method is
* called, and ensures that BeginDecodeImpl() has been called. * called, and ensures that BeginDecodeImpl() has been called.
* *
* \see EndDecode */ * \see EndDecode */
skipping to change at line 725 skipping to change at line 727
* *
* \param pBuffer pointer to a buffer with data to encode * \param pBuffer pointer to a buffer with data to encode
* \param lLen length of data to encode. * \param lLen length of data to encode.
* *
* Call EndEncodeImpl() after all data has been encoded * Call EndEncodeImpl() after all data has been encoded
* *
* *
* \see BeginEncodeImpl * \see BeginEncodeImpl
* \see EndEncodeImpl * \see EndEncodeImpl
*/ */
virtual void EncodeBlockImpl( const char* pBuffer, long lLen ); virtual void EncodeBlockImpl( const char* pBuffer, pdf_long lLen );
/** /**
* Finish encoding of data. * Finish encoding of data.
* *
* \see BeginEncodeImpl * \see BeginEncodeImpl
* \see EncodeBlockImpl * \see EncodeBlockImpl
*/ */
virtual void EndEncodeImpl(); virtual void EndEncodeImpl();
/** Check wether the decoding is implemented for this filter. /** Check wether the decoding is implemented for this filter.
skipping to change at line 767 skipping to change at line 769
* the passed buffer, but you must ensure that you have processed it a nd * the passed buffer, but you must ensure that you have processed it a nd
* written it out by the end of EndDecodeImpl(). You must copy the buf fer * written it out by the end of EndDecodeImpl(). You must copy the buf fer
* if you're going to store it, as ownership is not transferred to the * if you're going to store it, as ownership is not transferred to the
* filter and the caller may free the buffer at any time. * filter and the caller may free the buffer at any time.
* *
* PdfFilter ensures that a valid stream is available when this method is * PdfFilter ensures that a valid stream is available when this method is
* called, ensures that BeginDecode() has been called, and ensures tha t * called, ensures that BeginDecode() has been called, and ensures tha t
* EndDecode() has not been called since the last BeginDecode(). * EndDecode() has not been called since the last BeginDecode().
* *
* \see DecodeBlock */ * \see DecodeBlock */
virtual void DecodeBlockImpl( const char* pBuffer, long lLen ); virtual void DecodeBlockImpl( const char* pBuffer, pdf_long lLen );
/** Real implementation of `EndDecode()'. NEVER call this method direct ly. /** Real implementation of `EndDecode()'. NEVER call this method direct ly.
* *
* By the time this method returns, all filtered data must be written t o the stream * By the time this method returns, all filtered data must be written t o the stream
* and the filter must be in a state where BeginDecode() can be safely called. * and the filter must be in a state where BeginDecode() can be safely called.
* *
* PdfFilter ensures that a valid stream is available when this method is * PdfFilter ensures that a valid stream is available when this method is
* called, and ensures that BeginDecodeImpl() has been called. * called, and ensures that BeginDecodeImpl() has been called.
* *
* \see EndDecode */ * \see EndDecode */
skipping to change at line 858 skipping to change at line 860
* *
* \param pBuffer pointer to a buffer with data to encode * \param pBuffer pointer to a buffer with data to encode
* \param lLen length of data to encode. * \param lLen length of data to encode.
* *
* Call EndEncodeImpl() after all data has been encoded * Call EndEncodeImpl() after all data has been encoded
* *
* *
* \see BeginEncodeImpl * \see BeginEncodeImpl
* \see EndEncodeImpl * \see EndEncodeImpl
*/ */
virtual void EncodeBlockImpl( const char* pBuffer, long lLen ); virtual void EncodeBlockImpl( const char* pBuffer, pdf_long lLen );
/** /**
* Finish encoding of data. * Finish encoding of data.
* *
* \see BeginEncodeImpl * \see BeginEncodeImpl
* \see EncodeBlockImpl * \see EncodeBlockImpl
*/ */
virtual void EndEncodeImpl(); virtual void EndEncodeImpl();
/** Check wether the decoding is implemented for this filter. /** Check wether the decoding is implemented for this filter.
skipping to change at line 900 skipping to change at line 902
* the passed buffer, but you must ensure that you have processed it a nd * the passed buffer, but you must ensure that you have processed it a nd
* written it out by the end of EndDecodeImpl(). You must copy the buf fer * written it out by the end of EndDecodeImpl(). You must copy the buf fer
* if you're going to store it, as ownership is not transferred to the * if you're going to store it, as ownership is not transferred to the
* filter and the caller may free the buffer at any time. * filter and the caller may free the buffer at any time.
* *
* PdfFilter ensures that a valid stream is available when this method is * PdfFilter ensures that a valid stream is available when this method is
* called, ensures that BeginDecode() has been called, and ensures tha t * called, ensures that BeginDecode() has been called, and ensures tha t
* EndDecode() has not been called since the last BeginDecode(). * EndDecode() has not been called since the last BeginDecode().
* *
* \see DecodeBlock */ * \see DecodeBlock */
virtual void DecodeBlockImpl( const char* pBuffer, long lLen ); virtual void DecodeBlockImpl( const char* pBuffer, pdf_long lLen );
/** Real implementation of `EndDecode()'. NEVER call this method direct ly. /** Real implementation of `EndDecode()'. NEVER call this method direct ly.
* *
* By the time this method returns, all filtered data must be written t o the stream * By the time this method returns, all filtered data must be written t o the stream
* and the filter must be in a state where BeginDecode() can be safely called. * and the filter must be in a state where BeginDecode() can be safely called.
* *
* PdfFilter ensures that a valid stream is available when this method is * PdfFilter ensures that a valid stream is available when this method is
* called, and ensures that BeginDecodeImpl() has been called. * called, and ensures that BeginDecodeImpl() has been called.
* *
* \see EndDecode */ * \see EndDecode */
 End of changes. 17 change blocks. 
15 lines changed or deleted 17 lines changed or added


 PdfFont.h   PdfFont.h 
skipping to change at line 160 skipping to change at line 160
*/ */
inline const PdfEncoding* GetEncoding() const; inline const PdfEncoding* GetEncoding() const;
/** Returns a handle to the fontmetrics object of this font. /** Returns a handle to the fontmetrics object of this font.
* This can be used for size calculations of text strings when * This can be used for size calculations of text strings when
* drawn using this font. * drawn using this font.
* \returns a handle to the font metrics object * \returns a handle to the font metrics object
*/ */
inline const PdfFontMetrics* GetFontMetrics() const; inline const PdfFontMetrics* GetFontMetrics() const;
// Peter Petrov 19 March 2009
/** Returns a handle to the fontmetrics object of this font.
* This can be used for size calculations of text strings when
* drawn using this font.
* \returns a handle to the font metrics object
*/
inline PdfFontMetrics* GetFontMetrics2();
/** Write a PdfString to a PdfStream in a format so that it can /** Write a PdfString to a PdfStream in a format so that it can
* be used with this font. * be used with this font.
* This is used by PdfPainter::DrawText to display a text string. * This is used by PdfPainter::DrawText to display a text string.
* The following PDF operator will be Tj * The following PDF operator will be Tj
* *
* \param rsString a unicode or ansi string which will be displayed * \param rsString a unicode or ansi string which will be displayed
* \param pStream the string will be appended to pStream without any l eading * \param pStream the string will be appended to pStream without any l eading
* or following whitespaces. * or following whitespaces.
*/ */
virtual void WriteStringToStream( const PdfString & rsString, PdfStream * pStream ); virtual void WriteStringToStream( const PdfString & rsString, PdfStream * pStream );
// Peter Petrov 24 September 2008
/** Embeds the font into PDF page
*
*/
virtual void EmbedFont();
protected: protected:
/** Get the base font name of this font /** Get the base font name of this font
* *
* \returns the base font name * \returns the base font name
*/ */
inline const PdfName& GetBaseFont() const; inline const PdfName& GetBaseFont() const;
private: private:
/** Initialize all variables /** Initialize all variables
*/ */
skipping to change at line 215 skipping to change at line 229
protected: protected:
const PdfEncoding* const m_pEncoding; const PdfEncoding* const m_pEncoding;
PdfFontMetrics* m_pMetrics; PdfFontMetrics* m_pMetrics;
bool m_bBold; bool m_bBold;
bool m_bItalic; bool m_bItalic;
bool m_bUnderlined; bool m_bUnderlined;
bool m_bStrikedOut; bool m_bStrikedOut;
bool m_bWasEmbedded;
PdfName m_Identifier; PdfName m_Identifier;
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
void PdfFont::SetBold( bool bBold ) void PdfFont::SetBold( bool bBold )
{ {
m_bBold = bBold; m_bBold = bBold;
} }
skipping to change at line 309 skipping to change at line 325
// //
// ----------------------------------------------------- // -----------------------------------------------------
const PdfEncoding* PdfFont::GetEncoding() const const PdfEncoding* PdfFont::GetEncoding() const
{ {
return m_pEncoding; return m_pEncoding;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
PdfFontMetrics* PdfFont::GetFontMetrics2()
{
return m_pMetrics;
}
// -----------------------------------------------------
//
// -----------------------------------------------------
const PdfFontMetrics* PdfFont::GetFontMetrics() const const PdfFontMetrics* PdfFont::GetFontMetrics() const
{ {
return m_pMetrics; return m_pMetrics;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
void PdfFont::SetUnderlined( bool bUnder ) void PdfFont::SetUnderlined( bool bUnder )
{ {
 End of changes. 4 change blocks. 
0 lines changed or deleted 24 lines changed or added


 PdfFontCID.h   PdfFontCID.h 
skipping to change at line 47 skipping to change at line 47
* 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 * \param bEmbed specifies the embedding of font
* *
*/ */
PdfFontCID( PdfFontMetrics* pMetrics, const PdfEncoding* const pEncodin g, PdfFontCID( PdfFontMetrics* pMetrics, const PdfEncoding* const pEncodin g,
PdfVecObjects* pParent, bool bEmbed = true ); PdfVecObjects* pParent, bool bEmbed = true );
// Peter Petrov 30 April 2008
/** Create a PdfFont based on an existing PdfObject /** Create a PdfFont based on an existing PdfObject
* \param pMetrics pointer to a font metrics object. The font in the P DF * \param pMetrics pointer to a font metrics object. The font in the P DF
* file will match this fontmetrics object. The metrics object is * file will match this fontmetrics object. The metrics object is
* deleted along with the font. * deleted along with the font.
* \param pEncoding the encoding of this font. The font will not take ownership of this object. * \param pEncoding the encoding of this font. The font will not take ownership of this object.
* \param pObject an existing PdfObject * \param pObject an existing PdfObject
*/ */
PdfFontCID( PdfFontMetrics* pMetrics, const PdfEncoding* const pEncodin PdfFontCID( PdfFontMetrics* pMetrics, const PdfEncoding* const pEncodin
g, PdfObject* pObject ); g, PdfObject* pObject, bool bEmbed );
// Peter Petrov 24 September 2008
/** Embeds the font into PDF page
*
*/
virtual void EmbedFont();
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
skipping to change at line 85 skipping to change at line 92
* \param bEmbed if true embed the font data into the PDF file. * \param bEmbed if true embed the font data into the PDF file.
*/ */
void Init( bool bEmbed ); void Init( bool bEmbed );
/** 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 );
// Peter Petrov 24 September 2008
PdfObject* m_pDescriptor;
}; };
}; };
#endif // _PDF_FONT_CID_H_ #endif // _PDF_FONT_CID_H_
 End of changes. 3 change blocks. 
2 lines changed or deleted 12 lines changed or added


 PdfFontCache.h   PdfFontCache.h 
skipping to change at line 29 skipping to change at line 29
************************************************************************** */ ************************************************************************** */
#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 "PdfEncoding.h"
#include "PdfEncodingFactory.h" #include "PdfEncodingFactory.h"
#include "PdfFont.h" #include "PdfFont.h"
#include "util/PdfMutex.h"
namespace PoDoFo { namespace PoDoFo {
class PdfFontMetrics; class PdfFontMetrics;
class PdfVecObjects; class PdfVecObjects;
/** A private structure, /** A private structure,
* which represents a font in the cache. * which represents a font in the cache.
*/ */
struct TFontCacheElement { struct TFontCacheElement {
skipping to change at line 83 skipping to change at line 84
m_bItalic = rhs.m_bItalic; m_bItalic = rhs.m_bItalic;
m_sFontName = rhs.m_sFontName; m_sFontName = rhs.m_sFontName;
return *this; return *this;
} }
bool operator<( const TFontCacheElement & rhs ) const bool operator<( const TFontCacheElement & rhs ) const
{ {
if( m_sFontName == rhs.m_sFontName ) if( m_sFontName == rhs.m_sFontName )
{ {
if( m_pEncoding == rhs.m_pEncoding ) if( m_pEncoding == NULL || rhs.m_pEncoding == NULL || *m_pE ncoding == *rhs.m_pEncoding )
{ {
if( m_bBold == rhs.m_bBold) if( m_bBold == rhs.m_bBold)
return m_bItalic < rhs.m_bItalic; return m_bItalic < rhs.m_bItalic;
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, inline bool operator()( const TFontCacheElement& r1,
const TFontCacheElement& r2 ) const const TFontCacheElement& r2 ) const
{ {
return r1 < r2; 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;
PdfString m_sFontName; ///< We use PdfString here as it can ea sily handle unicode on windows PdfString m_sFontName; ///< We use PdfString here as it can ea sily handle unicode on windows
}; };
/** /**
skipping to change at line 131 skipping to change at line 132
* 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 std::vector<TFontCacheElement> TSortedFontList;
typedef TSortedFontList::iterator TISortedFontList; typedef TSortedFontList::iterator TISortedFontList;
typedef TSortedFontList::const_iterator TCISortedFontList; typedef TSortedFontList::const_iterator TCISortedFontList;
#if defined(PODOFO_HAVE_FONTCONFIG)
static Util::PdfMutex m_FcMutex;
#endif
public: public:
/** 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
*/ */
skipping to change at line 177 skipping to change at line 182
* \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, bool bEmbedd,
const PdfEncoding * const = PdfEncodingFactory::Global PdfDocEncodingInstance(), const PdfEncoding * const = PdfEncodingFactory::Globa lWinAnsiEncodingInstance(),
const char* pszFileName = NULL ); const char* pszFileName = NULL );
#ifdef _WIN32 #ifdef _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 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
skipping to change at line 199 skipping to change at line 204
* \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.
* *
* This is an overloaded member function to allow working * This is an overloaded member function to allow working
* with unicode characters. On Unix systes you can also path * with unicode characters. On Unix systes you can also path
* UTF-8 to the const char* overload. * UTF-8 to the const char* overload.
*/ */
PdfFont* GetFont( const wchar_t* pszFontName, bool bBold, bool bItalic, PdfFont* GetFont( const wchar_t* pszFontName, bool bBold, bool bItalic,
bool bEmbedd, const PdfEncoding * const = PdfEncoding Factory::GlobalPdfDocEncodingInstance() ); bool bEmbedd, const PdfEncoding * const = PdfEncoding Factory::GlobalWinAnsiEncodingInstance() );
#endif // _WIN32 #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* GetFont( FT_Face face, bool bEmbedd, const PdfEncoding * const
= PdfEncodingFactory::GlobalPdfDocEncodingInstance() ); = PdfEncodingFactory::GlobalWinAnsiEncodingInstance() );
/** Get a font with specific id from the cache. If the font does not ye
t
* exist, copy from existing type1-font and set id.
*
* \param pFont an existing font
* \param pszSuffix Suffix to add to font-id
*
* \returns a PdfFont object or NULL if the font could
* not be created or found.
*/
PdfFont* GetDuplicateFontType1( PdfFont * pFont, const char* pszSuff
ix );
/** 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 pEncoding the encoding of the font. All characters * \param pEncoding the encoding of the font. All characters
* of the encoding will be included in this subset. * of the encoding will be included in this subset.
* The font will not take ownership of this object. * The font will not take ownership 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* GetFontSubset( const char* pszFontName, bool bBold, bool bItal ic, PdfFont* GetFontSubset( const char* pszFontName, bool bBold, bool bItal ic,
const PdfEncoding * const = PdfEncodingFactory:: GlobalPdfDocEncodingInstance(), const PdfEncoding * const = PdfEncodingFactory:: GlobalWinAnsiEncodingInstance(),
const char* pszFileName = NULL); const char* pszFileName = NULL);
#if defined(HAVE_FONTCONFIG) #if defined(PODOFO_HAVE_FONTCONFIG)
/** Get the path of a font file on a Unix system using fontconfig /** Get the path of a font file on a Unix system using fontconfig
* *
* This method is only available if PoDoFo was compiled with * This method is only available if PoDoFo was compiled with
* fontconfig support. * fontconfig support.
* *
* \param pConfig a handle to an initialized fontconfig library * \param pConfig a handle to an initialized fontconfig library
* \param pszFontName name of the requested font * \param pszFontName name of the requested font
* \param bBold if true find a bold font * \param bBold if true find a bold font
* \param bItalic if true find an italic font * \param bItalic if true find an italic font
* \returns the path to the fontfile or an empty string * \returns the path to the fontfile or an empty string
*/ */
static std::string GetFontConfigFontPath( FcConfig* pConfig, const char * pszFontName, bool bBold, bool bItalic ); static std::string GetFontConfigFontPath( FcConfig* pConfig, const char * pszFontName, bool bBold, bool bItalic );
#endif // defined(HAVE_FONTCONFIG) #endif // defined(PODOFO_HAVE_FONTCONFIG)
// Peter Petrov: 26 April 2008 // Peter Petrov: 26 April 2008
/** Returns the font library from font cache /** Returns the font library from font cache
* *
* \returns the internal handle to the freetype library * \returns the internal handle to the freetype library
*/ */
inline FT_Library GetFontLibrary() const; inline FT_Library GetFontLibrary() const;
private: private:
/** /**
skipping to change at line 282 skipping to change at line 298
* \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( TISortedFontList itSorted, TSortedFontList & vecContainer, PdfFont* CreateFontObject( TISortedFontList itSorted, TSortedFontList & vecContainer,
PdfFontMetrics* pMetrics, bool bEmbedd, bool bBold, 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 vecCharacters a list of Unicode character indeces that shoul d be embedded in the 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
 End of changes. 11 change blocks. 
10 lines changed or deleted 28 lines changed or added


 PdfFontFactory.h   PdfFontFactory.h 
skipping to change at line 72 skipping to change at line 72
/** Create a new PdfFont from an existing /** Create a new PdfFont from an existing
* font in a PDF file. * font in a PDF file.
* *
* \param pLibrary handle to the FreeType library, so that a PdfFontMe trics * \param pLibrary handle to the FreeType library, so that a PdfFontMe trics
* can be constructed for this font * can be constructed for this font
* \param pObject a PDF font object * \param pObject a PDF font object
*/ */
static PdfFont* CreateFont( FT_Library* pLibrary, PdfObject* pObject ); static PdfFont* CreateFont( FT_Library* pLibrary, PdfObject* pObject );
/** Try to guess the fonttype from a the filename of a font file.
*
* \param pszFilename filename of a fontfile
* \returns the font type
*/
static EPdfFontType GetFontType( const char* pszFilename );
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 7 lines changed or added


 PdfFontMetrics.h   PdfFontMetrics.h 
skipping to change at line 129 skipping to change at line 129
* This is an overloaded method for your convinience! * This is an overloaded method for your convinience!
*/ */
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, pdf_long nLength = 0 ) 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 pdf_utf16be* pszText, unsigned int nLength = 0 ) const; double StringWidth( const pdf_utf16be* pszText, unsigned int nLength = 0 ) const;
#if defined(_MSC_VER) && _MSC_VER <= 1200 // nicht f #if defined(_MSC_VER) && _MSC_VER <= 1200 // nicht f
skipping to change at line 183 skipping to change at line 183
*/ */
unsigned long StringWidthMM( const wchar_t* pszText, unsigned int nLeng th = 0 ) const; unsigned long StringWidthMM( const wchar_t* pszText, unsigned int nLeng th = 0 ) const;
#endif #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;
// Peter Petrov 20 March 2009
/** Retrieve the width of the given character in PDF units in the curre
nt font
* \param c character
* \returns the width in PDF units
*/
double UnicodeCharWidth( unsigned short 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
*/ */
unsigned long CharWidthMM( unsigned char c ) const; unsigned long CharWidthMM( unsigned char c ) const;
/** Retrieve the line spacing for this font /** Retrieve the line spacing for this font
* \returns the linespacing in PDF units * \returns the linespacing in PDF units
*/ */
inline double GetLineSpacing() const; inline double GetLineSpacing() const;
skipping to change at line 260 skipping to change at line 267
inline const char* GetFilename() const; inline const char* GetFilename() const;
/** Get a pointer to the actual font data - if it was loaded from memor y. /** Get a pointer to the actual font data - if it was loaded from memor y.
* \returns a binary buffer of data containing the font data * \returns a binary buffer of data containing the font data
*/ */
inline const char* GetFontData() const; inline const char* GetFontData() const;
/** 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 pdf_long 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 * \returns NULL or a 6 uppercase letter and "+" sign prefix
* used for font subsets * used for font subsets
*/ */
skipping to change at line 368 skipping to change at line 375
inline EPdfFontType GetFontType() const; inline EPdfFontType GetFontType() const;
/** Get the glyph id for a unicode character /** Get the glyph id for a unicode character
* in the current font. * in the current font.
* *
* \param lUnicode the unicode character value * \param lUnicode the unicode character value
* \returns the glyhph id for the character or 0 if the glyph was not found. * \returns the glyhph id for the character or 0 if the glyph was not found.
*/ */
long GetGlyphId( long lUnicode ) const; long GetGlyphId( long lUnicode ) const;
FT_Face GetFace() { return m_face; }; /** Get direct access to the internal FreeType handle
*
* \returns the internal freetype handle
*/
inline FT_Face GetFace();
/** Symbol fonts do need special treatment in a few cases.
* Use this method to check if the current font is a symbol
* font. Symbold fonts are detected by checking
* if they use FT_ENCODING_MS_SYMBOL as internal encoding.
*
* \returns true if this is a symbol font
*/
inline bool IsSymbol() const;
private: private:
/** Initialize this object from an in memory buffer /** Initialize this object from an in memory buffer
* Called internally by the constructors * Called internally by the constructors
*/ */
void InitFromBuffer(); void InitFromBuffer();
/** Load the metric data from the FTFace data /** Load the metric data from the FTFace data
* Called internally by the constructors * Called internally by the constructors
*/ */
skipping to change at line 390 skipping to change at line 411
/** Try to detect the internal fonttype from /** Try to detect the internal fonttype from
* the file extension of a fontfile. * the file extension of a fontfile.
* *
* This function will set the member m_eFontType. * This function will set the member m_eFontType.
* *
* \param pszFilename must be the filename of a font file * \param pszFilename must be the filename of a font file
*/ */
void SetFontTypeFromFilename( const char* pszFilename ); void SetFontTypeFromFilename( const char* pszFilename );
protected: public:
FT_Face m_face; FT_Face m_face;
// Peter Petrov 19 March 2009
std::string m_sFilename;
protected:
FT_Library* m_pLibrary; FT_Library* m_pLibrary;
private: private:
bool m_bSymbol; ///< Internal member to singnal a symbol font
unsigned int m_nWeight; unsigned int m_nWeight;
int m_nItalicAngle; int m_nItalicAngle;
double m_dAscent; double m_dAscent;
double m_dPdfAscent; double m_dPdfAscent;
double m_dDescent; double m_dDescent;
double m_dPdfDescent; double m_dPdfDescent;
double m_dLineSpacing; double m_dLineSpacing;
double m_dUnderlineThickness; double m_dUnderlineThickness;
double m_dUnderlinePosition; double m_dUnderlinePosition;
double m_dStrikeOutThickness; double m_dStrikeOutThickness;
double m_dStrikeOutPosition; double m_dStrikeOutPosition;
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; std::string m_sFontSubsetPrefix;
}; };
skipping to change at line 528 skipping to change at line 554
// //
// ----------------------------------------------------- // -----------------------------------------------------
const char* PdfFontMetrics::GetFontData() const const char* PdfFontMetrics::GetFontData() const
{ {
return m_bufFontData.GetBuffer(); return m_bufFontData.GetBuffer();
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
unsigned int PdfFontMetrics::GetFontDataLen() const pdf_long PdfFontMetrics::GetFontDataLen() const
{ {
return m_bufFontData.GetSize(); return m_bufFontData.GetSize();
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
unsigned int PdfFontMetrics::GetWeight() const unsigned int PdfFontMetrics::GetWeight() const
{ {
return m_nWeight; return m_nWeight;
skipping to change at line 613 skipping to change at line 639
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
float PdfFontMetrics::GetFontCharSpace() const float PdfFontMetrics::GetFontCharSpace() const
{ {
return m_fFontCharSpace; return m_fFontCharSpace;
} }
// -----------------------------------------------------
//
// -----------------------------------------------------
FT_Face PdfFontMetrics::GetFace()
{
return m_face;
}
// -----------------------------------------------------
//
// -----------------------------------------------------
bool PdfFontMetrics::IsSymbol() const
{
return m_bSymbol;
}
}; };
#endif // _PDF_FONT_METRICS_H_ #endif // _PDF_FONT_METRICS_H_
 End of changes. 10 change blocks. 
6 lines changed or deleted 49 lines changed or added


 PdfFontSimple.h   PdfFontSimple.h 
skipping to change at line 62 skipping to change at line 62
* \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 pObject an existing PdfObject * \param pObject an existing PdfObject
*/ */
PdfFontSimple( PdfFontMetrics* pMetrics, const PdfEncoding* const pEnco ding, PdfFontSimple( PdfFontMetrics* pMetrics, const PdfEncoding* const pEnco ding,
PdfObject* pObject ); PdfObject* pObject );
// Peter Petrov 24 September 2008
/** Embeds the font into PDF page
*
*/
virtual void EmbedFont();
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.
* *
* \param pDescriptor font descriptor object * \param pDescriptor font descriptor object
*/ */
virtual void EmbedFont( PdfObject* pDescriptor ) = 0; virtual void EmbedFontFile( PdfObject* pDescriptor ) = 0;
PdfObject* m_pDescriptor;
}; };
}; };
#endif /* _PDF_FONT_SIMPLE_H_ */ #endif /* _PDF_FONT_SIMPLE_H_ */
 End of changes. 2 change blocks. 
1 lines changed or deleted 9 lines changed or added


 PdfFontTTFSubset.h   PdfFontTTFSubset.h 
skipping to change at line 102 skipping to change at line 102
/** Add an unicode character to the subset /** Add an unicode character to the subset
* *
* @param nCharCode unicode character code * @param nCharCode unicode character code
*/ */
inline void AddCharacter( pdf_utf16be nCharCode ); inline void AddCharacter( pdf_utf16be nCharCode );
/** Get the number of glyphs in this font. /** Get the number of glyphs in this font.
* *
* @returns the number of glyphs in this font. * @returns the number of glyphs in this font.
*/ */
inline unsigned long GetSize() const; inline size_t GetSize() const;
private: private:
/** Hide default constructor /** Hide default constructor
*/ */
PdfFontTTFSubset() : m_bOwnDevice( false ) {} PdfFontTTFSubset() : m_bOwnDevice( false ) {}
void Init(); void Init();
/** Get the offset of a specified table. /** Get the offset of a specified table.
* @param pszTableName name of the table * @param pszTableName name of the table
skipping to change at line 178 skipping to change at line 178
unsigned long m_ulStartOfTTFOffsets; ///< Start address of the tr uetype offset tables, differs from ttf to ttc. unsigned long m_ulStartOfTTFOffsets; ///< Start address of the tr uetype offset tables, differs from ttf to ttc.
PdfInputDevice* m_pDevice; ///< Read data from this in put device PdfInputDevice* m_pDevice; ///< Read data from this in put device
const bool m_bOwnDevice; ///< If the input device is owned by this object const bool m_bOwnDevice; ///< If the input device is owned by this object
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline unsigned long PdfFontTTFSubset::GetSize() const inline size_t PdfFontTTFSubset::GetSize() const
{ {
return m_vGlyphIndice.size(); return m_vGlyphIndice.size();
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline void PdfFontTTFSubset::AddCharacter( pdf_utf16be nCharCode ) inline void PdfFontTTFSubset::AddCharacter( pdf_utf16be nCharCode )
{ {
#ifdef PODOFO_IS_LITTLE_ENDIAN #ifdef PODOFO_IS_LITTLE_ENDIAN
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 PdfFontTrueType.h   PdfFontTrueType.h 
skipping to change at line 69 skipping to change at line 69
*/ */
PdfFontTrueType( PdfFontMetrics* pMetrics, const PdfEncoding* const pEn coding, PdfFontTrueType( PdfFontMetrics* pMetrics, const PdfEncoding* const pEn coding,
PdfObject* pObject ); PdfObject* pObject );
private: private:
/** Embed the font file directly into the PDF file. /** Embed the font file directly into the PDF file.
* *
* \param pDescriptor font descriptor object * \param pDescriptor font descriptor object
*/ */
void EmbedFont( PdfObject* pDescriptor ); void EmbedFontFile( PdfObject* pDescriptor );
}; };
}; };
#endif // _PDF_FONT_TRUE_TYPE_H_ #endif // _PDF_FONT_TRUE_TYPE_H_
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 PdfFontType1.h   PdfFontType1.h 
skipping to change at line 59 skipping to change at line 59
/** Create a PdfFont based on an existing PdfObject /** Create a PdfFont based on an existing PdfObject
* \param pMetrics pointer to a font metrics object. The font in the P DF * \param pMetrics pointer to a font metrics object. The font in the P DF
* file will match this fontmetrics object. The metrics object is * file will match this fontmetrics object. The metrics object is
* deleted along with the font. * deleted along with the font.
* \param pEncoding the encoding of this font. The font will not take ownership of this object. * \param pEncoding the encoding of this font. The font will not take ownership of this object.
* \param pObject an existing PdfObject * \param pObject an existing PdfObject
*/ */
PdfFontType1( PdfFontMetrics* pMetrics, const PdfEncoding* const pEncod ing, PdfFontType1( PdfFontMetrics* pMetrics, const PdfEncoding* const pEncod ing,
PdfObject* pObject ); PdfObject* pObject );
/** Create a PdfFont based on an existing PdfFont with a new id
* \param pFont pointer to existing font
* \param pszSuffix Suffix to add to font-id
* \param pParent parent of the font object
*/
PdfFontType1( PdfFontType1* pFont, PdfFontMetrics* pMetrics, const char
*pszSuffix, PdfVecObjects* pParent );
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 EmbedFontFile( PdfObject* pDescriptor );
private: private:
long FindInBuffer( const char* pszNeedle, const char* pszHaystack, long lLen ) const; pdf_long FindInBuffer( const char* pszNeedle, const char* pszHaystack, pdf_long lLen ) const;
}; };
}; };
#endif // _PDF_FONT_TYPE1_H_ #endif // _PDF_FONT_TYPE1_H_
 End of changes. 3 change blocks. 
2 lines changed or deleted 10 lines changed or added


 PdfFunction.h   PdfFunction.h 
skipping to change at line 47 skipping to change at line 47
ePdfFunctionType_PostScript = 4 ///< A PostScript calculator function (Type4) ePdfFunctionType_PostScript = 4 ///< A PostScript calculator function (Type4)
}; };
/** /**
* This class defines a PdfFunction. * This class defines a PdfFunction.
*/ */
class PODOFO_API PdfFunction : public PdfElement { class PODOFO_API PdfFunction : public PdfElement {
public: public:
typedef std::list<PdfFunction> List; typedef std::list<PdfFunction> List;
typedef std::list<char> Sample;
virtual ~PdfFunction(); virtual ~PdfFunction();
protected: protected:
/** Create a new PdfFunction object. /** Create a new PdfFunction object.
* *
* \param eType the function type * \param eType the function type
* \param rDomain this array describes the input parameters of this Pd fFunction. If this * \param rDomain this array describes the input parameters of this Pd fFunction. If this
* function has m input parameters, this array has to c ontain 2*m numbers * function has m input parameters, this array has to c ontain 2*m numbers
* where each number describes either the lower or uppe r boundary of the input range. * where each number describes either the lower or uppe r boundary of the input range.
skipping to change at line 85 skipping to change at line 86
* *
* \param eType the function type * \param eType the function type
* \param rDomain this array describes the input parameters of this Pd fFunction. If this * \param rDomain this array describes the input parameters of this Pd fFunction. If this
* function has m input parameters, this array has to c ontain 2*m numbers * function has m input parameters, this array has to c ontain 2*m numbers
* where each number describes either the lower or uppe r boundary of the input range. * where each number describes either the lower or uppe r boundary of the input range.
*/ */
void Init( EPdfFunctionType eType, const PdfArray & rDomain ); void Init( EPdfFunctionType eType, const PdfArray & rDomain );
}; };
/** This class is a PdfSampledFunction.
*/
class PODOFO_API PdfSampledFunction : public PdfFunction {
public:
/** Create a new PdfSampledFunction object.
*
* \param rDomain this array describes the input parameters of this Pd
fFunction. If this
* function has m input parameters, this array has to c
ontain 2*m numbers
* where each number describes either the lower or uppe
r boundary of the input range.
* \param rRange this array describes the output parameters of this P
dfFunction. If this
* function has n input parameters, this array has to c
ontain 2*n numbers
* where each number describes either the lower or uppe
r boundary of the output range.
* \param rlstSamples a list of bytes which are used to build up this
function sample data
* \param pParent parent vector of objects
*/
PdfSampledFunction( const PdfArray & rDomain, const PdfArray & rRange,
const PdfFunction::Sample & rlstSamples, PdfVecObjects* pParent );
/** Create a new PdfSampledFunction object.
*
* \param rDomain this array describes the input parameters of this Pd
fFunction. If this
* function has m input parameters, this array has to c
ontain 2*m numbers
* where each number describes either the lower or uppe
r boundary of the input range.
* \param rRange this array describes the output parameters of this P
dfFunction. If this
* function has n input parameters, this array has to c
ontain 2*n numbers
* where each number describes either the lower or uppe
r boundary of the output range.
* \param rlstSamples a list of bytes which are used to build up this
function sample data
* \param pParent parent document
*/
PdfSampledFunction( const PdfArray & rDomain, const PdfArray & rRange,
const PdfFunction::Sample & rlstSamples, PdfDocument* pParent );
private:
/** Initialize this object.
*/
void Init( const PdfArray & rDomain, const PdfArray & rRange, const Pd
fFunction::Sample & rlstSamples );
};
/** This class is a PdfExponentialFunction. /** This class is a PdfExponentialFunction.
*/ */
class PODOFO_API PdfExponentialFunction : public PdfFunction { class PODOFO_API PdfExponentialFunction : public PdfFunction {
public: public:
/** Create a new PdfExponentialFunction object. /** Create a new PdfExponentialFunction object.
* *
* \param rDomain this array describes the input parameters of this Pd fFunction. If this * \param rDomain this array describes the input parameters of this Pd fFunction. If this
* function has m input parameters, this array has to c ontain 2*m numbers * function has m input parameters, this array has to c ontain 2*m numbers
* where each number describes either the lower or uppe r boundary of the input range. * where each number describes either the lower or uppe r boundary of the input range.
* \param rC0 * \param rC0
 End of changes. 2 change blocks. 
0 lines changed or deleted 55 lines changed or added


 PdfHintStream.h   PdfHintStream.h 
skipping to change at line 63 skipping to change at line 63
* \param val the value to write to the stream * \param val the value to write to the stream
*/ */
void WriteUInt32( pdf_uint32 ); void WriteUInt32( pdf_uint32 );
private: private:
//void CreatePageHintTable( TVecXRefTable* pXRef ); //void CreatePageHintTable( TVecXRefTable* pXRef );
void CreateSharedObjectHintTable(); void CreateSharedObjectHintTable();
private: private:
PdfPagesTree* m_pPagesTree; PdfPagesTree* m_pPagesTree;
bool m_bLittleEndian;
}; };
}; // end namespace NonPublic }; // end namespace NonPublic
}; // end namespace PoDoFo }; // end namespace PoDoFo
#endif /* _PDF_HINT_STREAM_H_ */ #endif /* _PDF_HINT_STREAM_H_ */
 End of changes. 1 change blocks. 
2 lines changed or deleted 0 lines changed or added


 PdfImage.h   PdfImage.h 
skipping to change at line 51 skipping to change at line 51
* \see GetImageReference * \see GetImageReference
* \see PdfPainter::DrawImage * \see PdfPainter::DrawImage
* *
* \see SetImageData * \see SetImageData
*/ */
class PODOFO_API PdfImage : public PdfXObject { class PODOFO_API PdfImage : public PdfXObject {
public: public:
/** Constuct a new PdfImage object /** Constuct a new PdfImage object
* *
* \param pParent parent vector of this image * \param pParent parent vector of this image
* \param pszPrefix optional prefix for XObject-name
*/ */
PdfImage( PdfVecObjects* pParent ); PdfImage( PdfVecObjects* pParent, const char* pszPrefix = NULL );
/** Constuct a new PdfImage object /** Constuct a new PdfImage object
* This is an overloaded constructor. * This is an overloaded constructor.
* *
* \param pParent parent document * \param pParent parent document
* \param pszPrefix optional prefix for XObject-name
*/ */
PdfImage( PdfDocument* pParent ); PdfImage( PdfDocument* pParent, const char* pszPrefix = NULL );
/** Construct an image from an existing PdfObject /** Construct an image from an existing PdfObject
* *
* \param pObject a PdfObject that has to be an image * \param pObject a PdfObject that has to be an image
*/ */
PdfImage( PdfObject* pObject ); PdfImage( PdfObject* pObject );
~PdfImage(); ~PdfImage();
/**
* Get a list of all image formats supported by this PoDoFo build.
*
* Example: { "JPEG", "TIFF", NULL }
*
* \returns a zero terminates list of all supported image formats
*/
static const char** GetSupportedFormats();
/** Set the color space of this image. The default value is /** Set the color space of this image. The default value is
* ePdfColorSpace_DeviceRGB. * ePdfColorSpace_DeviceRGB.
* \param eColorSpace one of ePdfColorSpace_DeviceGray, ePdfColorSpace _DeviceRGB and * \param eColorSpace one of ePdfColorSpace_DeviceGray, ePdfColorSpace _DeviceRGB and
* ePdfColorSpace_DeviceCMYK * ePdfColorSpace_DeviceCMYK
* *
* \see SetImageICCProfile to set an ICC profile instead of a simple c olorspace * \see SetImageICCProfile to set an ICC profile instead of a simple c olorspace
*/ */
void SetImageColorSpace( EPdfColorSpace eColorSpace ); void SetImageColorSpace( EPdfColorSpace eColorSpace );
/** Set an ICC profile for this image. /** Set an ICC profile for this image.
skipping to change at line 91 skipping to change at line 102
* \param lColorComponents the number of colorcomponents of the ICC pr ofile * \param lColorComponents the number of colorcomponents of the ICC pr ofile
* \param eAlternateColorSpace an alternate colorspace to use if the I CC profile cannot be used * \param eAlternateColorSpace an alternate colorspace to use if the I CC profile cannot be used
* *
* \see SetImageColorSpace to set an colorspace instead of an ICC prof ile for this image * \see SetImageColorSpace to set an colorspace instead of an ICC prof ile for this image
*/ */
void SetImageICCProfile( PdfInputStream* pStream, long lColorComponents , void SetImageICCProfile( PdfInputStream* pStream, long lColorComponents ,
EPdfColorSpace eAlternateColorSpace = ePdfColo rSpace_DeviceRGB ); EPdfColorSpace eAlternateColorSpace = ePdfColo rSpace_DeviceRGB );
//EPdfColorSpace GetImageColorSpace() const; //EPdfColorSpace GetImageColorSpace() const;
/** Get the width of the image when drawn in PDF units /** Set a softmask for this image.
* \param pSoftmask a PdfImage pointer to the image, which is to be se
t as softmask, must be 8-Bit-Grayscale
*
*/
void SetImageSoftmask( const PdfImage* pSoftmask );
/** Get the width of the image when drawn in PDF units
* \returns the width in PDF units * \returns the width in PDF units
*/ */
inline double GetWidth() const; inline double GetWidth() const;
/** Get the height of the image when drawn in PDF units /** Get the height of the image when drawn in PDF units
* \returns the height in PDF units * \returns the height in PDF units
*/ */
inline double GetHeight() const; inline double GetHeight() const;
/** Set the actual image data from an input stream /** Set the actual image data from an input stream
* *
* The image data will be flater compressed. * The image data will be flate compressed.
* If you want no compression or another filter to be applied * If you want no compression or another filter to be applied
* use the overload of SetImageData which takes a TVecFilters * use the overload of SetImageData which takes a TVecFilters
* as argument. * as argument.
* *
* \param nWidth width of the image in pixels * \param nWidth width of the image in pixels
* \param nHeight height of the image in pixels * \param nHeight height of the image in pixels
* \param nBitsPerComponent bits per color component of the image (dep ends on the image colorspace you have set * \param nBitsPerComponent bits per color component of the image (dep ends on the image colorspace you have set
* but is 8 in most cases) * but is 8 in most cases)
* \param pStream stream supplieding raw image data * \param pStream stream supplieding raw image data
* *
skipping to change at line 159 skipping to change at line 176
*/ */
void LoadFromJpeg( const wchar_t* pszFilename ); void LoadFromJpeg( const wchar_t* pszFilename );
#endif // _WIN32 #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
#ifdef PODOFO_HAVE_PNG_LIB
/** Load the image data from a PNG file
* \param pszFilename
*/
void LoadFromPng( const char* pszFilename );
#endif // PODOFO_HAVE_PNG_LIB
private: private:
/** Set the actual image data from an input stream. /** Set the actual image data from an input stream.
* The data has to be encoded already and an appropriate * The data has to be encoded already and an appropriate
* filters key entry has to be set manually before! * filters key entry has to be set manually before!
* *
* \param nWidth width of the image in pixels * \param nWidth width of the image in pixels
* \param nHeight height of the image in pixels * \param nHeight height of the image in pixels
* \param nBitsPerComponent bits per color component of the image (dep ends on the image colorspace you have set * \param nBitsPerComponent bits per color component of the image (dep ends on the image colorspace you have set
* but is 8 in most cases) * but is 8 in most cases)
 End of changes. 8 change blocks. 
4 lines changed or deleted 28 lines changed or added


 PdfInfo.h   PdfInfo.h 
skipping to change at line 38 skipping to change at line 38
namespace PoDoFo { namespace PoDoFo {
class PdfString; class PdfString;
/** This class provides access to the documents /** This class provides access to the documents
* info dictionary, which provides information * info dictionary, which provides information
* about the PDF document. * about the PDF document.
*/ */
class PODOFO_API PdfInfo : public PdfElement { class PODOFO_API PdfInfo : public PdfElement {
public: public:
/**
* Enum to specifiy the initial information of the
* info dictionary.
*/
enum EPdfInfoInitial {
ePdfInfoInitial_WriteCreationTime = 0x01, ///< Write the creati
on time (current time). Default for new documents.
ePdfInfoInitial_WriteModificationTime = 0x02, ///< Write the modifi
cation time (current time). Default for loaded documents.
ePdfInfoInitial_WriteProducer = 0x04 ///< Write producer k
ey. Default for new documents.
};
/** Create a new PdfInfo object /** Create a new PdfInfo object
* \param pParent the parent of this object * \param pParent the parent of this object
* \param eInitial which information should be
* writting initially to the information dictionary
*/ */
PdfInfo( PdfVecObjects* pParent ); PdfInfo( PdfVecObjects* pParent,
int eInitial = ePdfInfoInitial_WriteCreationTime | ePdfInfoIni
tial_WriteProducer );
/** Create a PdfInfo object from an existing /** Create a PdfInfo object from an existing
* object in the PDF file. * object in the PDF file.
* \param pObject must be an info dictionary. * \param pObject must be an info dictionary.
* \param eInitial which information should be
* writting initially to the information
*/ */
PdfInfo( PdfObject* pObject ); PdfInfo( PdfObject* pObject, int eInitial = ePdfInfoInitial_WriteModifi cationTime );
/** Destructor /** Destructor
*/ */
~PdfInfo(); ~PdfInfo();
/** Set the author of the document. /** Set the author of the document.
* \param sAuthor author * \param sAuthor author
*/ */
void SetAuthor( const PdfString & sAuthor ); void SetAuthor( const PdfString & sAuthor );
skipping to change at line 128 skipping to change at line 143
*/ */
void SetTrapped( const PdfName & sTrapped ); void SetTrapped( const PdfName & sTrapped );
/** Get the trapping state of the document /** Get the trapping state of the document
* \returns the title * \returns the title
*/ */
inline const PdfName & GetTrapped() const; inline const PdfName & GetTrapped() const;
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 eInitial which information should be
* of a CreationDate. * writting initially to the information
*/ */
void Init( bool bModify = false ); void Init( int eInitial );
/** Get a value from the info dictionary as name /** Get a value from the info dictionary as name
* \para rName the key to fetch from the info dictionary * \para rName the key to fetch from the info dictionary
* \return a value from the info dictionary * \return a value from the info dictionary
*/ */
const PdfString & GetStringFromInfoDict( const PdfName & rName ) const; const PdfString & GetStringFromInfoDict( const PdfName & rName ) const;
/** 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
 End of changes. 7 change blocks. 
5 lines changed or deleted 24 lines changed or added


 PdfInputDevice.h   PdfInputDevice.h 
skipping to change at line 70 skipping to change at line 70
PdfInputDevice( const wchar_t* pszFilename ); PdfInputDevice( const wchar_t* pszFilename );
#endif #endif
#endif // _WIN32 #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, size_t 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.
* *
* \param pInStream read from this std::istream * \param pInStream read from this std::istream
*/ */
PdfInputDevice( const std::istream* pInStream ); PdfInputDevice( const std::istream* pInStream );
/** Destruct the PdfInputDevice object and close any open files. /** Destruct the PdfInputDevice object and close any open files.
*/ */
virtual ~PdfInputDevice(); virtual ~PdfInputDevice();
skipping to change at line 162 skipping to change at line 162
*/ */
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;
FILE * m_pFile;
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)
 End of changes. 2 change blocks. 
1 lines changed or deleted 2 lines changed or added


 PdfInputStream.h   PdfInputStream.h 
skipping to change at line 47 skipping to change at line 47
/** 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.
*/ */
virtual long Read( char* pBuffer, long lLen ) = 0; virtual pdf_long Read( char* pBuffer, pdf_long lLen ) = 0;
}; };
/** 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
* *
skipping to change at line 85 skipping to change at line 85
/** 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.
*/ */
virtual long Read( char* pBuffer, long lLen ); virtual pdf_long Read( char* pBuffer, pdf_long lLen );
/** Get the length of the file. /** Get the length of the file.
* \return the file length * \return the file length
*/ */
long GetFileLength(); pdf_long GetFileLength();
private: private:
FILE* m_hFile; FILE* m_hFile;
}; };
/** An input stream that reads data from a memory buffer /** An input stream that reads data from a memory buffer
*/ */
class PODOFO_API PdfMemoryInputStream : public PdfInputStream { class PODOFO_API PdfMemoryInputStream : public PdfInputStream {
public: public:
/** Open a file for reading data /** Open a file for reading data
* *
* \param pBuffer buffer to read from * \param pBuffer buffer to read from
* \param lBufferLen length of the buffer * \param lBufferLen length of the buffer
*/ */
PdfMemoryInputStream( const char* pBuffer, long lBufferLen ); PdfMemoryInputStream( const char* pBuffer, pdf_long lBufferLen );
~PdfMemoryInputStream(); ~PdfMemoryInputStream();
/** 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.
*/ */
virtual long Read( char* pBuffer, long lLen ); virtual pdf_long Read( char* pBuffer, pdf_long lLen );
private: private:
const char* m_pBuffer; const char* m_pBuffer;
const char* m_pCur; const char* m_pCur;
long m_lBufferLen; pdf_long m_lBufferLen;
}; };
/** An input stream that reads data from an input device /** An input stream that reads data from an input device
*/ */
class PODOFO_API PdfDeviceInputStream : public PdfInputStream { class PODOFO_API PdfDeviceInputStream : public PdfInputStream {
public: public:
/** /**
* Read from an alread opened input device * Read from an alread opened input device
* *
skipping to change at line 148 skipping to change at line 148
/** 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.
*/ */
virtual long Read( char* pBuffer, long lLen ); virtual pdf_long Read( char* pBuffer, pdf_long lLen );
private: private:
PdfInputDevice* m_pDevice; PdfInputDevice* m_pDevice;
}; };
}; };
#endif // _PDF_INPUT_STREAM_H_ #endif // _PDF_INPUT_STREAM_H_
 End of changes. 7 change blocks. 
7 lines changed or deleted 7 lines changed or added


 PdfMemDocument.h   PdfMemDocument.h 
skipping to change at line 311 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" ); }
/** Get access to the MarkInfo dictionary (ISO 32000-1:2008 14.7.1)
* \returns PdfObject the MarkInfo dictionary
*/
PdfObject* GetMarkInfo() const { return GetNamedObjectFromCatalog( "Mar
kInfo" ); }
/** Creates a PdfFont object from an existing font. /** Creates a PdfFont object from an existing font.
* *
* \param pObject a PdfObject that is a font * \param pObject a PdfObject that is a font
* \returns PdfFont* a pointer to a new PdfFont object. * \returns PdfFont* a pointer to a new PdfFont object.
* The returned object is owned by the PdfDocument. * The returned object is owned by the PdfDocument.
*/ */
PdfFont* GetFont( PdfObject* pObject ); PdfFont* GetFont( PdfObject* pObject );
/** Copies one or more pages from another PdfMemDocument to this docume nt /** Copies one or more pages from another PdfMemDocument to this docume nt
* \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
* It does NOT remove any PdfObjects from memory - just the reference
from the pages tree.
* If you want to delete resources of this page, you have to delete th
em yourself,
* but the resources might be used by other pages, too.
*
* \param inFirstPage the first page number to delete (0-based) * \param inFirstPage the first page number to delete (0-based)
* \param inNumPages the number of pages to delete * \param inNumPages the number of pages to delete
* \returns this document * \returns this document
*/ */
void DeletePages( int inFirstPage, int inNumPages ); void DeletePages( int inFirstPage, int inNumPages );
/** Checks if printing this document is allowed. /** Checks if printing this document is allowed.
* Every PDF consuming applications has to adhere this value! * Every PDF consuming applications has to adhere this value!
* *
* \returns true if you are allowed to print this document * \returns true if you are allowed to print this document
 End of changes. 2 change blocks. 
0 lines changed or deleted 12 lines changed or added


 PdfMemStream.h   PdfMemStream.h 
skipping to change at line 83 skipping to change at line 83
* No filters will be applied to the buffer, so * No filters will be applied to the buffer, so
* if the stream is Flate compressed the compressed copy * if the stream is Flate compressed the compressed copy
* will be returned. * will be returned.
* *
* The caller has to free() the buffer. * The caller has to free() the buffer.
* *
* \param pBuffer pointer to the buffer * \param pBuffer pointer to the buffer
* \param lLen pointer to the buffer length * \param lLen pointer to the buffer length
* \returns ErrOk on success. * \returns ErrOk on success.
*/ */
virtual void GetCopy( char** pBuffer, long* lLen ) const; virtual void GetCopy( char** pBuffer, pdf_long* lLen ) const;
/** Get a copy of a the stream and write it to a PdfOutputStream
*
* \param pStream data is written to this stream.
*/
virtual void GetCopy( PdfOutputStream* pStream ) const;
/** Get a read-only handle to the current stream data. /** Get a read-only handle to the current stream data.
* The data will not be filtered before being returned, so (eg) callin g * The data will not be filtered before being returned, so (eg) callin g
* Get() on a Flate compressed stream will return a pointer to the * Get() on a Flate compressed stream will return a pointer to the
* Flate-compressed buffer. * Flate-compressed buffer.
* *
* \warning Do not retain pointers to the stream's internal buffer, * \warning Do not retain pointers to the stream's internal buffer,
* as it may be reallocated with any non-const operation. * as it may be reallocated with any non-const operation.
* *
* \returns a read-only handle to the streams data * \returns a read-only handle to the streams data
*/ */
inline const char* Get() const; inline const char* Get() const;
/** Get the stream's length. The length is that of the internal /** Get the stream's length. The length is that of the internal
* stream buffer, so (eg) for a Flate-compressed stream it will be * stream buffer, so (eg) for a Flate-compressed stream it will be
* the length of the compressed data. * the length of the compressed data.
* *
* \returns the length of the internal buffer * \returns the length of the internal buffer
* \see Get() * \see Get()
*/ */
inline unsigned long GetLength() const; inline pdf_long GetLength() const;
/** This function compresses any currently set stream /** This function compresses any currently set stream
* using the FlateDecode(ZIP) algorithm. JPEG compressed streams * using the FlateDecode(ZIP) algorithm. JPEG compressed streams
* will not be compressed again using this function. * will not be compressed again using this function.
* Entries to the filter dictionary will be added if necessary. * Entries to the filter dictionary will be added if necessary.
*/ */
void FlateCompress(); void FlateCompress();
/** This method removes all filters from the stream /** This method removes all filters from the stream
*/ */
skipping to change at line 137 skipping to change at line 143
protected: protected:
/** Required for the GetFilteredCopy implementation /** Required for the GetFilteredCopy implementation
* \returns a handle to the internal buffer * \returns a handle to the internal buffer
*/ */
inline virtual const char* GetInternalBuffer() const; inline virtual const char* GetInternalBuffer() const;
/** Required for the GetFilteredCopy implementation /** Required for the GetFilteredCopy implementation
* \returns the size of the internal buffer * \returns the size of the internal buffer
*/ */
inline virtual unsigned long GetInternalBufferSize() const; inline virtual pdf_long GetInternalBufferSize() const;
/** Begin appending data to this stream. /** Begin appending data to this stream.
* Clears the current stream contents. * Clears the current stream contents.
* *
* \param vecFilters use this filters to encode any data written to th e stream. * \param vecFilters use this filters to encode any data written to th e stream.
*/ */
virtual void BeginAppendImpl( const TVecFilters & vecFilters ); virtual void BeginAppendImpl( const TVecFilters & vecFilters );
/** Append a binary buffer to the current stream contents. /** Append a binary buffer to the current stream contents.
* *
skipping to change at line 173 skipping to change at line 179
* Expects that all filters are setup correctly. * Expects that all filters are setup correctly.
* \returns ErrOk on success * \returns ErrOk on success
*/ */
void FlateCompressStreamData(); void FlateCompressStreamData();
private: private:
PdfRefCountedBuffer m_buffer; PdfRefCountedBuffer m_buffer;
PdfOutputStream* m_pStream; PdfOutputStream* m_pStream;
PdfBufferOutputStream* m_pBufferStream; PdfBufferOutputStream* m_pBufferStream;
long m_lLength; pdf_long m_lLength;
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
const char* PdfMemStream::Get() const const char* PdfMemStream::Get() const
{ {
return m_buffer.GetBuffer(); return m_buffer.GetBuffer();
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
unsigned long PdfMemStream::GetLength() const pdf_long PdfMemStream::GetLength() const
{ {
return m_lLength; return m_lLength;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
const char* PdfMemStream::GetInternalBuffer() const const char* PdfMemStream::GetInternalBuffer() const
{ {
return m_buffer.GetBuffer(); return m_buffer.GetBuffer();
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
unsigned long PdfMemStream::GetInternalBufferSize() const pdf_long PdfMemStream::GetInternalBufferSize() const
{ {
return m_lLength; return m_lLength;
} }
}; };
#endif // _PDF_MEM_STREAM_H_ #endif // _PDF_MEM_STREAM_H_
 End of changes. 6 change blocks. 
6 lines changed or deleted 12 lines changed or added


 PdfMutex.h   PdfMutex.h 
/************************************************************************** * /************************************************************************** *
* Copyright (C) 2008 by Dominik Seichter * * Copyright (C) 2008 by Dominik Seichter, Craig Ringer *
* domseichter@web.de * * domseichter@web.de *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Library General Public License as * * it under the terms of the GNU Library General Public License as *
* published by the Free Software Foundation; either version 2 of the * * published by the Free Software Foundation; either version 2 of the *
* License, or (at your option) any later version. * * License, or (at your option) any later version. *
* * * *
* This program is distributed in the hope that it will be useful, * * This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of * * but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. * * GNU General Public License for more details. *
* * * *
* 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_MUTEX_H_ #ifndef PDF_PDFMUTEX_H
#define _PDF_MUTEX_H_ #define PDF_PDFMUTEX_H
#include "../PdfDefines.h" #if defined(BUILDING_PODOFO)
#ifdef PODOFO_MULTI_THREAD /* Import the platform-specific implementation of PdfMutex */
#ifdef _WIN32 #if defined(PODOFO_MULTI_THREAD)
#ifndef _WIN32_WINNT # if defined(_WIN32)
#define _WIN32_WINNT 0x0400 // Make the TryEnterCriticalSection method avai # include "PdfMutexImpl_win32.h"
lable # else
#include <windows.h> # include "PdfMutexImpl_pthread.h"
#undef _WIN32_WINNT # endif
#else #else
#include <windows.h> # include "PdfMutexImpl_noop.h"
#endif // _WIN32_WINNT #endif
#undef CreateFont
#undef DrawText
#undef GetObject
#else
#include <pthread.h>
#endif // _WIN32
#endif // PODOFO_MULTI_THREAD
namespace PoDoFo { namespace PoDoFo { namespace Util {
namespace Util {
/** A plattform independent mutex. /**
* Reentrant mutex implemented by win32 CRITICAL_SECTION or pthread recursi
ve mutex.
*
* If PODOFO_MULTI_THREAD is not set, all operations are no-ops and always
succeed.
*
* A held (locked) PdfMutex may not be acquired (locked) by a thread other
than
* the thread that currently holds it.
* *
* Uses pthreads on Unix and critical sections * The thread holding a PdfMutex may acquire it repeatedly. Every acquision
* on Windows. must be matched
* by a release.
* *
* If PODOFO_MULTI_THREAD is not defined during * When a PdfMutex is not held by any thread (ie it is newly allocated or h
* the build, this class does nothing. as been released)
* then exactly one thread attempting to acquire it will succeed. If there
is more than one
* thread trying to acquire a PdfMutex, which thread will succeed is undefi
ned.
* *
*/ */
class PODOFO_API PdfMutex { class PdfMutex : public PdfMutexImpl
{
// This wrapper/extension class is provided so we can add platform-indepe
ndent
// functionality and helpers if desired.
public: public:
/** Construct a new mutex PdfMutex() { }
*/ ~PdfMutex() { }
PdfMutex();
~PdfMutex();
/**
* Query if this is a multithreaded PoDoFo build.
*/
static bool IsPoDoFoMultiThread();
/**
* Lock the mutex
*/
void Lock();
/**
* Try locking the mutex.
*
* \returns true if the mutex was locked
* \returns false if the mutex is already locked
* by some other thread
*/
bool TryLock();
/**
* Unlock the mutex
*/
void UnLock();
private:
#ifdef PODOFO_MULTI_THREAD
#ifdef _WIN32
CRITICAL_SECTION m_cs;
#else
pthread_mutex_t m_mutex;
#endif // _WIN32
#endif // PODOFO_MULTI_THREAD
}; };
}; // Util };};
}; // PoDoFo
#else // BUILDING_PODOFO
// Only a forward-declaration is available for PdfMutex for sources outside
the
// PoDoFo library build its self. PdfMutex is not public API.
namespace PoDoFo { namespace Util { class PdfMutex; }; };
#endif
#endif // _PDF_MUTEX_H_ #endif
 End of changes. 13 change blocks. 
68 lines changed or deleted 48 lines changed or added


 PdfMutexWrapper.h   PdfMutexWrapper.h 
skipping to change at line 35 skipping to change at line 35
#include "PdfMutex.h" #include "PdfMutex.h"
namespace PoDoFo { namespace PoDoFo {
namespace Util { namespace Util {
/** /**
* A wrapper around PdfMutex. * A wrapper around PdfMutex.
* The mutex is locked in the constructor * The mutex is locked in the constructor
* and unlocked in the destructor. * and unlocked in the destructor.
* *
* All exceptions that might be thrown by PdfMutex * In debug builds all exceptions thrown by the mutex implementation
* are catched and logged. * are caught and logged before being rethrown.
* *
* Note that PdfMutexWrapper is *not* part of PoDoFo's public API.
*/ */
class PODOFO_API PdfMutexWrapper { class PdfMutexWrapper {
public: public:
/** Lock a mutex. /** Lock a mutex.
* *
* \param rMutex the mutex to be locked. * \param rMutex the mutex to be locked.
*/ */
PODOFO_NOTHROW PdfMutexWrapper( PdfMutex & rMutex ); PODOFO_NOTHROW inline PdfMutexWrapper( PdfMutex & rMutex );
/** Unlocks the mutex on destruction /** Unlocks the mutex on destruction
*/ */
~PdfMutexWrapper(); inline ~PdfMutexWrapper();
private: private:
PdfMutex& m_rMutex; PdfMutex& m_rMutex;
}; };
PdfMutexWrapper::PdfMutexWrapper( PdfMutex & rMutex )
: m_rMutex( rMutex )
{
m_rMutex.Lock();
}
PdfMutexWrapper::~PdfMutexWrapper()
{
#if defined(DEBUG)
try {
m_rMutex.UnLock();
}
catch( const PdfError & rError )
{
rError.PrintErrorMsg();
throw rError;
}
#else
m_rMutex.UnLock();
#endif
}
}; // Util }; // Util
}; // PoDoFo }; // PoDoFo
#endif // _PDF_MUTEX_H_ #endif // _PDF_MUTEX_H_
 End of changes. 6 change blocks. 
5 lines changed or deleted 28 lines changed or added


 PdfName.h   PdfName.h 
skipping to change at line 30 skipping to change at line 30
#ifndef _PDF_NAME_H_ #ifndef _PDF_NAME_H_
#define _PDF_NAME_H_ #define _PDF_NAME_H_
#include "PdfDefines.h" #include "PdfDefines.h"
#include "PdfDataType.h" #include "PdfDataType.h"
namespace PoDoFo { namespace PoDoFo {
class PdfOutputDevice; class PdfOutputDevice;
class PdfName;
//std::size_t hash_value(PdfName const& name);
/** This class represents a PdfName. /** This class represents a PdfName.
* Whenever a key is required you have to use a PdfName object. * Whenever a key is required you have to use a PdfName object.
* *
* PdfName are required as keys in PdfObject and PdfVariant objects. * PdfName are required as keys in PdfObject and PdfVariant objects.
* *
* PdfName may have a maximum length of 127 characters. * PdfName may have a maximum length of 127 characters.
* *
* \see PdfObject \see PdfVariant * \see PdfObject \see PdfVariant
*/ */
class PODOFO_API PdfName : public PdfDataType { class PODOFO_API PdfName : public PdfDataType {
public: public:
/** Constructor to create NULL strings. /** Constructor to create NULL strings.
* use PdfName::KeyNull instead of this constructor * use PdfName::KeyNull instead of this constructor
*/ */
PdfName() PdfName()
: PdfDataType(), m_Data("") : PdfDataType(), m_Data("")
{ {
} }
/** Create a new PdfName object. /** Create a new PdfName object.
* \param sName the unescaped value of this name. Please specify * \param sName the unescaped value of this name. Please specify
skipping to change at line 97 skipping to change at line 101
static PdfName FromEscaped( const std::string& sName ); static PdfName FromEscaped( const std::string& sName );
/** Create a new PdfName object from a string containing an escaped /** Create a new PdfName object from a string containing an escaped
* name string without the leading / . * name string without the leading / .
* \param pszName A string containing the escaped name * \param pszName A string containing the escaped name
* \param ilength length of the escaped string data. If a length * \param ilength length of the escaped string data. If a length
* of 0 is passed, the string data is expected to * of 0 is passed, the string data is expected to
* be a zero terminated string. * be a zero terminated string.
* \return A new PdfName * \return A new PdfName
*/ */
static PdfName FromEscaped( const char * pszName, int ilength = 0 ); static PdfName FromEscaped( const char * pszName, pdf_long ilength = 0 );
/** \return an escaped representation of this name /** \return an escaped representation of this name
* without the leading / . * without the leading / .
* *
* There is no corresponding GetEscapedLength(), since * There is no corresponding GetEscapedLength(), since
* generating the return value is somewhat expensive. * generating the return value is somewhat expensive.
*/ */
std::string GetEscapedName() const; std::string GetEscapedName() const;
/** Create a copy of an existing PdfName object. /** Create a copy of an existing PdfName object.
 End of changes. 3 change blocks. 
1 lines changed or deleted 5 lines changed or added


 PdfNamesTree.h   PdfNamesTree.h 
skipping to change at line 104 skipping to change at line 104
* 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 /** Peter Petrov: 23 May 2008
* I have made it for access to "JavaScript" dictonary. This is "docume nt-level javascript storage" * I have made it for access to "JavaScript" dictonary. This is "docume nt-level javascript storage"
* \param bCreate if true the javascript node is created if it does no t exists.
*/ */
inline PdfObject* GetJavaScriptNode() const; inline PdfObject* GetJavaScriptNode(bool bCreate = false) const;
/** Peter Petrov: 6 June 2008 /** Peter Petrov: 6 June 2008
* I have made it for access to "Dest" dictionary. This is "document-le vel named destination storage" * I have made it for access to "Dest" dictionary. This is "document-le vel named destination storage"
* \param bCreate if true the dests node is created if it does not exi sts.
*/ */
inline PdfObject* GetDestsNode() const; inline PdfObject* GetDestsNode(bool bCreate = false) 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
* - URLS * - URLS
* - EmbeddedFiles * - EmbeddedFiles
* - AlternatePresentations * - AlternatePresentations
* - Renditions * - Renditions
* *
* \param bCreate if true the root node is create if it does not exist s. * \param bCreate if true the root node is created if it does not exis ts.
* \returns the root node of the tree or NULL if it does not exists * \returns the root node of the tree or NULL if it does not exists
*/ */
PdfObject* GetRootNode( const PdfName & name, bool bCreate = false ) co nst; PdfObject* GetRootNode( const PdfName & name, bool bCreate = false ) co nst;
/** Recursively walk through the name tree and find the value for key. /** Recursively walk through the name tree and find the value for key.
* \param pObj the name tree * \param pObj the name tree
* \param key the key to find a value for * \param key the key to find a value for
* \return the value for the key or NULL if it was not found * \return the value for the key or NULL if it was not found
*/ */
PdfObject* GetKeyValue( PdfObject* pObj, const PdfString & key ) const; PdfObject* GetKeyValue( PdfObject* pObj, const PdfString & key ) const;
skipping to change at line 153 skipping to change at line 155
*/ */
void AddToDictionary( PdfObject* pObj, PdfDictionary & rDict ); void AddToDictionary( PdfObject* pObj, PdfDictionary & rDict );
private: private:
PdfObject* m_pCatalog; PdfObject* m_pCatalog;
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
PdfObject* PdfNamesTree::GetJavaScriptNode() const PdfObject* PdfNamesTree::GetJavaScriptNode(bool bCreate) const
{ {
return this->GetRootNode( PdfName("JavaScript") ); return this->GetRootNode( PdfName("JavaScript"), bCreate );
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
PdfObject* PdfNamesTree::GetDestsNode() const PdfObject* PdfNamesTree::GetDestsNode(bool bCreate) const
{ {
return this->GetRootNode( PdfName("Dests") ); return this->GetRootNode( PdfName("Dests"), bCreate );
} }
}; };
#endif // _PDF_NAMES_TREE_H_ #endif // _PDF_NAMES_TREE_H_
 End of changes. 9 change blocks. 
7 lines changed or deleted 9 lines changed or added


 PdfObject.h   PdfObject.h 
skipping to change at line 90 skipping to change at line 90
PdfObject( const PdfVariant & var ); PdfObject( const PdfVariant & var );
/** Construct a PdfObject with object and generation number -1 /** Construct a PdfObject with object and generation number -1
* and a bool as value. * and a bool as value.
* *
* \param b the boolean value of this PdfObject * \param b the boolean value of this PdfObject
*/ */
PdfObject( bool b ); PdfObject( bool b );
/** Construct a PdfObject with object and generation number -1 /** Construct a PdfObject with object and generation number -1
* and a long as value. * and a pdf_int64 as value.
* *
* \param l the long value of this PdfObject * \param l the pdf_int64 value of this PdfObject
*/ */
PdfObject( long l ); PdfObject( pdf_int64 l );
/** Construct a PdfObject with object and generation number -1 /** Construct a PdfObject with object and generation number -1
* and a double as value. * and a double as value.
* *
* \param d the double value of this PdfObject * \param d the double value of this PdfObject
*/ */
PdfObject( double d ); PdfObject( double d );
/** Construct a PdfObject with object and generation number -1 /** Construct a PdfObject with object and generation number -1
* and a PdfString as value. * and a PdfString as value.
skipping to change at line 179 skipping to change at line 179
* \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
* \param keyStop if not KeyNull and a key == keyStop is found * \param keyStop if not KeyNull and a key == keyStop is found
* writing will stop right before this key! * writing will stop right before this key!
*/ */
void WriteObject( PdfOutputDevice* pDevice, PdfEncrypt* pEncrypt, const PdfName & keyStop = PdfName::KeyNull ) const; void WriteObject( PdfOutputDevice* pDevice, PdfEncrypt* pEncrypt, const PdfName & keyStop = PdfName::KeyNull ) const;
/** Get the length of the object in bytes if it was written to disk now . /** Get the length of the object in bytes if it was written to disk now .
* \returns the length of the object * \returns the length of the object
*/ */
unsigned long GetObjectLength(); pdf_long GetObjectLength();
/** 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
skipping to change at line 260 skipping to change at line 260
void FlateCompressStream(); void FlateCompressStream();
/** Calculate the byte offset of the key pszKey from the start of the o bject /** Calculate the byte offset of the key pszKey from the start of the o bject
* if the object was written to disk at the moment of calling this fun ction. * if the object was written to disk at the moment of calling this fun ction.
* *
* This function is very calculation intensive! * This function is very calculation intensive!
* *
* \param pszKey key to calculate the byte offset * \param pszKey key to calculate the byte offset
* \returns the offset of the key * \returns the offset of the key
*/ */
unsigned long GetByteOffset( const char* pszKey ); pdf_long GetByteOffset( const char* pszKey );
/** /**
* Dynamically load this object and any associated stream from a PDF fi le * Dynamically load this object and any associated stream from a PDF fi le
* by calling the virtual method DelayedStreamLoadImpl if the stream i s not * by calling the virtual method DelayedStreamLoadImpl if the stream i s not
* already loaded. Will call DelayedLoad() first if it is required. * already loaded. Will call DelayedLoad() first if it is required.
* *
* Call graph: * Call graph:
* *
* DelayedStreamLoad ---> DelayedLoad() --> DelayedLoadImpl() * DelayedStreamLoad ---> DelayedLoad() --> DelayedLoadImpl()
* | * |
skipping to change at line 318 skipping to change at line 318
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;
private: private:
/* See PdfVariant.h for a detailed explanation of this member, which is
* here to prevent accidental construction of a PdfObject of integer ty
pe
* when passing a pointer. */
template<typename T> PdfObject(T*);
// Shared initialization between all the ctors // Shared initialization between all the ctors
void InitPdfObject(); void InitPdfObject();
// No touchy. Only for manipulation by PdfObject private routines. // No touchy. Only for manipulation by PdfObject private routines.
// Tracks whether deferred loading is still pending (in which case it'l l be // Tracks whether deferred loading is still pending (in which case it'l l be
// false). If true, deferred loading is not requried or has been comple ted. // false). If true, deferred loading is not requried or has been comple ted.
mutable bool m_bDelayedStreamLoadDone; mutable bool m_bDelayedStreamLoadDone;
#if defined(PODOFO_EXTRA_CHECKS) #if defined(PODOFO_EXTRA_CHECKS)
 End of changes. 6 change blocks. 
5 lines changed or deleted 10 lines changed or added


 PdfOutlines.h   PdfOutlines.h 
skipping to change at line 30 skipping to change at line 30
#ifndef _PDF_OUTLINE_H_ #ifndef _PDF_OUTLINE_H_
#define _PDF_OUTLINE_H_ #define _PDF_OUTLINE_H_
#include "PdfDefines.h" #include "PdfDefines.h"
#include "PdfElement.h" #include "PdfElement.h"
namespace PoDoFo { namespace PoDoFo {
class PdfDestination; class PdfDestination;
class PdfAction;
class PdfObject; class PdfObject;
class PdfOutlineItem; class PdfOutlineItem;
class PdfString; class PdfString;
class PdfVecObjects; class PdfVecObjects;
/** /**
* The title of an outline item can be displayed * The title of an outline item can be displayed
* in different formating styles since PDF 1.4. * in different formating styles since PDF 1.4.
*/ */
enum EPdfOutlineFormat { enum EPdfOutlineFormat {
skipping to change at line 73 skipping to change at line 74
* \param rDest destination of this item * \param rDest destination of this item
*/ */
PdfOutlineItem* CreateChild( const PdfString & sTitle, const PdfDestina tion & rDest ); PdfOutlineItem* CreateChild( const PdfString & sTitle, const PdfDestina tion & rDest );
/** Create a PdfOutlineItem that is on the same level and follows the c urrent item. /** Create a PdfOutlineItem that is on the same level and follows the c urrent item.
* \param sTitle title of this item * \param sTitle title of this item
* \param rDest destination of this item * \param rDest destination of this item
*/ */
PdfOutlineItem* CreateNext ( const PdfString & sTitle, const PdfDestina tion & rDest ); PdfOutlineItem* CreateNext ( const PdfString & sTitle, const PdfDestina tion & rDest );
/** Inserts an existing PdfOutlineItem as a child /** Create a PdfOutlineItem that is on the same level and follows the c
urrent item.
* \param sTitle title of this item
* \param rAction action of this item
*/
PdfOutlineItem* CreateNext ( const PdfString & sTitle, const PdfAction
& rAction );
/** Inserts an existing PdfOutlineItem as a child
* of this outline item. * of this outline item.
* *
* \param pItem an existing outline item * \param pItem an existing outline item
*/ */
void InsertChild( PdfOutlineItem* pItem ); void InsertChild( PdfOutlineItem* pItem );
/** /**
* \returns the previous item or NULL if this is the first on the curre nt level * \returns the previous item or NULL if this is the first on the curre nt level
*/ */
inline PdfOutlineItem* Prev() const; inline PdfOutlineItem* Prev() const;
skipping to change at line 124 skipping to change at line 131
/** Set the destination of this outline. /** Set the destination of this outline.
* \param rDest the destination * \param rDest the destination
*/ */
void SetDestination( const PdfDestination & rDest ); void SetDestination( const PdfDestination & rDest );
/** Get the destination of this outline. /** Get the destination of this outline.
* \returns the destination, if there is one, or NULL * \returns the destination, if there is one, or NULL
*/ */
PdfDestination* GetDestination( void ); PdfDestination* GetDestination( void );
/** Set the action of this outline.
* \param rAction the action
*/
void SetAction( const PdfAction & rAction );
/** Get the action of this outline.
* \returns the action, if there is one, or NULL
*/
PdfAction* GetAction( void );
/** Set the title of this outline item /** Set the title of this outline item
* \param sTitle the title to use * \param sTitle the title to use
*/ */
void SetTitle( const PdfString & sTitle ); void SetTitle( const PdfString & sTitle );
/** Get the title of this item /** Get the title of this item
* \returns the title as PdfString * \returns the title as PdfString
*/ */
const PdfString & GetTitle() const; const PdfString & GetTitle() const;
skipping to change at line 202 skipping to change at line 219
* \param sTitle title of this item * \param sTitle title of this item
* \param rDest destination of this item * \param rDest destination of this item
* \param pParentOutline parent of this outline item * \param pParentOutline parent of this outline item
* in the outline item hierarchie * in the outline item hierarchie
* \param pParent parent vector of objects which is required * \param pParent parent vector of objects which is required
* to create new objects * to create new objects
*/ */
PdfOutlineItem( const PdfString & sTitle, const PdfDestination & rDest, PdfOutlineItem( const PdfString & sTitle, const PdfDestination & rDest,
PdfOutlineItem* pParentOutline, PdfVecObjects* pParent ); PdfOutlineItem* pParentOutline, PdfVecObjects* pParent );
/** Create a PdfOutlineItem from an existing PdfObject /** Create a new PdfOutlineItem from scratch
* \param sTitle title of this item
* \param rAction action of this item
* \param pParentOutline parent of this outline item
* in the outline item hierarchie
* \param pParent parent vector of objects which is required
* to create new objects
*/
PdfOutlineItem( const PdfString & sTitle, const PdfAction & rAction,
PdfOutlineItem* pParentOutline, PdfVecObjects* pParent
);
/** Create a PdfOutlineItem from an existing PdfObject
* \param pObject an existing outline item * \param pObject an existing outline item
* \param pParentOutline parent of this outline item * \param pParentOutline parent of this outline item
* in the outline item hierarchie * in the outline item hierarchie
* \param pPrevious previous item of this item * \param pPrevious previous item of this item
*/ */
PdfOutlineItem( PdfObject* pObject, PdfOutlineItem* pParentOutline, Pdf OutlineItem* pPrevious ); PdfOutlineItem( PdfObject* pObject, PdfOutlineItem* pParentOutline, Pdf OutlineItem* pPrevious );
private: private:
PdfOutlineItem* m_pParentOutline; PdfOutlineItem* m_pParentOutline;
PdfOutlineItem* m_pPrev; PdfOutlineItem* m_pPrev;
PdfOutlineItem* m_pNext; PdfOutlineItem* m_pNext;
PdfOutlineItem* m_pFirst; PdfOutlineItem* m_pFirst;
PdfOutlineItem* m_pLast; PdfOutlineItem* m_pLast;
PdfDestination* m_pDestination; PdfDestination* m_pDestination;
PdfAction* m_pAction;
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline PdfOutlineItem* PdfOutlineItem::GetParentOutline() const inline PdfOutlineItem* PdfOutlineItem::GetParentOutline() const
{ {
return m_pParentOutline; return m_pParentOutline;
} }
 End of changes. 5 change blocks. 
2 lines changed or deleted 34 lines changed or added


 PdfOutputDevice.h   PdfOutputDevice.h 
skipping to change at line 77 skipping to change at line 77
*/ */
PdfOutputDevice( const wchar_t* pszFilename ); PdfOutputDevice( const wchar_t* pszFilename );
#endif // _WIN32 #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, size_t 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.
* *
* WARNING: PoDoFo will change the stream's locale. It will be restor
ed when
* the PdfOutputStream controlling the stream is destroyed.
*
* \param pOutStream write to this std::ostream * \param pOutStream write to this std::ostream
*/ */
PdfOutputDevice( const std::ostream* pOutStream ); PdfOutputDevice( const std::ostream* pOutStream );
/** Construct a new PdfOutputDevice that writes all data to a PdfRefCou ntedBuffer. /** Construct a new PdfOutputDevice that writes all data to a PdfRefCou ntedBuffer.
* This output device has the advantage that the PdfRefCountedBuffer w ill resize itself * This output device has the advantage that the PdfRefCountedBuffer w ill resize itself
* if more memory is needed to hold all data. * if more memory is needed to hold all data.
* *
* \param pOutBuffer write to this PdfRefCountedBuffer * \param pOutBuffer write to this PdfRefCountedBuffer
* *
skipping to change at line 104 skipping to change at line 107
/** Destruct the PdfOutputDevice object and close any open files. /** Destruct the PdfOutputDevice object and close any open files.
*/ */
virtual ~PdfOutputDevice(); virtual ~PdfOutputDevice();
/** 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 size_t 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 * WARNING: Do not use this for doubles or floating point values
* as the output might depend on the current locale. * 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
skipping to change at line 127 skipping to change at line 130
/** 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.
* *
* \param pBuffer a pointer to the data buffer * \param pBuffer a pointer to the data buffer
* \param lLen write lLen bytes of pBuffer to the PdfOutputDevice * \param lLen write lLen bytes of pBuffer to the PdfOutputDevice
* \returns ErrOk on success * \returns ErrOk on success
* *
* \see Print * \see Print
*/ */
virtual void Write( const char* pBuffer, long lLen ); virtual void Write( const char* pBuffer, size_t lLen );
/** Seek the device to the position offset from the begining /** Seek the device to the position offset from the begining
* \param offset from the beginning of the file * \param offset from the beginning of the file
*/ */
virtual void Seek( size_t offset ); virtual void Seek( size_t offset );
/** Get the current offset from the beginning of the file. /** Get the current offset from the beginning of the file.
* \return the offset form the beginning of the file. * \return the offset form the beginning of the file.
*/ */
virtual inline unsigned long Tell() const; virtual inline size_t Tell() const;
/** Flush the output files buffer to disk if this devices /** Flush the output files buffer to disk if this devices
* operates on a disk. * operates on a disk.
*/ */
virtual void Flush(); virtual void Flush();
private: private:
/** Initialize all private members /** Initialize all private members
*/ */
void Init(); void Init();
protected: protected:
unsigned long m_ulLength; size_t m_ulLength;
private: private:
FILE* m_hFile; FILE* m_hFile;
char* m_pBuffer; char* m_pBuffer;
unsigned long m_lBufferLen; size_t m_lBufferLen;
std::ostream* m_pStream; std::ostream* m_pStream;
bool m_pStreamOwned;
std::locale m_pStreamSavedLocale;
PdfRefCountedBuffer* m_pRefCountedBuffer; PdfRefCountedBuffer* m_pRefCountedBuffer;
unsigned long m_ulPosition; size_t m_ulPosition;
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
unsigned long PdfOutputDevice::GetLength() const size_t PdfOutputDevice::GetLength() const
{ {
return m_ulLength; return m_ulLength;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
unsigned long PdfOutputDevice::Tell() const size_t PdfOutputDevice::Tell() const
{ {
return m_ulPosition; return m_ulPosition;
} }
}; };
#endif // _PDF_OUTPUT_DEVICE_H_ #endif // _PDF_OUTPUT_DEVICE_H_
 End of changes. 11 change blocks. 
9 lines changed or deleted 15 lines changed or added


 PdfOutputStream.h   PdfOutputStream.h 
skipping to change at line 50 skipping to change at line 50
virtual ~PdfOutputStream() { }; virtual ~PdfOutputStream() { };
/** Write data to the output stream /** Write data to the output stream
* *
* \param pBuffer the data is read from this buffer * \param pBuffer the data is read from this buffer
* \param lLen the size of the buffer * \param lLen the size of the buffer
* *
* \returns the number of bytes written, -1 if an error ocurred * \returns the number of bytes written, -1 if an error ocurred
*/ */
virtual long Write( const char* pBuffer, long lLen ) = 0; virtual pdf_long Write( const char* pBuffer, pdf_long lLen ) = 0;
/** /**
* Helper that writes a string via Write(const char*,long) * Helper that writes a string via Write(const char*,long)
*/ */
inline long Write( const std::string & s ); inline pdf_long Write( const std::string & s );
/** Close the PdfOutputStream. /** Close the PdfOutputStream.
* This method may throw exceptions and has to be called * This method may throw exceptions and has to be called
* before the descructor to end writing. * before the descructor to end writing.
* *
* No more data may be written to the output device * No more data may be written to the output device
* after calling close. * after calling close.
*/ */
virtual void Close() = 0; virtual void Close() = 0;
}; };
inline long PdfOutputStream::Write( const std::string & s ) inline pdf_long PdfOutputStream::Write( const std::string & s )
{ {
return this->Write( s.data(), s.size() ); return this->Write( s.data(), s.size() );
} }
/** An output stream that writes data to a file /** An output stream that writes data to a file
*/ */
class PODOFO_API PdfFileOutputStream : public PdfOutputStream { class PODOFO_API PdfFileOutputStream : public PdfOutputStream {
public: public:
/** Open a file for writing data /** Open a file for writing data
skipping to change at line 90 skipping to change at line 90
*/ */
PdfFileOutputStream( const char* pszFilename ); PdfFileOutputStream( const char* pszFilename );
/** Write data to the output stream /** Write data to the output stream
* *
* \param pBuffer the data is read from this buffer * \param pBuffer the data is read from this buffer
* \param lLen the size of the buffer * \param lLen the size of the buffer
* *
* \returns the number of bytes written, -1 if an error ocurred * \returns the number of bytes written, -1 if an error ocurred
*/ */
virtual long Write( const char* pBuffer, long lLen ); virtual pdf_long Write( const char* pBuffer, pdf_long lLen );
/** Close the PdfOutputStream. /** Close the PdfOutputStream.
* This method may throw exceptions and has to be called * This method may throw exceptions and has to be called
* before the descructor to end writing. * before the descructor to end writing.
* *
* No more data may be written to the output device * No more data may be written to the output device
* after calling close. * after calling close.
*/ */
virtual void Close(); virtual void Close();
skipping to change at line 117 skipping to change at line 117
* *
* DS: TODO: remove in favour of PdfBufferOutputStream. * DS: TODO: remove in favour of PdfBufferOutputStream.
*/ */
class PODOFO_API PdfMemoryOutputStream : public PdfOutputStream { class PODOFO_API PdfMemoryOutputStream : public PdfOutputStream {
public: public:
/** /**
* Construct a new PdfMemoryOutputStream * Construct a new PdfMemoryOutputStream
* \param lInitial initial size of the buffer * \param lInitial initial size of the buffer
*/ */
PdfMemoryOutputStream( long lInitial = INITIAL_SIZE); PdfMemoryOutputStream( pdf_long lInitial = INITIAL_SIZE);
/** /**
* Construct a new PdfMemoryOutputStream that writes to an existing buf fer * Construct a new PdfMemoryOutputStream that writes to an existing buf fer
* \param pBuffer handle to the buffer * \param pBuffer handle to the buffer
* \param lLen length of the buffer * \param lLen length of the buffer
*/ */
PdfMemoryOutputStream( char* pBuffer, long lLen ); PdfMemoryOutputStream( char* pBuffer, pdf_long lLen );
~PdfMemoryOutputStream(); ~PdfMemoryOutputStream();
/** Write data to the output stream /** Write data to the output stream
* *
* \param pBuffer the data is read from this buffer * \param pBuffer the data is read from this buffer
* \param lLen the size of the buffer * \param lLen the size of the buffer
* *
* \returns the number of bytes written, -1 if an error ocurred * \returns the number of bytes written, -1 if an error ocurred
*/ */
virtual long Write( const char* pBuffer, long lLen ); virtual pdf_long Write( const char* pBuffer, pdf_long lLen );
/** Close the PdfOutputStream. /** Close the PdfOutputStream.
* This method may throw exceptions and has to be called * This method may throw exceptions and has to be called
* before the descructor to end writing. * before the descructor to end writing.
* *
* No more data may be written to the output device * No more data may be written to the output device
* after calling close. * after calling close.
*/ */
virtual void Close() { } virtual void Close() { }
/** \returns the length of the written data /** \returns the length of the written data
*/ */
inline unsigned long GetLength() const; inline pdf_long GetLength() const;
/** /**
* \returns a handle to the internal buffer. * \returns a handle to the internal buffer.
* *
* The internal buffer is now owned by the caller * The internal buffer is now owned by the caller
* and will not be deleted by PdfMemoryOutputStream. * and will not be deleted by PdfMemoryOutputStream.
* Further calls to write are not allowed. * Further calls to write are not allowed.
* *
* The caller has to free the returned malloc'ed buffer! * The caller has to free the returned malloc'ed buffer!
*/ */
inline char* TakeBuffer(); inline char* TakeBuffer();
private: private:
char* m_pBuffer; char* m_pBuffer;
char* m_pCur; char* m_pCur;
long m_lLen; pdf_long m_lLen;
long m_lSize; pdf_long m_lSize;
bool m_bOwnBuffer; bool m_bOwnBuffer;
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline unsigned long PdfMemoryOutputStream::GetLength() const inline pdf_long PdfMemoryOutputStream::GetLength() const
{ {
return m_lLen; return m_lLen;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline char* PdfMemoryOutputStream::TakeBuffer() inline char* PdfMemoryOutputStream::TakeBuffer()
{ {
char* pBuffer = m_pBuffer; char* pBuffer = m_pBuffer;
skipping to change at line 208 skipping to change at line 208
*/ */
PdfDeviceOutputStream( PdfOutputDevice* pDevice ); PdfDeviceOutputStream( PdfOutputDevice* pDevice );
/** Write data to the output stream /** Write data to the output stream
* *
* \param pBuffer the data is read from this buffer * \param pBuffer the data is read from this buffer
* \param lLen the size of the buffer * \param lLen the size of the buffer
* *
* \returns the number of bytes written, -1 if an error ocurred * \returns the number of bytes written, -1 if an error ocurred
*/ */
virtual long Write( const char* pBuffer, long lLen ); virtual pdf_long Write( const char* pBuffer, pdf_long lLen );
/** Close the PdfOutputStream. /** Close the PdfOutputStream.
* This method may throw exceptions and has to be called * This method may throw exceptions and has to be called
* before the descructor to end writing. * before the descructor to end writing.
* *
* No more data may be written to the output device * No more data may be written to the output device
* after calling close. * after calling close.
*/ */
virtual void Close() {} virtual void Close() {}
skipping to change at line 247 skipping to change at line 247
{ {
} }
/** Write data to the output stream /** Write data to the output stream
* *
* \param pBuffer the data is read from this buffer * \param pBuffer the data is read from this buffer
* \param lLen the size of the buffer * \param lLen the size of the buffer
* *
* \returns the number of bytes written, -1 if an error ocurred * \returns the number of bytes written, -1 if an error ocurred
*/ */
virtual long Write( const char* pBuffer, long lLen ); virtual pdf_long Write( const char* pBuffer, pdf_long lLen );
virtual void Close() virtual void Close()
{ {
} }
/** /**
* \returns the length of the buffers contents * \returns the length of the buffers contents
*/ */
inline long GetLength() const inline pdf_long GetLength() const
{ {
return m_lLength; return m_lLength;
} }
private: private:
PdfRefCountedBuffer* m_pBuffer; PdfRefCountedBuffer* m_pBuffer;
long m_lLength; pdf_long m_lLength;
}; };
}; };
#endif // _PDF_OUTPUT_STREAM_H_ #endif // _PDF_OUTPUT_STREAM_H_
 End of changes. 14 change blocks. 
15 lines changed or deleted 15 lines changed or added


 PdfPage.h   PdfPage.h 
skipping to change at line 54 skipping to change at line 54
/** PdfPage is one page in the pdf document. /** PdfPage is one page in the pdf document.
* It is possible to draw on a page using a PdfPainter object. * It is possible to draw on a page using a PdfPainter object.
* Every document needs at least one page. * Every document needs at least one page.
*/ */
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, PdfDocument* pParent );
/** 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 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 * \param listOfParents a list of PdfObjects that are
* parents of this page and can be * parents of this page and can be
* queried for inherited attributes. * queried for inherited attributes.
* The last object in the list is the * The last object in the list is the
* most direct parent of this page. * most direct parent of this page.
*/ */
skipping to change at line 212 skipping to change at line 218
* using a type (category) and a key. * using a type (category) and a key.
* *
* \param rType the type of resource to fetch (e.g. /Font, or /XObject ) * \param rType the type of resource to fetch (e.g. /Font, or /XObject )
* \param rKey the key of the resource * \param rKey the key of the resource
* *
* \returns the object of the resource or NULL if it was not found * \returns the object of the resource or NULL if it was not found
*/ */
PdfObject* GetFromResources( const PdfName & rType, const PdfName & rKe y ); PdfObject* GetFromResources( const PdfName & rType, const PdfName & rKe y );
private: private:
/** Get the bounds of a specified page box in PDF units.
/**
* Initialize a new page object.
* m_pContents must be initialized before calling this!
*
* @param rSize page size
*/
void InitNewPage( const PdfRect & rSize );
/** 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
*/ */
PdfObject* GetInheritedKeyFromObject( const char* inKey, PdfObject* inO bject ) const; PdfObject* GetInheritedKeyFromObject( const char* inKey, PdfObject* inO bject ) const;
 End of changes. 2 change blocks. 
1 lines changed or deleted 17 lines changed or added


 PdfPagesTree.h   PdfPagesTree.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_PAGES_TREE_H_ #ifndef _PDF_PAGES_TREE_H_
#define _PDF_PAGES_TREE_H_ #define _PDF_PAGES_TREE_H_
#include "PdfArray.h" #include "PdfArray.h"
#include "PdfDefines.h" #include "PdfDefines.h"
#include "PdfElement.h" #include "PdfElement.h"
#include "PdfPagesTreeCache.h"
namespace PoDoFo { namespace PoDoFo {
class PdfObject; class PdfObject;
class PdfPage; class PdfPage;
class PdfRect; class PdfRect;
typedef enum { enum EPdfPageInsertionPoint {
PageInsertBeforeFirstPage = -1, ePdfPageInsertionPoint_InsertBeforeFirstPage = -1,
PageInsertLastPage = -2, ePdfPageInsertionPoint_InsertLastPage = -2,
PageInsertAllPages = -3, ePdfPageInsertionPoint_InsertAllPages = -3,
PageInsertOddPagesOnly = -4, ePdfPageInsertionPoint_InsertOddPagesOnly = -4,
PageInsertEvenPagesOnly = -5 ePdfPageInsertionPoint_InsertEvenPagesOnly = -5
} 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; typedef std::deque< PdfObject* > PdfObjectList;
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 90 skipping to change at line 92
* deleted along with it. * deleted along with it.
* *
* \param ref the reference of the pages object * \param ref the reference of the pages object
* \returns a pointer to the requested page * \returns a pointer to the requested page
*/ */
PdfPage* GetPage( const PdfReference & ref ); PdfPage* GetPage( const PdfReference & ref );
/** Inserts an existing page object into the internal page tree. /** Inserts an existing page object into the internal page tree.
* after the specified page number * after the specified page number
* *
* \param inAfterPageNumber an integer specifying after what page - ma * \param nAfterPageNumber an integer specifying after what page
y be one of the special values * - may be one of the special values from EPdfPageInsertionPoi
nt.
* Pages are 0 based.
*
* \param pPage musst be a PdfObject with type /Page * \param pPage musst be a PdfObject with type /Page
*/ */
void InsertPage( int inAfterPageNumber, PdfObject* pPage ); void InsertPage( int nAfterPageNumber, PdfObject* pPage );
/** Inserts an existing page object into the internal page tree. /** Inserts an existing page object into the internal page tree.
* after the specified page number * after the specified page number
* *
* \param inAfterPageNumber an integer specifying after what page - ma * \param nAfterPageNumber an integer specifying after what page
y be one of the special values * - may be one of the special values from EPdfPageInsertionPo
* \param inPage a PdfPage to be inserted int.
* Pages are 0 based.
* \param nPage a PdfPage to be inserted, the PdfPage will not get own
ed by the PdfPagesTree
*/ */
void InsertPage( int inAfterPageNumber, PdfPage* inPage ); void InsertPage( int nAfterPageNumber, PdfPage* pPage );
/** Creates a new page object and inserts it into the internal /** Creates a new page object and inserts it into the internal
* page tree. * page tree.
* The returned page is owned by the pages tree and will get deleted a long * The returned page is owned by the pages tree and will get deleted a long
* with it! * with it!
* *
* \param rSize a PdfRect specifying the size of the page (i.e the /Me diaBox key) in PDF units * \param rSize a PdfRect specifying the size of the page (i.e the /Me diaBox key) in PDF units
* \returns a pointer to a PdfPage object * \returns a pointer to a PdfPage object
*/ */
PdfPage* CreatePage( const PdfRect & rSize ); PdfPage* CreatePage( const PdfRect & rSize );
/** Delete the specified page object from the internal pages tree. /** Delete the specified page object from the internal pages tree.
* It does NOT remove any PdfObjects from memory - just the reference from the tree * It does NOT remove any PdfObjects from memory - just the reference from the tree
* *
* \param inPageNumber the page number (0-based) to be removed * \param inPageNumber the page number (0-based) to be removed
* *
* The PdfPage object refering to this page will be deleted by this c all! * The PdfPage object refering to this page will be deleted by this c all!
* Empty page nodes will also be deleted.
*
* \see PdfMemDocument::DeletePages
*/ */
void DeletePage( int inPageNumber ); void DeletePage( int inPageNumber );
/**
* Clear internal cache of PdfPage objects.
* All references to PdfPage object will become invalid
* when calling this method. All PdfPages will be deleted.
*
* You normally will never have to call this method.
* It is only useful if one modified the page nodes
* of the pagestree manually.
*
*/
inline void ClearCache();
private: private:
PdfPagesTree(); // don't allow construction from nothing! PdfPagesTree(); // don't allow construction from nothing!
/** Private method for actually traversing the /Pages tree PdfObject* GetPageNode( int nPageNum, PdfObject* pParent, PdfObjectList
* & rLstParents );
* \param rListOfParents all parents of the page node will be added to PdfObject* GetPageNodeFromArray( int nPageNum, const PdfArray & rKidsAr
this lists, ray, PdfObjectList & rLstParents );
* so that the PdfPage can later access inherite
d attributes int GetChildCount( const PdfObject* pNode ) const;
/**
* Test if a PdfObject is a page node
* @return true if PdfObject is a page node
*/ */
PdfObject* GetPageNode( int nPageNum, PdfObject* pPagesObject, std::deq ue<PdfObject*> & rListOfParents ); bool IsTypePage( const PdfObject* pObject ) const;
/** Private method for actually traversing the /Pages tree /**
* This method directly traverses the tree and does no * Test if a PdfObject is a pages node
* optimization for nodes with only one element like GetPageNode does. * @return true if PdfObject is a pages node
*/
bool IsTypePages( const PdfObject* pObject ) const;
/**
* Find the position of pPageObj in the kids array of pPageParent
* *
* \param rListOfParents all parents of the page node will be added to * @returns the index in the kids array or -1 if pPageObj is no child o
this lists, f pPageParent
* so that the PdfPage can later access inherite
d attributes
*/ */
PdfObject* GetPageNodeFromTree( int nPageNum, const PdfArray & kidsArra y, std::deque<PdfObject*> & rListOfParents ); int GetPosInKids( PdfObject* pPageObj, PdfObject* pPageParent );
/** Private method to access the Root of the tree using a logical name /** Private method for adjusting the page count in a tree
*/ */
PdfObject* GetRoot() { return m_pObject; } int ChangePagesCount( PdfObject* inPageObj, int inDelta );
const PdfObject* GetRoot() const { return m_pObject; }
/** Private method for getting the Parent of a node in the /Pages tree /**
* Insert a page object into a pages node
*
* @param pNode the pages node whete pPage is to be inserted
* @param rlstParents list of all (future) parent pages nodes in the pa
ges tree
* of pPage
* @param nIndex index where pPage is to be inserted in pNode's kids ar
ray
* @param pPage the page object which is to be inserted
*/ */
static PdfObject* GetParent( PdfObject* inObject ); void InsertPageIntoNode( PdfObject* pNode, const PdfObjectList & rlstPa
rents,
int nIndex, PdfObject* pPage );
/** Private method for getting the Kids of a node in the /Pages tree /**
* Delete a page object from a pages node
*
* @param pNode which is the direct parent of pPage and where the page
must be deleted
* @param rlstParents list of all parent pages nodes in the pages tree
* of pPage
* @param nIndex index where pPage is to be deleted in pNode's kids arr
ay
* @param pPage the page object which is to be deleted
*/ */
static PdfObject* GetKids( PdfObject* inObject ); void DeletePageFromNode( PdfObject* pNode, const PdfObjectList & rlstPa
rents,
int nIndex, PdfObject* pPage );
/** Private method for determining where a page is in the /Pages tree /**
* Delete a single page node or page object from the kids array of pPar
ent
*
* @param pParent the parent of the page node which is deleted
* @param nIndex index to remove from the kids array of pParent
*/ */
int GetPosInKids( PdfObject* inPageObj ); void DeletePageNode( PdfObject* pParent, int nIndex );
/** Private method for adjusting the page count in a tree /**
* Tests if a page node is emtpy
*
* @returns true if Count of page is 0 or the Kids array is empty
*/ */
int ChangePagesCount( PdfObject* inPageObj, int inDelta ); bool IsEmptyPageNode( PdfObject* pPageNode );
/** Private method for cleaning up after an insertion /** 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
*/ */
void InsertPages( int inAfterIndex, PdfObject* inPageOrPagesObj, PdfObj /*
ect* inParentObj, int inNumPages ); PdfObject* GetPageNode( int nPageNum, PdfObject* pPagesObject,
std::deque<PdfObject*> & rListOfParents );
*/
/** Private method for getting the PdfObject* for a Page from a specifi /** Private method for actually traversing the /Pages tree
c /Kids array * This method directly traverses the tree and does no
* 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* GetPageFromKidArray( const PdfArray& inArray, int inIndex ) /*
const; PdfObject* GetPageNodeFromTree( int nPageNum, const PdfArray & kidsArra
y,
std::deque<PdfObject*> & rListOfParents
);
private: */
PdfPageObjects m_deqPageObjs; /** Private method to access the Root of the tree using a logical name
*/
PdfObject* GetRoot() { return m_pObject; }
const PdfObject* GetRoot() const { return m_pObject; }
private:
PdfPagesTreeCache m_cache;
}; };
// -----------------------------------------------------
//
// -----------------------------------------------------
inline void PdfPagesTree::ClearCache()
{
m_cache.ClearCache();
}
}; };
#endif // _PDF_PAGES_TREE_H_ #endif // _PDF_PAGES_TREE_H_
 End of changes. 31 change blocks. 
50 lines changed or deleted 138 lines changed or added


 PdfPainter.h   PdfPainter.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_PAINTER_H_ #ifndef _PDF_PAINTER_H_
#define _PDF_PAINTER_H_ #define _PDF_PAINTER_H_
#include "PdfDefines.h" #include "PdfDefines.h"
#include "PdfRect.h" #include "PdfRect.h"
#include "PdfColor.h"
#include <sstream> #include <sstream>
namespace PoDoFo { namespace PoDoFo {
class PdfCanvas; class PdfCanvas;
class PdfColor;
class PdfExtGState; class PdfExtGState;
class PdfFont; class PdfFont;
class PdfImage; class PdfImage;
class PdfName; class PdfName;
class PdfObject; class PdfObject;
class PdfReference; class PdfReference;
class PdfShadingPattern; class PdfShadingPattern;
class PdfStream; class PdfStream;
class PdfString; class PdfString;
class PdfXObject; class PdfXObject;
skipping to change at line 425 skipping to change at line 425
* the advanced text position features of MoveTextPos * the advanced text position features of MoveTextPos
* use DrawText which is easier. * use DrawText which is easier.
* *
* \param sText the text string which should be printed * \param sText the text string which should be printed
* \param lLen draw only lLen characters of pszText * \param lLen draw only lLen characters of pszText
* *
* \see SetFont() * \see SetFont()
* \see MoveTextPos() * \see MoveTextPos()
* \see EndText() * \see EndText()
*/ */
void AddText( const PdfString & sText, long lStringLen ); void AddText( const PdfString & sText, pdf_long lStringLen );
/** Move position for text drawing on a page. /** Move position for text drawing on a page.
* You have to call BeginText before calling this function * You have to call BeginText before calling this function
* *
* If you want more simpler text output and do not need * If you want more simpler text output and do not need
* the advanced text position features of MoveTextPos * the advanced text position features of MoveTextPos
* use DrawText which is easier. * use DrawText which is easier.
* *
* \param dX the x offset relative to pos of BeginText or last MoveTex tPos * \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 * \param dY the y offset relative to pos of BeginText or last MoveTex tPos
skipping to change at line 567 skipping to change at line 567
* \param dY y coordinate of the start point * \param dY y coordinate of the start point
* \param dRadiusX x coordinate of the end point, which is the new cur rent point * \param dRadiusX x coordinate of the end point, which is the new cur rent point
* \param dRadiusY y coordinate of the end point, which is the new cur rent point * \param dRadiusY y coordinate of the end point, which is the new cur rent point
* \param dRotation degree of rotation in radians * \param dRotation degree of rotation in radians
* \param bLarge large or small portion of the arc * \param bLarge large or small portion of the arc
* \param bSweep sweep? * \param bSweep sweep?
*/ */
void ArcTo( double dX, double dY, double dRadiusX, double dRadiusY, void ArcTo( double dX, double dY, double dRadiusX, double dRadiusY,
double dRotation, bool bLarge, bool bSweep); double dRotation, bool bLarge, bool bSweep);
// Peter Petrov 5 January 2009 was delivered from libHaru
/**
*/
bool DrawArc(double dX, double dY, double dRadius, double dAngle1, doub
le dAngle2);
/** Close the current path. Matches the PDF 'h' operator. /** Close the current path. Matches the PDF 'h' operator.
*/ */
void Close(); void Close();
/** Stroke the current path. Matches the PDF 'S' operator. /** Stroke the current path. Matches the PDF 'S' operator.
* This function is useful to construct an own path * This function is useful to construct an own path
* for drawing or clipping. * for drawing or clipping.
*/ */
void Stroke(); void Stroke();
/** Fill the current path. Matches the PDF 'f' operator. /** Fill the current path. Matches the PDF 'f' operator.
* This function is useful to construct an own path * This function is useful to construct an own path
* for drawing or clipping. * for drawing or clipping.
*/ */
void Fill(); void Fill();
/** Clip the current path. Matches the PDF 'W' operator. /** Clip the current path. Matches the PDF 'W' operator.
* This function is useful to construct an own path * This function is useful to construct an own path
* for drawing or clipping. * for drawing or clipping.
*
* \param useEvenOddRule select even-odd rule instead of nonzero windi
ng number rule
*/ */
void Clip(); void Clip( bool useEvenOddRule = false);
/** Save the current graphics settings onto the graphics /** Save the current graphics settings onto the graphics
* stack. Operator 'q' in PDF. * stack. Operator 'q' in PDF.
* This call has to be balanced with a corresponding call * This call has to be balanced with a corresponding call
* to Restore()! * to Restore()!
* *
* \see Restore * \see Restore
*/ */
void Save(); void Save();
skipping to change at line 700 skipping to change at line 707
void ConvertRectToBezier( double dX, double dY, double dWidth, double d Height, double pdPointX[], double pdPointY[] ); void ConvertRectToBezier( double dX, double dY, double dWidth, double d Height, double pdPointX[], double pdPointY[] );
protected: protected:
/** Sets the color that was last set by the user as the current strokin g color. /** Sets the color that was last set by the user as the current strokin g color.
* You should always enclose this function by Save() and Restore() * You should always enclose this function by Save() and Restore()
* *
* \see Save() \see Restore() * \see Save() \see Restore()
*/ */
void SetCurrentStrokingColor(); void SetCurrentStrokingColor();
bool InternalArc(
double x,
double y,
double ray,
double ang1,
double ang2,
bool cont_flg);
/** 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, pdf_long lLen ) const ;
#if defined(_MSC_VER) && _MSC_VER <= 1200 // MSC 6.0 has a template-bu g #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_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; PdfString ExpandTabs_pdf_utf16be( const pdf_utf16be* pszText, long lStr ingLen, int nTabCnt, const pdf_utf16be cTab, const pdf_utf16be cSpace ) con st;
#else #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, pdf_long lStringLen, int nTabCnt, const C cTab, const C cSpace ) const;
#endif #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
skipping to change at line 739 skipping to change at line 754
/** Font for all drawing operations /** Font for all drawing operations
*/ */
PdfFont* m_pFont; PdfFont* m_pFont;
/** Every tab '\\t' is replaced with m_nTabWidth /** Every tab '\\t' is replaced with m_nTabWidth
* spaces before drawing text. Default is a value of 4 * spaces before drawing text. Default is a value of 4
*/ */
unsigned short m_nTabWidth; unsigned short m_nTabWidth;
/** The current color space for non stroking colors /** Save the current color for non stroking colors
*/
EPdfColorSpace m_eCurColorSpace;
/** Save the current color
*/ */
double m_curColor1, m_curColor2, m_curColor3, m_curColor4; PdfColor m_curColor;
/** Is between BT and ET /** Is between BT and ET
*/ */
bool m_isTextOpen; 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
skipping to change at line 805 skipping to change at line 816
void PdfPainter::SetPrecision( unsigned short inPrec ) void PdfPainter::SetPrecision( unsigned short inPrec )
{ {
m_oss.precision( inPrec ); m_oss.precision( inPrec );
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
unsigned short PdfPainter::GetPrecision() const unsigned short PdfPainter::GetPrecision() const
{ {
return m_oss.precision(); return static_cast<unsigned short>(m_oss.precision());
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
void PdfPainter::SetClipRect( const PdfRect & rRect ) void PdfPainter::SetClipRect( const PdfRect & rRect )
{ {
this->SetClipRect( rRect.GetLeft(), rRect.GetBottom(), rRect.GetWidth() , rRect.GetHeight() ); this->SetClipRect( rRect.GetLeft(), rRect.GetBottom(), rRect.GetWidth() , rRect.GetHeight() );
} }
 End of changes. 12 change blocks. 
12 lines changed or deleted 25 lines changed or added


 PdfParser.h   PdfParser.h 
skipping to change at line 51 skipping to change at line 51
* PdfParser reads a PDF file into memory. * PdfParser reads a PDF file into memory.
* The file can be modified in memory and written back using * The file can be modified in memory and written back using
* the PdfWriter class. * the PdfWriter class.
* Most PDF features are supported * Most PDF features are supported
*/ */
class PODOFO_API PdfParser : public PdfTokenizer { class PODOFO_API PdfParser : public PdfTokenizer {
friend class PdfDocument; friend class PdfDocument;
friend class PdfWriter; friend class PdfWriter;
public: public:
struct TXRefEntry {
inline TXRefEntry() : lOffset(0), lGeneration(0), cUsed('\x00'), bP
arsed(false) { }
pdf_long lOffset;
long lGeneration;
char cUsed;
bool bParsed;
};
typedef std::vector<TXRefEntry> TVecOffsets;
typedef TVecOffsets::iterator TIVecOffsets;
typedef TVecOffsets::const_iterator TCIVecOffsets;
/** Create a new PdfParser object /** Create a new PdfParser object
* You have to open a PDF file using ParseFile later. * You have to open a PDF file using ParseFile later.
* \param pVecObjects vector to write the parsed PdfObjects to * \param pVecObjects vector to write the parsed PdfObjects to
* *
* \see ParseFile * \see ParseFile
*/ */
PdfParser( PdfVecObjects* pVecObjects ); PdfParser( PdfVecObjects* pVecObjects );
/** 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.
skipping to change at line 236 skipping to change at line 248
*/ */
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. /** Quick method to detect secured PDF files, i.e.
* a PDF with an /Encrypt key in the trailer directory. * a PDF with an /Encrypt key in the trailer directory.
* *
* \returns true if document is secured, false otherwise * \returns true if document is secured, false otherwise
*/ */
bool QuickEncryptedCheck( const char* pszFilename ); bool QuickEncryptedCheck( const char* pszFilename );
/**
* Retrieve the number of incremental updates that
* have been applied to the last parsed PDF file.
*
* 0 means no update has been applied.
*
* \returns the number of incremental updates to the parsed PDF.
*/
inline int GetNumberOfIncrementalUpdates() const;
/** 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 309 skipping to change at line 331
* The usual way will be to ask the user for the password * The usual way will be to ask the user for the password
* and set the password using this method. * and set the password using this method.
* *
* PdfParser will immediately continue to read the PDF file. * PdfParser will immediately continue to read the PDF file.
* *
* \param sPassword a user or owner password which can be used to open an encrypted PDF file * \param sPassword a user or owner password which can be used to open an encrypted PDF file
* If the password is invalid, a PdfError( ePdfError_ InvalidPassword ) exception is thrown! * If the password is invalid, a PdfError( ePdfError_ InvalidPassword ) exception is thrown!
*/ */
void SetPassword( const std::string & sPassword ); void SetPassword( const std::string & sPassword );
/**
* \returns true if strict parsing mode is enabled
*
* \see SetStringParsing
*/
inline bool IsStrictParsing() const;
/**
* Enable/disable strict parsing mode.
* Strict parsing is by default disabled.
*
* If you enable strict parsing, PoDoFo will fail
* on a few more common PDF failures. Please not
* that PoDoFo's parser is by default very strict
* already and does not recover from e.g. wrong XREF
* tables.
*
* \param bStrict new setting for strict parsing mode.
*/
inline void SetStringParsing( bool bStrict );
/**
* \return if broken objects are ignored while parsing
*/
inline bool GetIgnoreBrokenObjects();
/**
* Specify if the parser should ignore broken
* objects, i.e. XRef entries that do not point
* to valid objects.
*
* Default is to not ignore broken objects and
* throw an exception if one is found.
*
* \param bBroken if true broken objects will be ignored
*/
inline void SetIgnoreBrokenObjects( bool bBroken );
protected: protected:
/** Searches backwards from the end of the file /** Searches backwards from the end of the file
* and tries to find a token. * and tries to find a token.
* The current file is positioned right after the token. * The current file is positioned right after the token.
* *
* \param pszToken a token to find * \param pszToken a token to find
* \param lRange range in bytes in which to search * \param lRange range in bytes in which to search
* begining at the end of the file * begining at the end of the file
*/ */
void FindToken( const char* pszToken, const long lRange ); void FindToken( const char* pszToken, const long lRange );
// Peter Petrov 23 December 2008
/** Searches backwards from the specified position of the file
* and tries to find a token.
* The current file is positioned right after the token.
*
* \param pszToken a token to find
* \param lRange range in bytes in which to search
* begining at the specified position of the file
* \param searchEnd specifies position
*/
void FindToken2( const char* pszToken, const long lRange, size_t search
End );
/** Reads the xref sections and the trailers of the file /** Reads the xref sections and the trailers of the file
* in the correct order in the memory * in the correct order in the memory
* and takes care for linearized pdf files. * and takes care for linearized pdf files.
*/ */
void ReadDocumentStructure(); void ReadDocumentStructure();
/** Checks wether this pdf is linearized or not. /** Checks wether this pdf is linearized or not.
* Initializes the linearization directory on sucess. * Initializes the linearization directory on sucess.
*/ */
void HasLinearizationDict(); void HasLinearizationDict();
skipping to change at line 345 skipping to change at line 417
void MergeTrailer( const PdfObject* pTrailer ); void MergeTrailer( const PdfObject* pTrailer );
/** Read the trailer directory at the end of the file. /** Read the trailer directory at the end of the file.
*/ */
void ReadTrailer(); void ReadTrailer();
/** Looks for a startxref entry at the current file position /** Looks for a startxref entry at the current file position
* and saves its byteoffset to pXRefOffset. * and saves its byteoffset to pXRefOffset.
* \param pXRefOffset store the byte offset of the xref section into t his variable. * \param pXRefOffset store the byte offset of the xref section into t his variable.
*/ */
void ReadXRef( long* pXRefOffset ); void ReadXRef( pdf_long* pXRefOffset );
/** Reads the xref table from a pdf file. /** Reads the xref table from a pdf file.
* If there is no xref table, ReadXRefStreamContents() is called. * If there is no xref table, ReadXRefStreamContents() is called.
* \param lOffset read the table from this offset * \param lOffset read the table from this offset
* \param bPositionAtEnd if true the xref table is not read, but the * \param bPositionAtEnd if true the xref table is not read, but the
* file stream is positioned directly * file stream is positioned directly
* after the table, which allows reading * after the table, which allows reading
* a following trailer dictionary. * a following trailer dictionary.
*/ */
void ReadXRefContents( long lOffset, bool bPositionAtEnd = false ); void ReadXRefContents( pdf_long lOffset, bool bPositionAtEnd = false );
/** Read a xref subsection /** Read a xref subsection
* *
* Throws ePdfError_NoXref if the number of objects read was not * Throws ePdfError_NoXref if the number of objects read was not
* the number specified by the subsection header (as passed in * the number specified by the subsection header (as passed in
* `nNumObjects'). * `nNumObjects').
* *
* \param nFirstObject object number of the first object * \param nFirstObject object number of the first object
* \param nNumObjects how many objects should be read from this secti on * \param nNumObjects how many objects should be read from this secti on
*/ */
void ReadXRefSubsection( long & nFirstObject, long & nNumObjects ); void ReadXRefSubsection( long long & nFirstObject, long long & nNumObje cts );
/** Reads a xref stream contens object /** Reads a xref stream contens object
* \param lOffset read the stream from this offset * \param lOffset read the stream from this offset
* \param bReadOnlyTrailer only the trailer is skipped over, the conte nts * \param bReadOnlyTrailer only the trailer is skipped over, the conte nts
* of the xref stream are not parsed * of the xref stream are not parsed
*/ */
void ReadXRefStreamContents( long lOffset, bool bReadOnlyTrailer ); void ReadXRefStreamContents( pdf_long lOffset, bool bReadOnlyTrailer );
void ReadXRefStreamEntry( char* pBuffer, long lLen, long lW[W_ARRAY_SIZ
E], int nObjNo );
/** Reads all objects from the pdf into memory /** Reads all objects from the pdf into memory
* from the offsets listed in m_vecOffsets. * from the offsets listed in m_vecOffsets.
* *
* If required an encryption object is setup first. * If required an encryption object is setup first.
* *
* The actual reading happens in ReadObjectsInternal() * The actual reading happens in ReadObjectsInternal()
* either if no encryption is required or a correct * either if no encryption is required or a correct
* encryption object was initialized from SetPassword. * encryption object was initialized from SetPassword.
*/ */
skipping to change at line 441 skipping to change at line 511
* with their initial values. * with their initial values.
*/ */
void Init(); void Init();
/** Small helper method to retrieve the document id from the trailer /** Small helper method to retrieve the document id from the trailer
* *
* \returns the document id of this PDF document * \returns the document id of this PDF document
*/ */
const PdfString & GetDocumentId(); const PdfString & GetDocumentId();
private: /** Determines the correct version of the PDF
* from the document catalog (if available).
struct TXRefEntry { * as, PDF > 1.4 allows updating the version.
inline TXRefEntry() : lOffset(0), lGeneration(0), cUsed('\x00'), bP *
arsed(false) { } * If no catalog dictionary is present or no /Version
long lOffset; * key is available, the version from the file header will
long lGeneration; * be used.
char cUsed; */
bool bParsed; void UpdateDocumentVersion();
};
typedef std::vector<TXRefEntry> TVecOffsets;
typedef TVecOffsets::iterator TIVecOffsets;
typedef TVecOffsets::const_iterator TCIVecOffsets;
private:
EPdfVersion m_ePdfVersion; EPdfVersion m_ePdfVersion;
bool m_bLoadOnDemand; bool m_bLoadOnDemand;
long m_nXRefOffset; pdf_long m_nXRefOffset;
long m_nFirstObject; long m_nFirstObject;
long m_nNumObjects; long m_nNumObjects;
long m_nXRefLinearizedOffset; pdf_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 m_bStrictParsing;
bool m_bIgnoreBrokenObjects;
int m_nIncrementalUpdates;
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
bool PdfParser::GetLoadOnDemand() const bool PdfParser::GetLoadOnDemand() const
{ {
return m_bLoadOnDemand; return m_bLoadOnDemand;
} }
skipping to change at line 494 skipping to change at line 568
// //
// ----------------------------------------------------- // -----------------------------------------------------
EPdfVersion PdfParser::GetPdfVersion() const EPdfVersion PdfParser::GetPdfVersion() const
{ {
return m_ePdfVersion; return m_ePdfVersion;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
int PdfParser::GetNumberOfIncrementalUpdates() const
{
return m_nIncrementalUpdates;
}
// -----------------------------------------------------
//
// -----------------------------------------------------
const PdfVecObjects* PdfParser::GetObjects() const const PdfVecObjects* PdfParser::GetObjects() const
{ {
return m_vecObjects; return m_vecObjects;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
const PdfObject* PdfParser::GetTrailer() const const PdfObject* PdfParser::GetTrailer() const
{ {
skipping to change at line 517 skipping to change at line 599
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
PdfEncrypt* PdfParser::TakeEncrypt() PdfEncrypt* PdfParser::TakeEncrypt()
{ {
PdfEncrypt* pEncrypt = m_pEncrypt; PdfEncrypt* pEncrypt = m_pEncrypt;
m_pEncrypt = NULL; m_pEncrypt = NULL;
return pEncrypt; return pEncrypt;
} }
// -----------------------------------------------------
//
// -----------------------------------------------------
bool PdfParser::IsStrictParsing() const
{
return m_bStrictParsing;
}
// -----------------------------------------------------
//
// -----------------------------------------------------
void PdfParser::SetStringParsing( bool bStrict )
{
m_bStrictParsing = bStrict;
}
// -----------------------------------------------------
//
// -----------------------------------------------------
bool PdfParser::GetIgnoreBrokenObjects()
{
return m_bIgnoreBrokenObjects;
}
// -----------------------------------------------------
//
// -----------------------------------------------------
void PdfParser::SetIgnoreBrokenObjects( bool bBroken )
{
m_bIgnoreBrokenObjects = bBroken;
}
}; };
#endif // _PDF_PARSER_H_ #endif // _PDF_PARSER_H_
 End of changes. 17 change blocks. 
24 lines changed or deleted 138 lines changed or added


 PdfParserObject.h   PdfParserObject.h 
skipping to change at line 50 skipping to change at line 50
/** Parse the object data from the given file handle starting at /** Parse the object data from the given file handle starting at
* the current position. * the current position.
* \param pCreator pointer to a PdfVecObjects to resolve object refere nces * \param pCreator pointer to a PdfVecObjects to resolve object refere nces
* \param rDevice an open reference counted input device which is posi tioned in * \param rDevice an open reference counted input device which is posi tioned in
* front of the object which is going to be parsed. * front of the object which is going to be parsed.
* \param rBuffer buffer to use for parsing to avoid reallocations * \param rBuffer buffer to use for parsing to avoid reallocations
* \param lOffset the position in the device from which the object sha ll be read * \param lOffset the position in the device from which the object sha ll be read
* if lOffset = -1, the object will be read from the cu rrent * if lOffset = -1, the object will be read from the cu rrent
* position in the file. * position in the file.
*/ */
PdfParserObject( PdfVecObjects* pCreator, const PdfRefCountedInputDevic e & rDevice, const PdfRefCountedBuffer & rBuffer, long lOffset = -1 ); PdfParserObject( PdfVecObjects* pCreator, const PdfRefCountedInputDevic e & rDevice, const PdfRefCountedBuffer & rBuffer, pdf_long lOffset = -1 );
/** Parse the object data for an internal object. /** Parse the object data for an internal object.
* You have to call ParseDictionaryKeys as next function call. * You have to call ParseDictionaryKeys as next function call.
* *
* The following two parameters are used to avoid allocation of a new * The following two parameters are used to avoid allocation of a new
* buffer in PdfSimpleParser. * buffer in PdfSimpleParser.
* *
* \warning This constructor is for internal usage only! * \warning This constructor is for internal usage only!
* *
* \param rBuffer buffer to use for parsing to avoid reallocations * \param rBuffer buffer to use for parsing to avoid reallocations
skipping to change at line 169 skipping to change at line 169
// Should the object try to defer loading of its contents until needed? // Should the object try to defer loading of its contents until needed?
// If false, object contents will be loaded during ParseFile(...). Note that // If false, object contents will be loaded during ParseFile(...). Note that
// this still uses the delayed loading infrastructure. // this still uses the delayed loading infrastructure.
// If true, loading will be triggered the first time the information is needed by // If true, loading will be triggered the first time the information is needed by
// an external caller. // an external caller.
// Outside callers should not be able to tell the difference between th e two modes // Outside callers should not be able to tell the difference between th e two modes
// of operation. // of operation.
bool m_bLoadOnDemand; bool m_bLoadOnDemand;
long m_lOffset; pdf_long m_lOffset;
bool m_bStream; bool m_bStream;
long m_lStreamOffset; pdf_long m_lStreamOffset;
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
void PdfParserObject::SetObjectNumber( unsigned int nObjNo ) void PdfParserObject::SetObjectNumber( unsigned int nObjNo )
{ {
m_reference.SetObjectNumber( nObjNo ); m_reference.SetObjectNumber( nObjNo );
} }
 End of changes. 3 change blocks. 
3 lines changed or deleted 3 lines changed or added


 PdfRefCountedBuffer.h   PdfRefCountedBuffer.h 
skipping to change at line 50 skipping to change at line 50
inline PdfRefCountedBuffer(); inline PdfRefCountedBuffer();
/** Created an reference counted buffer and use an exiting buffer /** Created an reference counted buffer and use an exiting buffer
* The buffer will be owned by this object. * The buffer will be owned by this object.
* *
* \param pBuffer a pointer to an allocated buffer * \param pBuffer a pointer to an allocated buffer
* \param lSize size of the allocated buffer * \param lSize size of the allocated buffer
* *
* \see SetTakePossesion * \see SetTakePossesion
*/ */
PdfRefCountedBuffer( char* pBuffer, long lSize ); PdfRefCountedBuffer( char* pBuffer, size_t lSize );
/** Create a new PdfRefCountedBuffer. /** Create a new PdfRefCountedBuffer.
* \param lSize buffer size * \param lSize buffer size
*/ */
inline PdfRefCountedBuffer( long lSize ); inline PdfRefCountedBuffer( size_t lSize );
/** Copy an existing PdfRefCountedBuffer and increase /** Copy an existing PdfRefCountedBuffer and increase
* the reference count * the reference count
* \param rhs the PdfRefCountedBuffer to copy * \param rhs the PdfRefCountedBuffer to copy
*/ */
inline PdfRefCountedBuffer( const PdfRefCountedBuffer & rhs ); inline PdfRefCountedBuffer( const PdfRefCountedBuffer & rhs );
/** Decrease the reference count and delete the buffer /** Decrease the reference count and delete the buffer
* if this is the last owner * if this is the last owner
*/ */
skipping to change at line 88 skipping to change at line 88
/** Get access to the buffer /** Get access to the buffer
* \returns the buffer * \returns the buffer
*/ */
inline char* GetBuffer() const; inline char* GetBuffer() const;
/** Return the buffer size. /** Return the buffer size.
* *
* \returns the buffer size * \returns the buffer size
*/ */
inline long GetSize() const; inline size_t GetSize() const;
/** Resize the buffer to hold at least /** Resize the buffer to hold at least
* lSize bytes. * lSize bytes.
* *
* \param lSize the size of bytes the buffer can at least hold * \param lSize the size of bytes the buffer can at least hold
* *
* If the buffer is larger no operation is performed. * If the buffer is larger no operation is performed.
*/ */
inline void Resize( size_t lSize ); inline void Resize( size_t lSize );
skipping to change at line 159 skipping to change at line 159
void FreeBuffer(); void FreeBuffer();
/** Detach from a shared buffer or do nothing if we are the only /** Detach from a shared buffer or do nothing if we are the only
* one referencing the buffer. * one referencing the buffer.
* *
* Call this function before any operation modifiying the buffer! * Call this function before any operation modifiying the buffer!
* *
* \param lLen an additional parameter specifiying extra bytes * \param lLen an additional parameter specifiying extra bytes
* to be allocated to optimize allocations of a new buffer . * to be allocated to optimize allocations of a new buffer .
*/ */
inline void Detach( long lExtraLen = 0 ); inline void Detach( size_t lExtraLen = 0 );
/** /**
* Called by Detach() to do the work if action is actually required. * Called by Detach() to do the work if action is actually required.
* \see Detach * \see Detach
*/ */
void ReallyDetach( long lExtraLen ); void ReallyDetach( size_t lExtraLen );
/** /**
* Do the hard work of resizing the buffer if it turns out not to alrea dy be big enough. * Do the hard work of resizing the buffer if it turns out not to alrea dy be big enough.
* \see Resize * \see Resize
*/ */
void ReallyResize( size_t lSize ); void ReallyResize( size_t lSize );
private: private:
struct TRefCountedBuffer { struct TRefCountedBuffer {
enum { INTERNAL_BUFSIZE = 32 }; enum { INTERNAL_BUFSIZE = 32 };
// Convenience inline for buffer switching // Convenience inline for buffer switching
PODOFO_NOTHROW inline char * GetRealBuffer() { return m_bOnHeap? m_ PODOFO_NOTHROW inline char * GetRealBuffer() {
pHeapBuffer : &(m_sInternalBuffer[0]); } return m_bOnHeap? m_pHeapBuffer : &(m_sInternalBuffer[0]);
}
// size in bytes of the buffer. If and only if this is strictly >IN TERNAL_BUFSIZE, // size in bytes of the buffer. If and only if this is strictly >IN TERNAL_BUFSIZE,
// this buffer is on the heap in memory pointed to by m_pHeapBuffer . If it is <=INTERNAL_BUFSIZE, // this buffer is on the heap in memory pointed to by m_pHeapBuffer . If it is <=INTERNAL_BUFSIZE,
// the buffer is in the in-object buffer m_sInternalBuffer. // the buffer is in the in-object buffer m_sInternalBuffer.
long m_lBufferSize; size_t m_lBufferSize;
// Size in bytes of m_pBuffer that should be reported to clients. W e // Size in bytes of m_pBuffer that should be reported to clients. W e
// over-allocate on the heap for efficiency and have a minimum 32 b yte // over-allocate on the heap for efficiency and have a minimum 32 b yte
// size, but this extra should NEVER be visible to a client. // size, but this extra should NEVER be visible to a client.
long m_lVisibleSize; size_t m_lVisibleSize;
long m_lRefCount; long m_lRefCount;
char* m_pHeapBuffer; char* m_pHeapBuffer;
char m_sInternalBuffer[INTERNAL_BUFSIZE]; char m_sInternalBuffer[INTERNAL_BUFSIZE];
bool m_bPossesion; bool m_bPossesion;
// Are we using the heap-allocated buffer in place of our small int ernal one? // Are we using the heap-allocated buffer in place of our small int ernal one?
bool m_bOnHeap; bool m_bOnHeap;
}; };
TRefCountedBuffer* m_pBuffer; TRefCountedBuffer* m_pBuffer;
}; };
skipping to change at line 208 skipping to change at line 210
// //
// ----------------------------------------------------- // -----------------------------------------------------
PdfRefCountedBuffer::PdfRefCountedBuffer() PdfRefCountedBuffer::PdfRefCountedBuffer()
: m_pBuffer( NULL ) : m_pBuffer( NULL )
{ {
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
PdfRefCountedBuffer::PdfRefCountedBuffer( long lSize ) PdfRefCountedBuffer::PdfRefCountedBuffer( size_t lSize )
: m_pBuffer( NULL ) : m_pBuffer( NULL )
{ {
this->Resize( lSize ); this->Resize( lSize );
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
// We define the copy ctor separately to the assignment // We define the copy ctor separately to the assignment
// operator since it's a *LOT* faster this way. // operator since it's a *LOT* faster this way.
skipping to change at line 246 skipping to change at line 248
// ----------------------------------------------------- // -----------------------------------------------------
inline char* PdfRefCountedBuffer::GetBuffer() const inline char* PdfRefCountedBuffer::GetBuffer() const
{ {
if (!m_pBuffer) return NULL; if (!m_pBuffer) return NULL;
return m_pBuffer->GetRealBuffer(); return m_pBuffer->GetRealBuffer();
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline long PdfRefCountedBuffer::GetSize() const inline size_t PdfRefCountedBuffer::GetSize() const
{ {
return m_pBuffer ? m_pBuffer->m_lVisibleSize : 0; return m_pBuffer ? m_pBuffer->m_lVisibleSize : 0;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline void PdfRefCountedBuffer::SetTakePossesion( bool bTakePossession ) inline void PdfRefCountedBuffer::SetTakePossesion( bool bTakePossession )
{ {
if( m_pBuffer ) if( m_pBuffer )
skipping to change at line 271 skipping to change at line 273
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline bool PdfRefCountedBuffer::TakePossesion() const inline bool PdfRefCountedBuffer::TakePossesion() const
{ {
return m_pBuffer ? m_pBuffer->m_bPossesion : false; return m_pBuffer ? m_pBuffer->m_bPossesion : false;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline void PdfRefCountedBuffer::Detach( long lExtraLen ) inline void PdfRefCountedBuffer::Detach( size_t lExtraLen )
{ {
if (m_pBuffer && m_pBuffer->m_lRefCount > 1L) if (m_pBuffer && m_pBuffer->m_lRefCount > 1L)
ReallyDetach(lExtraLen); ReallyDetach(lExtraLen);
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline void PdfRefCountedBuffer::Resize( size_t lSize ) inline void PdfRefCountedBuffer::Resize( size_t lSize )
{ {
 End of changes. 11 change blocks. 
12 lines changed or deleted 13 lines changed or added


 PdfRefCountedInputDevice.h   PdfRefCountedInputDevice.h 
skipping to change at line 71 skipping to change at line 71
*/ */
PdfRefCountedInputDevice( const wchar_t* pszFilename, const char* pszMo de ); PdfRefCountedInputDevice( const wchar_t* pszFilename, const char* pszMo de );
#endif #endif
#endif // _WIN32 #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, size_t 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.
*/ */
PdfRefCountedInputDevice( PdfInputDevice* pDevice ); PdfRefCountedInputDevice( PdfInputDevice* pDevice );
/** Copy an existing PdfRefCountedFile and increase /** Copy an existing PdfRefCountedFile and increase
* the reference count * the reference count
* \param rhs the PdfRefCountedFile to copy * \param rhs the PdfRefCountedFile to copy
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 PdfReference.h   PdfReference.h 
skipping to change at line 30 skipping to change at line 30
#ifndef _PDF_REFERENCE_H_ #ifndef _PDF_REFERENCE_H_
#define _PDF_REFERENCE_H_ #define _PDF_REFERENCE_H_
#include "PdfDefines.h" #include "PdfDefines.h"
#include "PdfDataType.h" #include "PdfDataType.h"
namespace PoDoFo { namespace PoDoFo {
typedef pdf_uint32 pdf_objnum;
/* Technically a generation number must be able to represent 99999 so 65535
isn't good enough.
* In practice Adobe's implementation notes suggest that they use a uint16
internally, and PDFs
* with greater object numbers won't work on many viewers. So we'll stick w
ith uint16.
*
* If you change this you'll need to change PdfReference::Write(...) to use
the apppropriate
* format, too. */
typedef pdf_uint16 pdf_gennum;
class PdfOutputDevice; class PdfOutputDevice;
/** /**
* A reference is a pointer to a object in the PDF file of the form * A reference is a pointer to a object in the PDF file of the form
* "4 0 R", where 4 is the object number and 0 is the generation number. * "4 0 R", where 4 is the object number and 0 is the generation number.
* Every object in the PDF file can be indetified this way. * Every object in the PDF file can be indetified this way.
* *
* This class is a indirect reference in a PDF file. * This class is a indirect reference in a PDF file.
*/ */
class PODOFO_API PdfReference : public PdfDataType { class PODOFO_API PdfReference : public PdfDataType {
skipping to change at line 56 skipping to change at line 65
: m_nObjectNo( 0 ), m_nGenerationNo( 0 ) : m_nObjectNo( 0 ), m_nGenerationNo( 0 )
{ {
} }
/** /**
* Create a PdfReference to an object with a given object and generatio n number. * Create a PdfReference to an object with a given object and generatio n number.
* *
* \param nObjectNo the object number * \param nObjectNo the object number
* \param nGenerationNo the generation number * \param nGenerationNo the generation number
*/ */
PdfReference( const unsigned long nObjectNo, const pdf_uint16 nGenerati onNo ) PdfReference( const pdf_objnum nObjectNo, const pdf_gennum nGenerationN o )
: m_nObjectNo( nObjectNo ), m_nGenerationNo( nGenerationNo ) : m_nObjectNo( nObjectNo ), m_nGenerationNo( nGenerationNo )
{ {
} }
/** /**
* Create a copy of an existing PdfReference. * Create a copy of an existing PdfReference.
* *
* \param rhs the object to copy * \param rhs the object to copy
*/ */
PdfReference( const PdfReference & rhs ) : PdfDataType() PdfReference( const PdfReference & rhs ) : PdfDataType()
skipping to change at line 115 skipping to change at line 124
/** /**
* Compare to PdfReference objects. * Compare to PdfReference objects.
* \returns true if this reference has a smaller object and generation number * \returns true if this reference has a smaller object and generation number
*/ */
PODOFO_NOTHROW inline bool operator<( const PdfReference & rhs ) const; PODOFO_NOTHROW inline bool operator<( const PdfReference & rhs ) const;
/** Set the object number of this object /** Set the object number of this object
* \param o the new object number * \param o the new object number
*/ */
PODOFO_NOTHROW inline void SetObjectNumber( unsigned long o ); PODOFO_NOTHROW inline void SetObjectNumber( pdf_uint32 o );
/** Get the object number. /** Get the object number.
* \returns the object number of this PdfReference * \returns the object number of this PdfReference
*/ */
PODOFO_NOTHROW inline unsigned long ObjectNumber() const; PODOFO_NOTHROW inline pdf_objnum ObjectNumber() const;
/** Set the generation number of this object /** Set the generation number of this object
* \param g the new generation number * \param g the new generation number
*/ */
PODOFO_NOTHROW inline void SetGenerationNumber( const pdf_uint16 g ); PODOFO_NOTHROW inline void SetGenerationNumber( const pdf_uint16 g );
/** Get the generation number. /** Get the generation number.
* \returns the generation number of this PdfReference * \returns the generation number of this PdfReference
*/ */
PODOFO_NOTHROW inline pdf_uint16 GenerationNumber() const; PODOFO_NOTHROW inline pdf_gennum GenerationNumber() const;
/** Allows to check if a reference points to an indirect /** Allows to check if a reference points to an indirect
* object. * object.
* *
* A reference is indirect if object number and generation * A reference is indirect if object number and generation
* number are both not equal 0. * number are both not equal 0.
* *
* \returns true if this reference is the reference of * \returns true if this reference is the reference of
* an indirect object. * an indirect object.
*/ */
PODOFO_NOTHROW inline bool IsIndirect() const; PODOFO_NOTHROW inline bool IsIndirect() const;
private: private:
unsigned long m_nObjectNo; pdf_objnum m_nObjectNo;
pdf_uint16 m_nGenerationNo; pdf_gennum m_nGenerationNo;
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
const PdfReference & PdfReference::operator=( const PdfReference & rhs ) const PdfReference & PdfReference::operator=( const PdfReference & rhs )
{ {
m_nObjectNo = rhs.m_nObjectNo; m_nObjectNo = rhs.m_nObjectNo;
m_nGenerationNo = rhs.m_nGenerationNo; m_nGenerationNo = rhs.m_nGenerationNo;
return *this; return *this;
skipping to change at line 185 skipping to change at line 194
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline bool PdfReference::operator!=( const PdfReference & rhs ) const inline bool PdfReference::operator!=( const PdfReference & rhs ) const
{ {
return !this->operator==( rhs ); return !this->operator==( rhs );
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
void PdfReference::SetObjectNumber( unsigned long o ) void PdfReference::SetObjectNumber( pdf_objnum o )
{ {
m_nObjectNo = o; m_nObjectNo = o;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
unsigned long PdfReference::ObjectNumber() const pdf_uint32 PdfReference::ObjectNumber() const
{ {
return m_nObjectNo; return m_nObjectNo;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
void PdfReference::SetGenerationNumber( pdf_uint16 g ) void PdfReference::SetGenerationNumber( pdf_gennum g )
{ {
m_nGenerationNo = g; m_nGenerationNo = g;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
pdf_uint16 PdfReference::GenerationNumber() const pdf_uint16 PdfReference::GenerationNumber() const
{ {
return m_nGenerationNo; return m_nGenerationNo;
 End of changes. 9 change blocks. 
9 lines changed or deleted 22 lines changed or added


 PdfRijndael.h   PdfRijndael.h 
skipping to change at line 66 skipping to change at line 66
// rin.init(Rijndael::CBC,Rijndael::Decrypt,key,Rijndael::Key32Bytes)); // rin.init(Rijndael::CBC,Rijndael::Decrypt,key,Rijndael::Key32Bytes));
// len = rin.padDecrypt(output,len,output2); // len = rin.padDecrypt(output,len,output2);
// if(len >= 0)useYourDecryptedText(); // if(len >= 0)useYourDecryptedText();
// else decryptError(len); // else decryptError(len);
// //
#define _MAX_KEY_COLUMNS (256/32) #define _MAX_KEY_COLUMNS (256/32)
#define _MAX_ROUNDS 14 #define _MAX_ROUNDS 14
#define MAX_IV_SIZE 16 #define MAX_IV_SIZE 16
// We assume that unsigned int is 32 bits long....
typedef unsigned char UINT8;
typedef unsigned int UINT32;
typedef unsigned short UINT16;
// Error codes // Error codes
#define RIJNDAEL_SUCCESS 0 #define RIJNDAEL_SUCCESS 0
#define RIJNDAEL_UNSUPPORTED_MODE -1 #define RIJNDAEL_UNSUPPORTED_MODE -1
#define RIJNDAEL_UNSUPPORTED_DIRECTION -2 #define RIJNDAEL_UNSUPPORTED_DIRECTION -2
#define RIJNDAEL_UNSUPPORTED_KEY_LENGTH -3 #define RIJNDAEL_UNSUPPORTED_KEY_LENGTH -3
#define RIJNDAEL_BAD_KEY -4 #define RIJNDAEL_BAD_KEY -4
#define RIJNDAEL_NOT_INITIALIZED -5 #define RIJNDAEL_NOT_INITIALIZED -5
#define RIJNDAEL_BAD_DIRECTION -6 #define RIJNDAEL_BAD_DIRECTION -6
#define RIJNDAEL_CORRUPTED_DATA -7 #define RIJNDAEL_CORRUPTED_DATA -7
skipping to change at line 103 skipping to change at line 98
// Creates a Rijndael cipher object // Creates a Rijndael cipher object
// You have to call init() before you can encrypt or decrypt stuff // You have to call init() before you can encrypt or decrypt stuff
// //
PdfRijndael(); PdfRijndael();
~PdfRijndael(); ~PdfRijndael();
protected: protected:
// Internal stuff // Internal stuff
enum State { Valid , Invalid }; enum State { Valid , Invalid };
State m_state; State m_state;
Mode m_mode; Mode m_mode;
Direction m_direction; Direction m_direction;
UINT8 m_initVector[MAX_IV_SIZE]; pdf_uint8 m_initVector[MAX_IV_SIZE];
UINT32 m_uRounds; pdf_uint32 m_uRounds;
UINT8 m_expandedKey[_MAX_ROUNDS+1][4][4]; pdf_uint8 m_expandedKey[_MAX_ROUNDS+1][4][4];
public: public:
//////////////////////////////////////////////////////////////////// ////////////////////// //////////////////////////////////////////////////////////////////// //////////////////////
// API // API
//////////////////////////////////////////////////////////////////// ////////////////////// //////////////////////////////////////////////////////////////////// //////////////////////
// init(): Initializes the crypt session // init(): Initializes the crypt session
// Returns RIJNDAEL_SUCCESS or an error code // Returns RIJNDAEL_SUCCESS or an error code
// mode : Rijndael::ECB, Rijndael::CBC or Rijndael::CFB1 // mode : Rijndael::ECB, Rijndael::CBC or Rijndael::CFB1
// You have to use the same mode for encrypting and decr ypting // You have to use the same mode for encrypting and decr ypting
// dir : Rijndael::Encrypt or Rijndael::Decrypt // dir : Rijndael::Encrypt or Rijndael::Decrypt
// A cipher instance works only in one direction // A cipher instance works only in one direction
// (Well , it could be easily modified to work in both // (Well , it could be easily modified to work in both
// directions with a single init() call, but it looks // directions with a single init() call, but it looks
// useless to me...anyway , it is a matter of generating // useless to me...anyway , it is a matter of generating
// two expanded keys) // two expanded keys)
// key : array of unsigned octets , it can be 16 , 24 or 32 by tes long // key : array of unsigned octets , it can be 16 , 24 or 32 by tes long
// this CAN be binary data (it is not expected to be nul l terminated) // this CAN be binary data (it is not expected to be nul l terminated)
// keyLen : Rijndael::Key16Bytes , Rijndael::Key24Bytes or Rijnda el::Key32Bytes // keyLen : Rijndael::Key16Bytes , Rijndael::Key24Bytes or Rijnda el::Key32Bytes
// initVector: initialization vector, you will usually use 0 here // initVector: initialization vector, you will usually use 0 here
int init(Mode mode,Direction dir,const UINT8 *key,KeyLength keyLen,U INT8 * initVector = 0); int init(Mode mode,Direction dir,const pdf_uint8 *key,KeyLength keyL en,pdf_uint8 * initVector = 0);
// Encrypts the input array (can be binary data) // Encrypts the input array (can be binary data)
// The input array length must be a multiple of 16 bytes, the remain ing part // The input array length must be a multiple of 16 bytes, the remain ing part
// is DISCARDED. // is DISCARDED.
// so it actually encrypts inputLen / 128 blocks of input and puts i t in outBuffer // so it actually encrypts inputLen / 128 blocks of input and puts i t in outBuffer
// Input len is in BITS! // Input len is in BITS!
// outBuffer must be at least inputLen / 8 bytes long. // outBuffer must be at least inputLen / 8 bytes long.
// Returns the encrypted buffer length in BITS or an error code < 0 in case of error // Returns the encrypted buffer length in BITS or an error code < 0 in case of error
int blockEncrypt(const UINT8 *input, int inputLen, UINT8 *outBuffer) ; int blockEncrypt(const pdf_uint8 *input, int inputLen, pdf_uint8 *ou tBuffer);
// Encrypts the input array (can be binary data) // Encrypts the input array (can be binary data)
// The input array can be any length , it is automatically padded on a 16 byte boundary. // The input array can be any length , it is automatically padded on a 16 byte boundary.
// Input len is in BYTES! // Input len is in BYTES!
// outBuffer must be at least (inputLen + 16) bytes long // outBuffer must be at least (inputLen + 16) bytes long
// Returns the encrypted buffer length in BYTES or an error code < 0 in case of error // Returns the encrypted buffer length in BYTES or an error code < 0 in case of error
int padEncrypt(const UINT8 *input, int inputOctets, UINT8 *outBuffer ); pdf_long padEncrypt(const pdf_uint8 *input, pdf_long inputOctets, pd f_uint8 *outBuffer);
// Decrypts the input vector // Decrypts the input vector
// Input len is in BITS! // Input len is in BITS!
// outBuffer must be at least inputLen / 8 bytes long // outBuffer must be at least inputLen / 8 bytes long
// Returns the decrypted buffer length in BITS and an error code < 0 in case of error // Returns the decrypted buffer length in BITS and an error code < 0 in case of error
int blockDecrypt(const UINT8 *input, int inputLen, UINT8 *outBuffer) ; int blockDecrypt(const pdf_uint8 *input, int inputLen, pdf_uint8 *ou tBuffer);
// Decrypts the input vector // Decrypts the input vector
// Input len is in BYTES! // Input len is in BYTES!
// outBuffer must be at least inputLen bytes long // outBuffer must be at least inputLen bytes long
// Returns the decrypted buffer length in BYTES and an error code < 0 in case of error // Returns the decrypted buffer length in BYTES and an error code < 0 in case of error
int padDecrypt(const UINT8 *input, int inputOctets, UINT8 *outBuffer ); int padDecrypt(const pdf_uint8 *input, int inputOctets, pdf_uint8 *o utBuffer);
protected: protected:
void keySched(UINT8 key[_MAX_KEY_COLUMNS][4]); void keySched(pdf_uint8 key[_MAX_KEY_COLUMNS][4]);
void keyEncToDec(); void keyEncToDec();
void encrypt(const UINT8 a[16], UINT8 b[16]); void encrypt(const pdf_uint8 a[16], pdf_uint8 b[16]);
void decrypt(const UINT8 a[16], UINT8 b[16]); void decrypt(const pdf_uint8 a[16], pdf_uint8 b[16]);
}; };
}; };
#endif // _PDFRIJNDAEL_H_ #endif // _PDFRIJNDAEL_H_
 End of changes. 9 change blocks. 
19 lines changed or deleted 14 lines changed or added


 PdfShadingPattern.h   PdfShadingPattern.h 
skipping to change at line 140 skipping to change at line 140
* \param dX0 the starting x coordinate * \param dX0 the starting x coordinate
* \param dY0 the starting y coordinate * \param dY0 the starting y coordinate
* \param dX1 the ending x coordinate * \param dX1 the ending x coordinate
* \param dY1 the ending y coordinate * \param dY1 the ending y coordinate
* \param rStart the starting color * \param rStart the starting color
* \param rEnd the ending color * \param rEnd the ending color
*/ */
void Init( double dX0, double dY0, double dX1, double dY1, const PdfCol or & rStart, const PdfColor & rEnd ); void Init( double dX0, double dY0, double dX1, double dY1, const PdfCol or & rStart, const PdfColor & rEnd );
}; };
/** A shading pattern that is an 2D
* shading between four colors.
*/
class PODOFO_API PdfFunctionBaseShadingPattern : public PdfShadingPattern {
public:
/** Create an 2D shading pattern
*
* \param rLL the color on lower left corner
* \param rUL the color on upper left corner
* \param rLR the color on lower right corner
* \param rUR the color on upper right corner
* \param rMatrix the transformation matrix mapping the coordinate spa
ce
* specified by the Domain entry into the shading
* \param pParent the parent
*/
PdfFunctionBaseShadingPattern( const PdfColor & rLL, const PdfColor & r
UL, const PdfColor & rLR, const PdfColor & rUR, const PdfArray & rMatrix, P
dfVecObjects* pParent );
/** Create an 2D shading pattern
*
* \param rLL the color on lower left corner
* \param rUL the color on upper left corner
* \param rLR the color on lower right corner
* \param rUR the color on upper right corner
* \param rMatrix the transformation matrix mapping the coordinate spa
ce
* specified by the Domain entry into the shading
* \param pParent the parent
*/
PdfFunctionBaseShadingPattern( const PdfColor & rLL, const PdfColor & r
UL, const PdfColor & rLR, const PdfColor & rUR, const PdfArray & rMatrix, P
dfDocument* pParent );
private:
/** Initialize an 2D shading pattern
*
* \param rLL the color on lower left corner
* \param rUL the color on upper left corner
* \param rLR the color on lower right corner
* \param rUR the color on upper right corner
* \param rMatrix the transformation matrix mapping the coordinate spa
ce
* specified by the Domain entry into the shading
*/
void Init( const PdfColor & rLL, const PdfColor & rUL, const PdfColor &
rLR, const PdfColor & rUR, const PdfArray & rMatrix );
};
/** A shading pattern that is a simple radial /** A shading pattern that is a simple radial
* shading between two colors. * shading between two colors.
*/ */
class PODOFO_API PdfRadialShadingPattern : public PdfShadingPattern { class PODOFO_API PdfRadialShadingPattern : public PdfShadingPattern {
public: public:
/** Create an radial shading pattern /** Create an radial shading pattern
* *
* \param dX0 the inner circles x coordinate * \param dX0 the inner circles x coordinate
* \param dY0 the inner circles y coordinate * \param dY0 the inner circles y coordinate
* \param dR0 the inner circles radius * \param dR0 the inner circles radius
 End of changes. 1 change blocks. 
0 lines changed or deleted 51 lines changed or added


 PdfStream.h   PdfStream.h 
skipping to change at line 78 skipping to change at line 78
/** Set a binary buffer as stream data. /** Set a binary buffer as stream data.
* *
* Use PdfFilterFactory::CreateFilterList if you want to use the conten ts * Use PdfFilterFactory::CreateFilterList if you want to use the conten ts
* of the stream dictionary's existing filter key. * of the stream dictionary's existing filter key.
* *
* \param szBuffer buffer containing the stream data * \param szBuffer buffer containing the stream data
* \param lLen length of the buffer * \param lLen length of the buffer
* \param vecFilters a list of filters to use when appending data * \param vecFilters a list of filters to use when appending data
*/ */
void Set( const char* szBuffer, long lLen, const TVecFilters & vecFilte rs ); void Set( const char* szBuffer, pdf_long lLen, const TVecFilters & vecF ilters );
/** Set a binary buffer as stream data. /** Set a binary buffer as stream data.
* All data will be flate encoded. * All data will be flate encoded.
* *
* \param szBuffer buffer containing the stream data * \param szBuffer buffer containing the stream data
* \param lLen length of the buffer * \param lLen length of the buffer
*/ */
void Set( const char* szBuffer, long lLen ); void Set( const char* szBuffer, pdf_long lLen );
/** Set a binary buffer whose contents are read from a PdfInputStream /** Set a binary buffer whose contents are read from a PdfInputStream
* All data will be flate encoded. * All data will be flate encoded.
* *
* \param pStream read stream contents from this PdfInputStream * \param pStream read stream contents from this PdfInputStream
*/ */
void Set( PdfInputStream* pStream ); void Set( PdfInputStream* pStream );
/** Set a binary buffer whose contents are read from a PdfInputStream /** Set a binary buffer whose contents are read from a PdfInputStream
* *
skipping to change at line 121 skipping to change at line 121
/** Sets raw data for this filter which is read from an input stream. /** Sets raw data for this filter which is read from an input stream.
* This method does neither encode nor decode the read data. * This method does neither encode nor decode the read data.
* The filters of the object are not modified and the data is expected to be * The filters of the object are not modified and the data is expected to be
* encoded as stated by the /Filters key in the streams object. * encoded as stated by the /Filters key in the streams object.
* *
* \param pStream read data from this input stream * \param pStream read data from this input stream
* \param lLen read excactly lLen bytes from the input stream * \param lLen read excactly lLen bytes from the input stream
* if lLen = -1 read until the end of the input stream was reached. * if lLen = -1 read until the end of the input stream was reached.
*/ */
void SetRawData( PdfInputStream* pStream, long lLen = -1 ); void SetRawData( PdfInputStream* pStream, pdf_long lLen = -1 );
/** Start appending data to this stream. /** Start appending data to this stream.
* *
* This method has to be called before any of the append methods. * This method has to be called before any of the append methods.
* All appended data will be flate decoded! * All appended data will be flate decoded!
* *
* \param bClearExisting if true any existing stream contents will be * \param bClearExisting if true any existing stream contents will be
* cleared. * cleared.
* *
* \see Append * \see Append
skipping to change at line 199 skipping to change at line 199
* \see BeginAppend * \see BeginAppend
* \see Append * \see Append
*/ */
void EndAppend(); void EndAppend();
/** Get the stream's length with all filters applied (eg if the stream is /** Get the stream's length with all filters applied (eg if the stream is
* Flate compressed, the length of the compressed data stream). * Flate compressed, the length of the compressed data stream).
* *
* \returns the length of the internal buffer * \returns the length of the internal buffer
*/ */
virtual unsigned long GetLength() const = 0; virtual pdf_long GetLength() const = 0;
/** Get a malloced buffer of the current stream. /** Get a malloced buffer of the current stream.
* No filters will be applied to the buffer, so * No filters will be applied to the buffer, so
* if the stream is Flate compressed the compressed copy * if the stream is Flate compressed the compressed copy
* will be returned. * will be returned.
* *
* The caller has to free() the buffer. * The caller has to free() the buffer.
* *
* \param pBuffer pointer to the buffer * \param pBuffer pointer to the buffer
* \param lLen pointer to the buffer length * \param lLen pointer to the buffer length
*/ */
virtual void GetCopy( char** pBuffer, long* lLen ) const = 0; virtual void GetCopy( char** pBuffer, pdf_long* lLen ) const = 0;
/** Get a copy of a the stream and write it to a PdfOutputStream
*
* \param pStream data is written to this stream.
*/
virtual void GetCopy( PdfOutputStream* pStream ) const = 0;
/** Get a malloced buffer of the current stream which has been /** Get a malloced buffer of the current stream which has been
* filtered by all filters as specified in the dictionary's * filtered by all filters as specified in the dictionary's
* /Filter key. For example, if the stream is Flate compressed, * /Filter key. For example, if the stream is Flate compressed,
* the buffer returned from this method will have been decompressed. * the buffer returned from this method will have been decompressed.
* *
* The caller has to free() the buffer. * The caller has to free() the buffer.
* *
* \param pBuffer pointer to the buffer * \param pBuffer pointer to the buffer
* \param lLen pointer to the buffer length * \param lLen pointer to the buffer length
*/ */
void GetFilteredCopy( char** pBuffer, long* lLen ) const; void GetFilteredCopy( char** pBuffer, pdf_long* lLen ) const;
/** Get a filtered copy of a the stream and write it to a PdfOutputStre am /** Get a filtered copy of a the stream and write it to a PdfOutputStre am
* *
* \param pStream filtered data is written to this stream. * \param pStream filtered data is written to this stream.
*/ */
void GetFilteredCopy( PdfOutputStream* pStream ) const; void GetFilteredCopy( PdfOutputStream* pStream ) const;
/** Create a copy of a PdfStream object /** Create a copy of a PdfStream object
* \param rhs the object to clone * \param rhs the object to clone
* \returns a reference to this object * \returns a reference to this object
skipping to change at line 246 skipping to change at line 252
protected: protected:
/** Required for the GetFilteredCopy implementation /** Required for the GetFilteredCopy implementation
* \returns a handle to the internal buffer * \returns a handle to the internal buffer
*/ */
virtual const char* GetInternalBuffer() const = 0; virtual const char* GetInternalBuffer() const = 0;
/** Required for the GetFilteredCopy implementation /** Required for the GetFilteredCopy implementation
* \returns the size of the internal buffer * \returns the size of the internal buffer
*/ */
virtual unsigned long GetInternalBufferSize() const = 0; virtual pdf_long GetInternalBufferSize() const = 0;
/** Begin appending data to this stream. /** Begin appending data to this stream.
* Clears the current stream contents. * Clears the current stream contents.
* *
* Use PdfFilterFactory::CreateFilterList if you want to use the conten ts * Use PdfFilterFactory::CreateFilterList if you want to use the conten ts
* of the stream dictionary's existing filter key. * of the stream dictionary's existing filter key.
* *
* \param vecFilters use this filters to encode any data written to th e stream. * \param vecFilters use this filters to encode any data written to th e stream.
*/ */
virtual void BeginAppendImpl( const TVecFilters & vecFilters ) = 0; virtual void BeginAppendImpl( const TVecFilters & vecFilters ) = 0;
 End of changes. 7 change blocks. 
7 lines changed or deleted 13 lines changed or added


 PdfString.h   PdfString.h 
skipping to change at line 115 skipping to change at line 115
* 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. * \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. * 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, const P dfEncoding * const pEncoding = NULL ); PdfString( const char* pszString, pdf_long lLen, bool bHex = false, con st PdfEncoding * 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 138 skipping to change at line 138
*/ */
PdfString( const pdf_utf16be* pszStringUtf16 ); PdfString( const pdf_utf16be* pszStringUtf16 );
/** 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, pdf_long lLen );
/** Construct a new PdfString from an UTF-16be encoded zero terminated string. /** Construct a new PdfString from an UTF-16be encoded zero terminated string.
* *
* \param pszStringUtf16 a UTF-16BE encoded string. * \param pszStringUtf16 a UTF-16BE encoded string.
* \param lLen number of words to convert * \param lLen number of words to convert
*/ */
PdfString( const pdf_utf16be* pszStringUtf16, long lLen ); PdfString( const pdf_utf16be* pszStringUtf16, pdf_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.
* if lLen == -1 then strlen( pszHex ) will * if lLen == -1 then strlen( pszHex ) will
* be used as length of the hex data. * be used as length of the hex data.
* pszHex has to be zero terminated in this case. * pszHex has to be zero terminated in this case.
* \param pEncrypt if !NULL assume the hex data is encrypted and shoul d be decrypted after hexdecoding * \param pEncrypt if !NULL assume the hex data is encrypted and shoul d be decrypted after hexdecoding
*/ */
void SetHexData( const char* pszHex, long lLen = -1, PdfEncrypt* pEncry pt = NULL ); void SetHexData( const char* pszHex, pdf_long lLen = -1, PdfEncrypt* pE ncrypt = NULL );
/** The string is valid if no error in the constructor has occurred. /** The string is valid if no error in the constructor has occurred.
* If it is valid it is safe to call all the other member functions. * If it is valid it is safe to call all the other member functions.
* \returns true if this is a valid initialized PdfString * \returns true if this is a valid initialized PdfString
*/ */
inline bool IsValid() const; inline bool IsValid() const;
/** Check if this is a hex string. /** Check if this is a hex string.
* *
* If true the data will be hex encoded when the string is written to * If true the data will be hex encoded when the string is written to
skipping to change at line 252 skipping to change at line 252
const std::wstring GetStringW() const; const std::wstring GetStringW() const;
#endif // _WIN32 #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 pdf_long GetLength() const;
/** The length of the string data returned by GetUnicode() /** The length of the string data returned by GetUnicode()
* in characters not including the terminating zero * in characters not including the terminating zero
* *
* \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 GetUnicodeLength() const; inline pdf_long GetUnicodeLength() const;
/** Get the number of characters in the string. /** Get the number of characters in the string.
* *
* This function returns the correct number of characters in the strin g * This function returns the correct number of characters in the strin g
* for unicode and ansi strings. Always use this method if you want to * for unicode and ansi strings. Always use this method if you want to
* know the number of characters in the string * know the number of characters in the string
* as GetLength() will returns the number of bytes used for unicode st rings! * as GetLength() will returns the number of bytes used for unicode st rings!
* *
* *
* \returngs the number of characters in the string * \returngs the number of characters in the string
*/ */
inline long GetCharacterLength() const; inline pdf_long GetCharacterLength() const;
/** Write this PdfString in PDF format to a PdfOutputDevice /** Write this PdfString in PDF format to a PdfOutputDevice
* *
* \param pDevice the output device. * \param pDevice the output 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
*/ */
void Write ( PdfOutputDevice* pDevice, const PdfEncrypt* pEncrypt = NUL L ) const; void Write ( PdfOutputDevice* pDevice, const PdfEncrypt* pEncrypt = NUL L ) const;
/** Copy an existing PdfString /** Copy an existing PdfString
skipping to change at line 353 skipping to change at line 353
* *
* If IsUnicode() returns true a copy of this string is returned * If IsUnicode() returns true a copy of this string is returned
* otherwise the string data is converted to UTF-16be and returned. * otherwise the string data is converted to UTF-16be and returned.
* *
* \returns a unicode version of this string * \returns a unicode version of this string
*/ */
PdfString ToUnicode() const; PdfString ToUnicode() const;
static const PdfString StringNull; static const PdfString StringNull;
static long ConvertUTF8toUTF16( const pdf_utf8* pszUtf8, pdf_utf16be* p static pdf_long ConvertUTF8toUTF16( const pdf_utf8* pszUtf8, pdf_utf16b
szUtf16, long lLenUtf16 ); e* pszUtf16, pdf_long lLenUtf16 );
static long ConvertUTF8toUTF16( const pdf_utf8* pszUtf8, long lLenUtf8, static pdf_long ConvertUTF8toUTF16( const pdf_utf8* pszUtf8, pdf_long l
pdf_utf16be* pszUtf16, long lLenUtf16, LenUtf8,
pdf_utf16be* pszUtf16, pdf_long lLenUtf
16,
EPdfStringConversion eConversion = ePdf StringConversion_Strict ); EPdfStringConversion eConversion = ePdf StringConversion_Strict );
static long ConvertUTF16toUTF8( const pdf_utf16be* pszUtf16, pdf_utf8* static pdf_long ConvertUTF16toUTF8( const pdf_utf16be* pszUtf16, pdf_ut
pszUtf8, long lLenUtf8 ); f8* pszUtf8, pdf_long lLenUtf8 );
static long ConvertUTF16toUTF8( const pdf_utf16be* pszUtf16, long lLenU static pdf_long ConvertUTF16toUTF8( const pdf_utf16be* pszUtf16, pdf_lo
tf16, ng lLenUtf16,
pdf_utf8* pszUtf8, long lLenUtf8, pdf_utf8* pszUtf8, pdf_long lLenUtf8,
EPdfStringConversion eConversion = ePdf StringConversion_Strict ); EPdfStringConversion eConversion = ePdf StringConversion_Strict );
private: private:
/** Allocate m_lLen data for m_pszData if data /** Allocate m_lLen data for m_pszData if data
* does not fit into m_pBuffer. * does not fit into m_pBuffer.
* Otherwise m_pszData is set to point to * Otherwise m_pszData is set to point to
* m_pBuffer. * m_pBuffer.
*/ */
void Allocate(); void Allocate();
skipping to change at line 385 skipping to change at line 385
/** 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.
* if m_bhex is true the copied data will be hex encoded. * if m_bhex is true the copied data will be hex encoded.
* *
* \param pszString the string to copy * \param pszString the string to copy
* \param lLen length of the string data to copy * \param lLen length of the string data to copy
* *
*/ */
void Init( const char* pszString, long lLen ); void Init( const char* pszString, pdf_long lLen );
/** Construct a new PdfString from a UTF8 /** Construct a new PdfString from a UTF8
* string. * string.
* The input string will be copied and converted to UTF-16be. * The input string will be copied and converted to UTF-16be.
* *
* \param pszStringUtf8 the string to copy * \param pszStringUtf8 the string to copy
* \param lLen number of bytes of the string data to copy * \param lLen number of bytes of the string data to copy
* *
*/ */
void InitFromUtf8( const pdf_utf8* pszStringUtf8, long lLen ); void InitFromUtf8( const pdf_utf8* pszStringUtf8, pdf_long lLen );
/** Swap the bytes in the buffer (UTF16be -> UTF16le) /** Swap the bytes in the buffer (UTF16be -> UTF16le)
* \param pBuf buffer * \param pBuf buffer
* \param lLen length of buffer * \param lLen length of buffer
*/ */
static void SwapBytes( char* pBuf, long lLen ); static void SwapBytes( char* pBuf, pdf_long lLen );
/** Initialise the data member containing a /** Initialise the data member containing a
* UTF8 version of this string. * UTF8 version of this string.
* *
* This is only done once and only if necessary. * This is only done once and only if necessary.
*/ */
void InitUtf8(); void InitUtf8();
private: private:
static const char s_pszUnicodeMarker[]; ///< The unicode marke r used to indicate unicode strings in PDF static const char s_pszUnicodeMarker[]; ///< The unicode marke r used to indicate unicode strings in PDF
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
static const char * const m_escMap; ///< Mapping of escape sequences to there value
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. const PdfEncoding* m_pEncoding; ///< Encoding for non Unicode strings. NULL for unicode strings.
}; };
skipping to change at line 479 skipping to change at line 480
{ {
if( this->IsValid() && !m_sUtf8.length() && m_buffer.GetSize() - 2) if( this->IsValid() && !m_sUtf8.length() && m_buffer.GetSize() - 2)
const_cast<PdfString*>(this)->InitUtf8(); const_cast<PdfString*>(this)->InitUtf8();
return m_sUtf8; return m_sUtf8;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
long PdfString::GetLength() const pdf_long PdfString::GetLength() const
{ {
return m_buffer.GetSize() - 2; return m_buffer.GetSize() - 2;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
long PdfString::GetCharacterLength() const pdf_long PdfString::GetCharacterLength() const
{ {
return this->IsUnicode() ? this->GetUnicodeLength() : this->GetLength() ; return this->IsUnicode() ? this->GetUnicodeLength() : this->GetLength() ;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
long PdfString::GetUnicodeLength() const pdf_long PdfString::GetUnicodeLength() const
{ {
return (m_buffer.GetSize() / sizeof(pdf_utf16be)) - 1; return (m_buffer.GetSize() / sizeof(pdf_utf16be)) - 1;
} }
}; };
#endif // _PDF_STRING_H_ #endif // _PDF_STRING_H_
 End of changes. 16 change blocks. 
22 lines changed or deleted 25 lines changed or added


 PdfTable.h   PdfTable.h 
skipping to change at line 654 skipping to change at line 654
*/ */
inline const PdfTableModel* GetModel() const; inline const PdfTableModel* GetModel() const;
/** Set the width of all columns. /** Set the width of all columns.
* *
* \param pdWidths a pointer to an array of GetCols() doubles * \param pdWidths a pointer to an array of GetCols() doubles
* which are the individual width of a column. * which are the individual width of a column.
* *
* \see GetCols() * \see GetCols()
*/ */
inline void SetColumnWidths( double* pdWidths ); void SetColumnWidths( double* pdWidths );
/** Set the height of all rows. /** Set the height of all rows.
* *
* \param pdHeights a pointer to an array of GetRows() doubles * \param pdHeights a pointer to an array of GetRows() doubles
* which are the individual heights of a row. * which are the individual heights of a row.
* *
* \see GetRows() * \see GetRows()
*/ */
inline void SetRowHeights( double* pdHeights ); void SetRowHeights( double* pdHeights );
/** Set all columns to have the same width. /** Set all columns to have the same width.
* *
* \param dWidth the width of every column * \param dWidth the width of every column
* *
* By default the column with is calculated automatically * By default the column with is calculated automatically
* from either the table width or if no table width is set * from either the table width or if no table width is set
* from the width of the page on which the table is drawn. * from the width of the page on which the table is drawn.
*/ */
inline void SetColumnWidth( double dWidth ); inline void SetColumnWidth( double dWidth );
skipping to change at line 834 skipping to change at line 834
// //
// ----------------------------------------------------- // -----------------------------------------------------
const PdfTableModel* PdfTable::GetModel() const const PdfTableModel* PdfTable::GetModel() const
{ {
return m_pModel; return m_pModel;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
void PdfTable::SetColumnWidths( double* pdWidths )
{
if( m_pdColWidths )
{
delete [] m_pdColWidths;
m_pdColWidths = NULL;
}
if( pdWidths )
{
m_pdColWidths = new double[this->GetCols()];
memcpy( m_pdColWidths, pdWidths, this->GetCols() * sizeof(double) )
;
}
}
// -----------------------------------------------------
//
// -----------------------------------------------------
void PdfTable::SetRowHeights( double* pdHeights )
{
if( m_pdRowHeights )
{
delete [] m_pdRowHeights;
m_pdRowHeights = NULL;
}
if( pdHeights )
{
m_pdRowHeights = new double[this->GetRows()];
memcpy( m_pdRowHeights, pdHeights, this->GetRows() * sizeof(double)
);
}
}
// -----------------------------------------------------
//
// -----------------------------------------------------
void PdfTable::SetColumnWidth( double dWidth ) void PdfTable::SetColumnWidth( double dWidth )
{ {
m_dColWidth = dWidth; m_dColWidth = dWidth;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
void PdfTable::SetRowHeight( double dHeight ) void PdfTable::SetRowHeight( double dHeight )
{ {
 End of changes. 3 change blocks. 
40 lines changed or deleted 2 lines changed or added


 PdfTokenizer.h   PdfTokenizer.h 
skipping to change at line 29 skipping to change at line 29
************************************************************************** */ ************************************************************************** */
#ifndef _PDF_TOKENIZER_H_ #ifndef _PDF_TOKENIZER_H_
#define _PDF_TOKENIZER_H_ #define _PDF_TOKENIZER_H_
#include "PdfDefines.h" #include "PdfDefines.h"
#include "PdfRefCountedBuffer.h" #include "PdfRefCountedBuffer.h"
#include "PdfRefCountedInputDevice.h" #include "PdfRefCountedInputDevice.h"
#include <deque> #include <deque>
#include <sstream>
namespace PoDoFo { namespace PoDoFo {
class PdfEncrypt; class PdfEncrypt;
class PdfVariant; class PdfVariant;
enum EPdfTokenType { enum EPdfTokenType {
ePdfTokenType_Delimiter, ePdfTokenType_Delimiter,
ePdfTokenType_Token, ePdfTokenType_Token,
skipping to change at line 54 skipping to change at line 55
typedef TTokenizerQueque::iterator TITokenizerQueque; typedef TTokenizerQueque::iterator TITokenizerQueque;
typedef TTokenizerQueque::const_iterator TCITokenizerQueque; typedef TTokenizerQueque::const_iterator TCITokenizerQueque;
/** /**
* A simple tokenizer for PDF files and PDF content streams * A simple tokenizer for PDF files and PDF content streams
*/ */
class PODOFO_API PdfTokenizer { class PODOFO_API PdfTokenizer {
public: public:
PdfTokenizer(); PdfTokenizer();
PdfTokenizer( const char* pBuffer, long lLen ); PdfTokenizer( const char* pBuffer, size_t lLen );
PdfTokenizer( const PdfRefCountedInputDevice & rDevice, const PdfRefCou ntedBuffer & rBuffer ); PdfTokenizer( const PdfRefCountedInputDevice & rDevice, const PdfRefCou ntedBuffer & rBuffer );
virtual ~PdfTokenizer(); virtual ~PdfTokenizer();
/** Reads the next token from the current file position /** Reads the next token from the current file position
* ignoring all comments. * ignoring all comments.
* *
* \param[out] pszBuf On true return, set to a pointer to the read * \param[out] pszBuf On true return, set to a pointer to the read
* token (a NULL-terminated C string). The pointer is * token (a NULL-terminated C string). The pointer is
* to memory owned by PdfTokenizer and must NOT be * to memory owned by PdfTokenizer and must NOT be
skipping to change at line 102 skipping to change at line 103
/** Read the next number from the current file position /** Read the next number from the current file position
* ignoring all comments. * ignoring all comments.
* *
* Raises NoNumber exception if the next token is no number, and * Raises NoNumber exception if the next token is no number, and
* UnexpectedEOF if no token could be read. No token is consumed if * UnexpectedEOF if no token could be read. No token is consumed if
* NoNumber is thrown. * NoNumber is thrown.
* *
* \returns a number read from the input device. * \returns a number read from the input device.
*/ */
long GetNextNumber(); pdf_long GetNextNumber();
/** Read the next variant from the current file position /** Read the next variant from the current file position
* ignoring all comments. * ignoring all comments.
* *
* Raises an UnexpectedEOF exception if there is no variant left in th e * Raises an UnexpectedEOF exception if there is no variant left in th e
* file. * file.
* *
* \param rVariant write the read variant to this value * \param rVariant write the read variant to this value
* \param pEncrypt an encryption object which is used to decrypt strin gs during parsing * \param pEncrypt an encryption object which is used to decrypt strin gs during parsing
*/ */
skipping to change at line 239 skipping to change at line 240
static const char * const m_escMap; ///< Mapping of escape sequences to there value 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.
/// An istringstream which is used
/// to read double values instead of strtod
/// which is locale depend.
std::istringstream m_doubleParser;
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline bool PdfTokenizer::IsWhitespace(const unsigned char ch) inline bool PdfTokenizer::IsWhitespace(const unsigned char ch)
{ {
return ( PdfTokenizer::m_whitespaceMap[ch] != 0 ); return ( PdfTokenizer::m_whitespaceMap[ch] != 0 );
} }
 End of changes. 4 change blocks. 
2 lines changed or deleted 7 lines changed or added


 PdfVariant.h   PdfVariant.h 
skipping to change at line 75 skipping to change at line 75
PdfVariant(); PdfVariant();
/** Construct a PdfVariant that is a bool. /** Construct a PdfVariant that is a bool.
* \param b the boolean value of this PdfVariant * \param b the boolean value of this PdfVariant
*/ */
PdfVariant( bool b ); PdfVariant( bool b );
/** Construct a PdfVariant that is a number. /** Construct a PdfVariant that is a number.
* \param l the value of the number. * \param l the value of the number.
*/ */
PdfVariant( long l ); PdfVariant( pdf_int64 l );
/** Construct a PdfVariant that is a real number. /** Construct a PdfVariant that is a real number.
* \param d the value of the real number. * \param d the value of the real number.
*/ */
PdfVariant( double d ); PdfVariant( double d );
/** Construct a PdfVariant that is a string. The argument /** Construct a PdfVariant that is a string. The argument
* string will be escaped where necessary, so it should be * string will be escaped where necessary, so it should be
* passed in unescaped form. * passed in unescaped form.
* *
skipping to change at line 246 skipping to change at line 246
* \param l the value as long. * \param l the value as long.
* *
* This will set the dirty flag of this object. * This will set the dirty flag of this object.
* \see IsDirty * \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 pdf_int64 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. * This will set the dirty flag of this object.
* \see IsDirty * \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.
skipping to change at line 294 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 reference to the PdfData instance.
*/
inline const PdfData & GetRawData() const;
/** Get the reference values of this object.
* \returns a reference to the PdfData instance.
*/
inline PdfData & GetRawData();
/** 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. * This will set the dirty flag of this object.
* \see IsDirty * \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
skipping to change at line 327 skipping to change at line 337
* if you call any non-const member function * if you call any non-const member function
* (e.g. GetDictionary()) as PdfVariant cannot * (e.g. GetDictionary()) as PdfVariant cannot
* determine if you actually changed the dictionary * determine if you actually changed the dictionary
* or not. * or not.
* *
* \returns true if the value is dirty and has been * \returns true if the value is dirty and has been
* modified since construction * modified since construction
*/ */
inline bool IsDirty() const; inline bool IsDirty() const;
/**
* Sets this object to immutable,
* so that no keys can be edited or changed.
*
* @param bImmutable if true set the object to be immutable
*
* This is used by PdfImmediateWriter and PdfStreamedDocument so
* that no keys can be added to an object after setting stream data on
it.
*
*/
inline void SetImmutable(bool bImmutable);
/**
* Retrieve if an object is immutable.
*
* This is used by PdfImmediateWriter and PdfStreamedDocument so
* that no keys can be added to an object after setting stream data on
it.
*
* @returns true if the object is immutable
*/
inline bool GetImmutable() const;
protected: protected:
/**
* Will throw an exception if called on an immutable object,
* so this should be called before actually changing a value!
*
*/
inline void AssertMutable() const;
/** Sets the dirty flag of this PdfVariant /** Sets the dirty flag of this PdfVariant
* *
* \param bDirty true if this PdfVariant has been * \param bDirty true if this PdfVariant has been
* modified from the outside * modified from the outside
* *
* \see IsDirty * \see IsDirty
*/ */
inline void SetDirty( bool bDirty ); inline void SetDirty( bool bDirty );
/** /**
skipping to change at line 446 skipping to change at line 485
* one of those members used. * one of those members used.
*/ */
typedef union { typedef union {
/** Holds references, strings, /** Holds references, strings,
* names, dictionaries and arrays * names, dictionaries and arrays
*/ */
PdfDataType* pData; PdfDataType* pData;
bool bBoolValue; bool bBoolValue;
double dNumber; double dNumber;
long nNumber; pdf_int64 nNumber;
} UVariant; } UVariant;
UVariant m_Data; UVariant m_Data;
bool m_bDirty; ///< Indicates if this object was modified after construction bool m_bDirty; ///< Indicates if this object was modified after construction
bool m_bImmutable; ///< Indicates if this object maybe modified
/** 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 532 skipping to change at line 572
// ----------------------------------------------------- // -----------------------------------------------------
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 );
} }
AssertMutable();
m_Data.bBoolValue = b; m_Data.bBoolValue = b;
SetDirty( true ); SetDirty( true );
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
bool PdfVariant::GetBool() const bool PdfVariant::GetBool() const
{ {
DelayedLoad(); DelayedLoad();
skipping to change at line 563 skipping to change at line 604
// ----------------------------------------------------- // -----------------------------------------------------
void PdfVariant::SetNumber( long l ) void PdfVariant::SetNumber( long l )
{ {
DelayedLoad(); DelayedLoad();
if( !IsReal() && !IsNumber() ) if( !IsReal() && !IsNumber() )
{ {
PODOFO_RAISE_ERROR( ePdfError_InvalidDataType ); PODOFO_RAISE_ERROR( ePdfError_InvalidDataType );
} }
AssertMutable();
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 ); SetDirty( true );
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
long PdfVariant::GetNumber() const pdf_int64 PdfVariant::GetNumber() const
{ {
DelayedLoad(); DelayedLoad();
if( !IsReal() && !IsNumber() ) if( !IsReal() && !IsNumber() )
{ {
PODOFO_RAISE_ERROR( ePdfError_InvalidDataType ); PODOFO_RAISE_ERROR( ePdfError_InvalidDataType );
} }
if ( IsReal() ) if ( IsReal() )
return static_cast<long>(floor( m_Data.dNumber )); return static_cast<long>(floor( m_Data.dNumber ));
skipping to change at line 601 skipping to change at line 642
// ----------------------------------------------------- // -----------------------------------------------------
void PdfVariant::SetReal( double d ) void PdfVariant::SetReal( double d )
{ {
DelayedLoad(); DelayedLoad();
if( !IsReal() && !IsNumber() ) if( !IsReal() && !IsNumber() )
{ {
PODOFO_RAISE_ERROR( ePdfError_InvalidDataType ); PODOFO_RAISE_ERROR( ePdfError_InvalidDataType );
} }
AssertMutable();
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 ); SetDirty( true );
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
double PdfVariant::GetReal() const double PdfVariant::GetReal() const
{ {
DelayedLoad(); DelayedLoad();
skipping to change at line 630 skipping to change at line 671
if ( IsReal() ) if ( IsReal() )
return m_Data.dNumber; return m_Data.dNumber;
else else
return static_cast<double>(m_Data.nNumber); return static_cast<double>(m_Data.nNumber);
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
const PdfData & PdfVariant::GetRawData() const
{
DelayedLoad();
if( !IsRawData() )
{
PODOFO_RAISE_ERROR( ePdfError_InvalidDataType );
}
return *(reinterpret_cast<PdfData* const>(m_Data.pData));
}
PdfData & PdfVariant::GetRawData()
{
DelayedLoad();
if( !IsRawData() )
{
PODOFO_RAISE_ERROR( ePdfError_InvalidDataType );
}
return *(reinterpret_cast<PdfData* const>(m_Data.pData));
}
// -----------------------------------------------------
//
// -----------------------------------------------------
const PdfString & PdfVariant::GetString() const const PdfString & PdfVariant::GetString() const
{ {
DelayedLoad(); DelayedLoad();
if( !IsString() && !IsHexString() ) if( !IsString() && !IsHexString() )
{ {
PODOFO_RAISE_ERROR( ePdfError_InvalidDataType ); PODOFO_RAISE_ERROR( ePdfError_InvalidDataType );
} }
return *(reinterpret_cast<PdfString* const>(m_Data.pData)); return *(reinterpret_cast<PdfString* const>(m_Data.pData));
skipping to change at line 873 skipping to change at line 939
case ePdfDataType_RawData: case ePdfDataType_RawData:
case ePdfDataType_Reference: case ePdfDataType_Reference:
case ePdfDataType_Null: case ePdfDataType_Null:
case ePdfDataType_Unknown: case ePdfDataType_Unknown:
default: default:
break; break;
}; };
} }
} }
// -----------------------------------------------------
//
// -----------------------------------------------------
inline void PdfVariant::SetImmutable(bool bImmutable)
{
m_bImmutable = bImmutable;
switch( m_eDataType )
{
case ePdfDataType_Array:
case ePdfDataType_Dictionary:
// Arrays and Dictionaries
// handle dirty status by themselfes
m_Data.pData->SetImmutable( m_bImmutable );
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;
};
}
// -----------------------------------------------------
//
// -----------------------------------------------------
inline bool PdfVariant::GetImmutable() const
{
return m_bImmutable;
}
// -----------------------------------------------------
//
// -----------------------------------------------------
inline void PdfVariant::AssertMutable() const
{
if(m_bImmutable)
{
throw new PdfError( ePdfError_ChangeOnImmutable );
}
}
}; };
#endif // _PDF_VARIANT_H_ #endif // _PDF_VARIANT_H_
 End of changes. 15 change blocks. 
6 lines changed or deleted 123 lines changed or added


 PdfVecObjects.h   PdfVecObjects.h 
skipping to change at line 36 skipping to change at line 36
#include <list> #include <list>
namespace PoDoFo { namespace PoDoFo {
class PdfDocument; class PdfDocument;
class PdfObject; class PdfObject;
class PdfStream; class PdfStream;
class PdfVariant; class PdfVariant;
// slist would be better, but it is not support by default gcc :-( // Use deque as many insertions are here way faster than with using std::li
typedef std::list<PdfReference> TPdfReferenceList; st
// This is especially useful for PDFs like PDFReference17.pdf with
// lot's of free objects.
typedef std::deque<PdfReference> TPdfReferenceList;
typedef TPdfReferenceList::iterator TIPdfReferenceList; typedef TPdfReferenceList::iterator TIPdfReferenceList;
typedef TPdfReferenceList::const_iterator TCIPdfReferenceList; typedef TPdfReferenceList::const_iterator TCIPdfReferenceList;
typedef std::set<PdfReference> TPdfReferenceSet; typedef std::set<PdfReference> TPdfReferenceSet;
typedef TPdfReferenceSet::iterator TIPdfReferenceSet; typedef TPdfReferenceSet::iterator TIPdfReferenceSet;
typedef TPdfReferenceSet::const_iterator TCIPdfReferenceSet; typedef TPdfReferenceSet::const_iterator TCIPdfReferenceSet;
typedef std::list<PdfReference*> TReferencePointerList; typedef std::list<PdfReference*> TReferencePointerList;
typedef TReferencePointerList::iterator TIReferencePointerList; typedef TReferencePointerList::iterator TIReferencePointerList;
typedef TReferencePointerList::const_iterator TCIReferencePointerList; typedef TReferencePointerList::const_iterator TCIReferencePointerList;
skipping to change at line 204 skipping to change at line 206
* \param ref the object to be found * \param ref the object to be found
* \returns the found object or NULL if no object was found. * \returns the found object or NULL if no object was found.
*/ */
PdfObject* GetObject( const PdfReference & ref ) const; PdfObject* GetObject( const PdfReference & ref ) const;
/** Finds the object with the given reference in m_vecOffsets /** Finds the object with the given reference in m_vecOffsets
* and returns the index to it. * and returns the index to it.
* \param ref the object to be found * \param ref the object to be found
* \returns the found object or NULL if no object was found. * \returns the found object or NULL if no object was found.
*/ */
unsigned int GetIndex( const PdfReference & ref ) const; size_t GetIndex( const PdfReference & ref ) const;
/** Remove the object with the given object and generation number from the list /** Remove the object with the given object and generation number from the list
* of objects. * of objects.
* The object is returned if it was found. Otherwise NULL is returned. * The object is returned if it was found. Otherwise NULL is returned.
* The caller has to delete the object by hisself. * The caller has to delete the object by hisself.
* *
* \param ref the object to be found * \param ref the object to be found
* \param bMarkAsFree if true the removed object reference is marked a s free object * \param bMarkAsFree if true the removed object reference is marked a s free object
* you will always want to have this true * you will always want to have this true
* as invalid PDF files can be generated otherwise * as invalid PDF files can be generated otherwise
skipping to change at line 361 skipping to change at line 363
/** Iterator pointing at the end of the vector /** Iterator pointing at the end of the vector
* \returns ending iterator * \returns ending iterator
*/ */
inline TIVecObjects end(); inline TIVecObjects end();
/** Iterator pointing at the end of the vector /** Iterator pointing at the end of the vector
* \returns ending iterator * \returns ending iterator
*/ */
inline TCIVecObjects end() const; inline TCIVecObjects end() const;
inline PdfObject*& operator[](int index); inline PdfObject*& operator[](size_t index);
/** Get the last object in the vector /** Get the last object in the vector
* \returns the last object in the vector or NULL * \returns the last object in the vector or NULL
* if the vector is emtpy. * if the vector is emtpy.
*/ */
inline PdfObject* GetBack(); inline PdfObject* GetBack();
private: private:
/** /**
* \returns the next free object reference * \returns the next free object reference
skipping to change at line 395 skipping to change at line 397
void InsertOneReferenceIntoVector( const PdfObject* pObj, TVecReference PointerList* pList ); void InsertOneReferenceIntoVector( const PdfObject* pObj, TVecReference PointerList* pList );
/** Delete all objects from the vector which do not have references to them selves /** Delete all objects from the vector which do not have references to them selves
* \param pList must be a list created by BuildReferenceCountVector * \param pList must be a list created by BuildReferenceCountVector
* \param pTrailer must be the trailer object so that it is not delete d * \param pTrailer must be the trailer object so that it is not delete d
* \param pNotDelete a list of object which must not be deleted * \param pNotDelete a list of object which must not be deleted
* \see BuildReferenceCountVector * \see BuildReferenceCountVector
*/ */
void GarbageCollection( TVecReferencePointerList* pList, PdfObject* pTr ailer, TPdfReferenceSet* pNotDelete = NULL ); void GarbageCollection( TVecReferencePointerList* pList, PdfObject* pTr ailer, TPdfReferenceSet* pNotDelete = NULL );
/**
* Set the object count so that the object described this reference
* is contained in the object count.
*
* \param rRef reference of newly added object
*/
void SetObjectCount( const PdfReference & rRef );
private: private:
bool m_bAutoDelete; bool m_bAutoDelete;
size_t m_nObjectCount; size_t m_nObjectCount;
bool m_bSorted; bool m_bSorted;
TVecObjects m_vector; TVecObjects m_vector;
TVecObservers m_vecObservers; TVecObservers m_vecObservers;
TPdfReferenceList m_lstFreeObjects; TPdfReferenceList m_lstFreeObjects;
PdfDocument* m_pDocument; PdfDocument* m_pDocument;
skipping to change at line 521 skipping to change at line 531
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline PdfObject* PdfVecObjects::GetBack() inline PdfObject* PdfVecObjects::GetBack()
{ {
return m_vector.back(); return m_vector.back();
} }
inline PdfObject*& PdfVecObjects::operator[](int index) { return m_vector[i // -----------------------------------------------------
ndex]; } //
// -----------------------------------------------------
inline void PdfVecObjects::SetObjectCount( const PdfReference & rRef )
{
if( rRef.ObjectNumber() >= m_nObjectCount )
// Peter Petrov 18 September 2008
{
// This was a bug.
//++m_nObjectCount;
// In fact "m_bObjectCount" is used for the next free object number
.
// We need to use the greatest object number + 1 for the next free
object number.
// Otherwise, object number overlap would have occurred.
m_nObjectCount = rRef.ObjectNumber() + 1;
}
}
// -----------------------------------------------------
//
// -----------------------------------------------------
inline PdfObject*& PdfVecObjects::operator[](size_t index) { return m_vecto
r[index]; }
//inline PdfObject const * & PdfVecObjects::operator[](int index) const { r eturn m_vector[index]; } //inline PdfObject const * & PdfVecObjects::operator[](int index) const { r eturn m_vector[index]; }
}; };
#endif // _PDF_VEC_OBJECTS_H_ #endif // _PDF_VEC_OBJECTS_H_
 End of changes. 5 change blocks. 
6 lines changed or deleted 40 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 PODOFO_VERSION_MAJOR
#define PODOFO_MINOR 7 #define PODOFO_MINOR PODOFO_VERSION_MINOR
#define PODOFO_REVISION 0 #define PODOFO_REVISION PODOFO_VERSION_PATCH
#define PODOFO_VERSION_STRING "0.7.0" #define PODOFO_VERSION_STRING PODOFO_VERSION_STR
#endif #endif
 End of changes. 2 change blocks. 
4 lines changed or deleted 4 lines changed or added


 PdfWriter.h   PdfWriter.h 
skipping to change at line 140 skipping to change at line 140
/** Get the file format version of the pdf /** Get the file format version of the pdf
* \returns the file format version as string * \returns the file format version as string
*/ */
const char* GetPdfVersionString() const { return s_szPdfVersionNums[sta tic_cast<int>(m_eVersion)]; } const char* GetPdfVersionString() const { return s_szPdfVersionNums[sta tic_cast<int>(m_eVersion)]; }
/** Set the written document to be encrypted using a PdfEncrypt object /** Set the written document to be encrypted using a PdfEncrypt object
* *
* \param rEncrypt an encryption object which is used to encrypt the w ritten PDF file * \param rEncrypt an encryption object which is used to encrypt the w ritten PDF file
*/ */
void SetEncrypted( const PdfEncrypt & rEncrypt ) { if( m_pEncrypt ) del ete m_pEncrypt; m_pEncrypt = PdfEncrypt::CreatePdfEncrypt( rEncrypt ); }; void SetEncrypted( const PdfEncrypt & rEncrypt );
/** /**
* \returns true if this PdfWriter creates an encrypted PDF file * \returns true if this PdfWriter creates an encrypted PDF file
*/ */
bool GetEncrypted() const { return (m_pEncrypt != NULL); } bool GetEncrypted() const { return (m_pEncrypt != NULL); }
/** Calculate the byte offset of the object pObject in the PDF file /** Calculate the byte offset of the object pObject in the PDF file
* if the file was written to disk at the moment of calling this funct ion. * if the file was written to disk at the moment of calling this funct ion.
* *
* This function is very calculation intensive! * This function is very calculation intensive!
* *
* \param pObject object to calculate the byte offset (has to be a * \param pObject object to calculate the byte offset (has to be a
* child of this PdfWriter) * child of this PdfWriter)
* \param pulOffset pointer to an unsigned long to save the offset * \param pulOffset pointer to an unsigned long to save the offset
*/ */
void GetByteOffset( PdfObject* pObject, unsigned long* pulOffset ); void GetByteOffset( PdfObject* pObject, pdf_long* pulOffset );
/** Write the whole document to a buffer in memory. /** Write the whole document to a buffer in memory.
* *
* Better use a PdfOutputDevice that writes to a PdfRefCountedBuffer. * Better use a PdfOutputDevice that writes to a PdfRefCountedBuffer.
* *
* \param ppBuffer will be malloc'ed and the document * \param ppBuffer will be malloc'ed and the document
* will be written to this buffer. * will be written to this buffer.
* \param pulLen the length of the buffer will be returned in this par ameter * \param pulLen the length of the buffer will be returned in this par ameter
* \returns ErrOk on success * \returns ErrOk on success
* *
* \see Write * \see Write
*/ */
void WriteToBuffer( char** ppBuffer, unsigned long* pulLen ); void WriteToBuffer( char** ppBuffer, pdf_long* pulLen );
/** Add required keys to a trailer object /** Add required keys to a trailer object
* \param pTrailer add keys to this object * \param pTrailer add keys to this object
* \param lSize number of objects in the PDF file * \param lSize number of objects in the PDF file
* \param bPrevEntry if true a prev entry is added to the trailer obje ct with a value of 0 * \param bPrevEntry if true a prev entry is added to the trailer obje ct with a value of 0
* \param bOnlySizeKey write only the size key * \param bOnlySizeKey write only the size key
*/ */
void FillTrailerObject( PdfObject* pTrailer, long lSize, bool bPrevEntr y, bool bOnlySizeKey ) const; void FillTrailerObject( PdfObject* pTrailer, pdf_long lSize, bool bPrev Entry, bool bOnlySizeKey ) const;
protected: protected:
/** /**
* Create a PdfWriter from a PdfVecObjects * Create a PdfWriter from a PdfVecObjects
*/ */
PdfWriter( PdfVecObjects* pVecObjects ); PdfWriter( PdfVecObjects* pVecObjects );
/** Writes the pdf header to the current file. /** Writes the pdf header to the current file.
* \param pDevice write to this output device * \param pDevice write to this output device
*/ */
skipping to change at line 274 skipping to change at line 274
bool m_bLinearized; bool m_bLinearized;
/** /**
* This value is required when writing * This value is required when writing
* a linearized PDF file. * a linearized PDF file.
* It represents the offset of the whitespace * It represents the offset of the whitespace
* character before the first line in the XRef * character before the first line in the XRef
* section. * section.
*/ */
long m_lFirstInXRef; size_t m_lFirstInXRef;
long m_lLinearizedOffset; size_t m_lLinearizedOffset;
long m_lLinearizedLastOffset; size_t m_lLinearizedLastOffset;
long m_lTrailerOffset; size_t m_lTrailerOffset;
PdfVecObjects m_vecLinearized; PdfVecObjects m_vecLinearized;
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
void PdfWriter::SetLinearized( bool bLinearize ) void PdfWriter::SetLinearized( bool bLinearize )
{ {
m_bLinearized = bLinearize; m_bLinearized = bLinearize;
} }
 End of changes. 5 change blocks. 
8 lines changed or deleted 8 lines changed or added


 PdfXObject.h   PdfXObject.h 
skipping to change at line 52 skipping to change at line 52
* *
* \see PdfPainter * \see PdfPainter
*/ */
class PODOFO_API PdfXObject : public PdfElement, public PdfCanvas { class PODOFO_API PdfXObject : public PdfElement, public PdfCanvas {
public: public:
/** Create a new XObject with a specified dimension /** Create a new XObject with a specified dimension
* in a given document * in a given document
* *
* \param rRect the size of the XObject * \param rRect the size of the XObject
* \param pParent the parent document of the XObject * \param pParent the parent document of the XObject
* \param pszPrefix optional prefix for XObject-name
*/ */
PdfXObject( const PdfRect & rRect, PdfDocument* pParent ); PdfXObject( const PdfRect & rRect, PdfDocument* pParent, const char* ps zPrefix = NULL );
/** Create a new XObject with a specified dimension /** Create a new XObject with a specified dimension
* in a given vector of PdfObjects * in a given vector of PdfObjects
* *
* \param rRect the size of the XObject * \param rRect the size of the XObject
* \param pParent the parent vector of the XObject * \param pParent the parent vector of the XObject
* \param pszPrefix optional prefix for XObject-name
*/ */
PdfXObject( const PdfRect & rRect, PdfVecObjects* pParent ); PdfXObject( const PdfRect & rRect, PdfVecObjects* pParent, const char* pszPrefix = NULL );
/** Create a new XObject from a page of another document /** Create a new XObject from a page of another document
* in a given document * in a given document
* *
* \param rDoc the document to create the XObject from * \param rDoc the document to create the XObject from
* \param nPage the page-number in rDoc to create the XObject from * \param nPage the page-number in rDoc to create the XObject from
* \param pParent the parent document of the XObject * \param pParent the parent document of the XObject
* \param pszPrefix optional prefix for XObject-name
*/ */
PdfXObject( const PdfMemDocument & rSourceDoc, int nPage, PdfDocument* pParent ); PdfXObject( const PdfMemDocument & rSourceDoc, int nPage, PdfDocument* pParent, const char* pszPrefix = NULL );
/** Create a XObject from an existing PdfObject /** Create a XObject from an existing PdfObject
* *
* \param pObject an existing object which has to be * \param pObject an existing object which has to be
* a XObject * a XObject
*/ */
PdfXObject( PdfObject* pObject ); PdfXObject( PdfObject* pObject );
virtual ~PdfXObject() { } virtual ~PdfXObject() { }
skipping to change at line 128 skipping to change at line 131
* without having to access the PdfObject. * without having to access the PdfObject.
* *
* This allows to work with XObjects which have been * This allows to work with XObjects which have been
* written to disk already. * written to disk already.
* *
* \returns the reference of the PdfObject for this XObject * \returns the reference of the PdfObject for this XObject
*/ */
inline const PdfReference & GetObjectReference() const; inline const PdfReference & GetObjectReference() const;
protected: protected:
void InitXObject( const PdfRect & rRect ); void InitXObject( const PdfRect & rRect, const char* pszPrefix = NULL ) ;
PdfXObject( const char* pszSubType, PdfDocument* pParent ); PdfXObject( const char* pszSubType, PdfDocument* pParent, const char* p
PdfXObject( const char* pszSubType, PdfVecObjects* pParent ); szPrefix = NULL );
PdfXObject( const char* pszSubType, PdfVecObjects* pParent, const char*
pszPrefix = NULL );
PdfXObject( const char* pszSubType, PdfObject* pObject ); PdfXObject( const char* pszSubType, PdfObject* pObject );
protected: protected:
PdfRect m_rRect; PdfRect m_rRect;
private: private:
static PdfArray s_matrix; static PdfArray s_matrix;
PdfObject* m_pResources; PdfObject* m_pResources;
 End of changes. 8 change blocks. 
6 lines changed or deleted 11 lines changed or added


 PdfXRef.h   PdfXRef.h 
skipping to change at line 42 skipping to change at line 42
class PdfOutputDevice; class PdfOutputDevice;
/** /**
* Creates an XRef table. * Creates an XRef table.
* *
* This is an internal class of PoDoFo used by PdfWriter. * This is an internal class of PoDoFo used by PdfWriter.
*/ */
class PdfXRef { class PdfXRef {
protected: protected:
struct TXRefItem{ struct TXRefItem{
TXRefItem( const PdfReference & rRef, const long & rlOff ) TXRefItem( const PdfReference & rRef, const pdf_uint64 & off )
: reference( rRef ), lOffset( rlOff ) : reference( rRef ), offset( off )
{ {
} }
PdfReference reference; PdfReference reference;
long lOffset; pdf_uint64 offset;
bool operator<( const TXRefItem & rhs ) const bool operator<( const TXRefItem & rhs ) const
{ {
return this->reference < rhs.reference; return this->reference < rhs.reference;
} }
}; };
typedef std::vector<TXRefItem> TVecXRefItems; typedef std::vector<TXRefItem> TVecXRefItems;
typedef TVecXRefItems::iterator TIVecXRefItems; typedef TVecXRefItems::iterator TIVecXRefItems;
typedef TVecXRefItems::const_iterator TCIVecXRefItems; typedef TVecXRefItems::const_iterator TCIVecXRefItems;
skipping to change at line 95 skipping to change at line 95
{ {
m_nFirst = rhs.m_nFirst; m_nFirst = rhs.m_nFirst;
m_nCount = rhs.m_nCount; m_nCount = rhs.m_nCount;
items = rhs.items; items = rhs.items;
freeItems = rhs.freeItems; freeItems = rhs.freeItems;
return *this; return *this;
} }
unsigned long m_nFirst; pdf_objnum m_nFirst;
unsigned long m_nCount; pdf_uint32 m_nCount;
TVecXRefItems items; TVecXRefItems items;
TVecReferences freeItems; TVecReferences freeItems;
}; };
typedef std::vector<PdfXRefBlock> TVecXRefBlock; typedef std::vector<PdfXRefBlock> TVecXRefBlock;
typedef TVecXRefBlock::iterator TIVecXRefBlock; typedef TVecXRefBlock::iterator TIVecXRefBlock;
typedef TVecXRefBlock::const_iterator TCIVecXRefBlock; typedef TVecXRefBlock::const_iterator TCIVecXRefBlock;
public: public:
skipping to change at line 119 skipping to change at line 119
PdfXRef(); PdfXRef();
/** Destruct the XRef table /** Destruct the XRef table
*/ */
virtual ~PdfXRef(); virtual ~PdfXRef();
/** Add an object to the XRef table. /** Add an object to the XRef table.
* The object should have been written to an output device already. * The object should have been written to an output device already.
* *
* \param rRef reference of this object * \param rRef reference of this object
* \param lOffset the offset where on the device the object was writte n * \param offset the offset where on the device the object was written
* \param bUsed specifies wether this is an used or free object. * \param bUsed specifies wether this is an used or free object.
* Set this value to true for all normal objects and to f alse * Set this value to true for all normal objects and to f alse
* for free object references. * for free object references.
*/ */
void AddObject( const PdfReference & rRef, long lOffset, bool bUsed ); void AddObject( const PdfReference & rRef, pdf_uint64 offset, bool bUse d );
/** Write the XRef table to an output device. /** Write the XRef table to an output device.
* *
* \param pDevice an output device (usually a PDF file) * \param pDevice an output device (usually a PDF file)
* *
*/ */
void Write( PdfOutputDevice* pDevice ); void Write( PdfOutputDevice* pDevice );
/** Get the size of the XRef table. /** Get the size of the XRef table.
* I.e. the highest object number + 1. * I.e. the highest object number + 1.
* *
* \returns the size of the xref table * \returns the size of the xref table
*/ */
unsigned int GetSize() const; pdf_uint32 GetSize() const;
/** /**
* \returns the offset in the file at which the XRef table * \returns the offset in the file at which the XRef table
* starts after it was written * starts after it was written
*/ */
inline virtual size_t GetOffset() const; inline virtual pdf_uint64 GetOffset() const;
protected: protected:
/** Called at the start of writing the XRef table. /** Called at the start of writing the XRef table.
* This method can be overwritten in subclasses * This method can be overwritten in subclasses
* to write a general header for the XRef table. * to write a general header for the XRef table.
* *
* @param pDevice the output device to which the XRef table * @param pDevice the output device to which the XRef table
* should be written. * should be written.
*/ */
virtual void BeginWrite( PdfOutputDevice* pDevice ); virtual void BeginWrite( PdfOutputDevice* pDevice );
/** Begin an XRef subsection. /** Begin an XRef subsection.
* All following calls of WriteXRefEntry belong to this XRef subsectio n. * All following calls of WriteXRefEntry belong to this XRef subsectio n.
* *
* @param pDevice the output device to which the XRef table * @param pDevice the output device to which the XRef table
* should be written. * should be written.
* @param nFirst the object number of the first object in this subsect ion * @param nFirst the object number of the first object in this subsect ion
* @param nCount the number of entries in this subsection * @param nCount the number of entries in this subsection
*/ */
virtual void WriteSubSection( PdfOutputDevice* pDevice, unsigned int nF irst, unsigned int nCount ); virtual void WriteSubSection( PdfOutputDevice* pDevice, pdf_objnum nFir st, pdf_uint32 nCount );
/** Write a single entry to the XRef table /** Write a single entry to the XRef table
* *
* @param pDevice the output device to which the XRef table * @param pDevice the output device to which the XRef table
* should be written. * should be written.
* @param lOffset the offset of the object * @param offset the offset of the object
* @param lGeneration the generation number * @param generation the generation number
* @param cMode the mode 'n' for object and 'f' for free objects * @param cMode the mode 'n' for object and 'f' for free objects
* @param lObjectNumber the object number of the currently written obj ect if cMode = 'n' * @param objectNumber the object number of the currently written obje ct if cMode = 'n'
* otherwise undefined * otherwise undefined
*/ */
virtual void WriteXRefEntry( PdfOutputDevice* pDevice, unsigned long lO virtual void WriteXRefEntry( PdfOutputDevice* pDevice, pdf_uint64 offse
ffset, unsigned long lGeneration, t, pdf_gennum generation,
char cMode, unsigned long lObjectNumber = char cMode, pdf_objnum objectNumber = 0 );
0 );
/** Called at the end of writing the XRef table. /** Called at the end of writing the XRef table.
* Sub classes can overload this method to finish a XRef table. * Sub classes can overload this method to finish a XRef table.
* *
* @param pDevice the output device to which the XRef table * @param pDevice the output device to which the XRef table
* should be written. * should be written.
*/ */
virtual void EndWrite( PdfOutputDevice* pDevice ); virtual void EndWrite( PdfOutputDevice* pDevice );
private: private:
skipping to change at line 200 skipping to change at line 200
/** Merge all xref blocks that follow immediately after each other /** Merge all xref blocks that follow immediately after each other
* into a single block. * into a single block.
* *
* This results in slitely smaller PDF files which are easier to parse * This results in slitely smaller PDF files which are easier to parse
* for other applications. * for other applications.
*/ */
void MergeBlocks(); void MergeBlocks();
private: private:
long m_lOffset; pdf_uint64 m_offset;
protected: protected:
TVecXRefBlock m_vecBlocks; TVecXRefBlock m_vecBlocks;
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline size_t PdfXRef::GetOffset() const inline pdf_uint64 PdfXRef::GetOffset() const
{ {
return m_lOffset; return m_offset;
} }
}; };
#endif /* _PDF_XREF_H_ */ #endif /* _PDF_XREF_H_ */
 End of changes. 14 change blocks. 
20 lines changed or deleted 19 lines changed or added


 PdfXRefStream.h   PdfXRefStream.h 
skipping to change at line 61 skipping to change at line 61
PdfXRefStream( PdfVecObjects* pParent, PdfWriter* pWriter ); PdfXRefStream( PdfVecObjects* pParent, PdfWriter* pWriter );
/** Destruct the XRef table /** Destruct the XRef table
*/ */
virtual ~PdfXRefStream(); virtual ~PdfXRefStream();
/** /**
* \returns the offset in the file at which the XRef table * \returns the offset in the file at which the XRef table
* starts after it was written * starts after it was written
*/ */
inline virtual size_t GetOffset() const; inline virtual pdf_uint64 GetOffset() const;
protected: protected:
/** Called at the start of writing the XRef table. /** Called at the start of writing the XRef table.
* This method can be overwritten in subclasses * This method can be overwritten in subclasses
* to write a general header for the XRef table. * to write a general header for the XRef table.
* *
* @param pDevice the output device to which the XRef table * @param pDevice the output device to which the XRef table
* should be written. * should be written.
*/ */
virtual void BeginWrite( PdfOutputDevice* pDevice ); virtual void BeginWrite( PdfOutputDevice* pDevice );
/** Begin an XRef subsection. /** Begin an XRef subsection.
* All following calls of WriteXRefEntry belong to this XRef subsectio n. * All following calls of WriteXRefEntry belong to this XRef subsectio n.
* *
* @param pDevice the output device to which the XRef table * @param pDevice the output device to which the XRef table
* should be written. * should be written.
* @param nFirst the object number of the first object in this subsect ion * @param nFirst the object number of the first object in this subsect ion
* @param nCount the number of entries in this subsection * @param nCount the number of entries in this subsection
*/ */
virtual void WriteSubSection( PdfOutputDevice* pDevice, unsigned int nF irst, unsigned int nCount ); virtual void WriteSubSection( PdfOutputDevice* pDevice, pdf_objnum nFir st, pdf_uint32 nCount );
/** Write a single entry to the XRef table /** Write a single entry to the XRef table
* *
* @param pDevice the output device to which the XRef table * @param pDevice the output device to which the XRef table
* should be written. * should be written.
* @param lOffset the offset of the object * @param offset the offset of the object
* @param lGeneration the generation number * @param generation the generation number
* @param cMode the mode 'n' for object and 'f' for free objects * @param cMode the mode 'n' for object and 'f' for free objects
* @param lObjectNumber the object number of the currently written obj ect if cMode = 'n' * @param objectNumber the object number of the currently written obje ct if cMode = 'n'
* otherwise undefined * otherwise undefined
*/ */
virtual void WriteXRefEntry( PdfOutputDevice* pDevice, unsigned long lO virtual void WriteXRefEntry( PdfOutputDevice* pDevice, pdf_uint64 offse
ffset, unsigned long lGeneration, t, pdf_uint16 generation,
char cMode, unsigned long lObjectNumber = char cMode, pdf_objnum objectNumber = 0 );
0 );
/** Called at the end of writing the XRef table. /** Called at the end of writing the XRef table.
* Sub classes can overload this method to finish a XRef table. * Sub classes can overload this method to finish a XRef table.
* *
* @param pDevice the output device to which the XRef table * @param pDevice the output device to which the XRef table
* 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;
size_t m_lBufferLen; ///< The length of the internal buffer for size_t m_bufferLen; ///< The length of the internal buffer for
one XRef entry one XRef entry
long m_lOffset; ///< Offset of the XRefStream object pdf_uint64 m_offset; ///< Offset of the XRefStream object
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline size_t PdfXRefStream::GetOffset() const inline pdf_uint64 PdfXRefStream::GetOffset() const
{ {
return m_lOffset; return m_offset;
} }
}; };
#endif /* _PDF_XREF_H_ */ #endif /* _PDF_XREF_H_ */
 End of changes. 8 change blocks. 
14 lines changed or deleted 13 lines changed or added


 podofo.h   podofo.h 
skipping to change at line 77 skipping to change at line 77
#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"
#include "PdfOutputDevice.h" #include "PdfOutputDevice.h"
#include "PdfPage.h" #include "PdfPage.h"
#include "PdfPagesTree.h" #include "PdfPagesTree.h"
#include "PdfPagesTreeCache.h"
#include "PdfPainter.h" #include "PdfPainter.h"
#include "PdfPainterMM.h" #include "PdfPainterMM.h"
#include "PdfParser.h" #include "PdfParser.h"
#include "PdfParserObject.h" #include "PdfParserObject.h"
#include "PdfRect.h" #include "PdfRect.h"
#include "PdfRefCountedBuffer.h" #include "PdfRefCountedBuffer.h"
#include "PdfRefCountedInputDevice.h" #include "PdfRefCountedInputDevice.h"
#include "PdfShadingPattern.h" #include "PdfShadingPattern.h"
#include "PdfStream.h" #include "PdfStream.h"
#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 "PdfVersion.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 "PdfXRefStreamParserObject.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. 3 change blocks. 
2 lines changed or deleted 3 lines changed or added


 podofoapi.h   podofoapi.h 
skipping to change at line 65 skipping to change at line 65
* http://gcc.gnu.org/onlinedocs/gcc-4.0.0/gcc/Type-Attributes.html * http://gcc.gnu.org/onlinedocs/gcc-4.0.0/gcc/Type-Attributes.html
* *
* including __attribute__((deprecated)) for deprecating old interfaces. * including __attribute__((deprecated)) for deprecating old interfaces.
* (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)
* *
*/ */
// Peter Petrov 26 April 2008
/* 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_EXPORTS)
#define COMPILING_SHARED_PODOFO #define COMPILING_SHARED_PODOFO
#undef USING_SHARED_PODOFO #undef USING_SHARED_PODOFO
#endif #endif
/* Automatically defined by CMake when building a shared library */
#if defined(podofo_shared_EXPORTS)
#define COMPILING_SHARED_PODOFO
#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.
* *
* Building or linking to a static library does not require either * Building or linking to a static library does not require either
skipping to change at line 95 skipping to change at line 101
#define PODOFO_API __declspec(dllexport) #define PODOFO_API __declspec(dllexport)
#elif defined(USING_SHARED_PODOFO) #elif defined(USING_SHARED_PODOFO)
#define PODOFO_API __declspec(dllimport) #define PODOFO_API __declspec(dllimport)
#else #else
#define PODOFO_API #define PODOFO_API
#endif #endif
/* PODOFO_LOCAL doesn't mean anything on win32, it's to exclude /* PODOFO_LOCAL doesn't mean anything on win32, it's to exclude
* symbols from the export table with gcc4. */ * symbols from the export table with gcc4. */
#define PODOFO_LOCAL #define PODOFO_LOCAL
#else #else
#if defined(HAVE_GCC_SYMBOL_VISIBILITY) #if defined(PODOFO_HAVE_GCC_SYMBOL_VISIBILITY)
/* Forces inclusion of a symbol in the symbol table, so /* Forces inclusion of a symbol in the symbol table, so
software outside the current library can use it. */ software outside the current library can use it. */
#define PODOFO_API __attribute__ ((visibility("default"))) #define PODOFO_API __attribute__ ((visibility("default")))
/* Within a section exported with PODOFO_API, forces a symbol to be /* Within a section exported with PODOFO_API, forces a symbol to be
private to the library / app. Good for private members. */ private to the library / app. Good for private members. */
#define PODOFO_LOCAL __attribute__ ((visibility("hidden"))) #define PODOFO_LOCAL __attribute__ ((visibility("hidden")))
/* Forces even stricter hiding of methods/functions. The function m ust /* Forces even stricter hiding of methods/functions. The function m ust
* absolutely never be called from outside the module even via a fu nction * absolutely never be called from outside the module even via a fu nction
* pointer.*/ * pointer.*/
#define PODOFO_INTERNAL __attribute__ ((visibility("internal"))) #define PODOFO_INTERNAL __attribute__ ((visibility("internal")))
skipping to change at line 118 skipping to change at line 124
#define PODOFO_LOCAL #define PODOFO_LOCAL
#define PODOFO_INTERNAL #define PODOFO_INTERNAL
#endif #endif
#endif #endif
/* Throwable classes must always be exported by all binaries when /* Throwable classes must always be exported by all binaries when
* using gcc. Marking exception classes with PODOFO_EXCEPTION_API * using gcc. Marking exception classes with PODOFO_EXCEPTION_API
* ensures this. */ * ensures this. */
#ifdef _WIN32 #ifdef _WIN32
#define PODOFO_EXCEPTION_API(api) api #define PODOFO_EXCEPTION_API(api) api
#elif defined(HAVE_GCC_SYMBOL_VISIBILITY) #elif defined(PODOFO_HAVE_GCC_SYMBOL_VISIBILITY)
#define PODOFO_EXCEPTION_API(api) PODOFO_API #define PODOFO_EXCEPTION_API(api) PODOFO_API
#else #else
#define PODOFO_EXCEPTION_API(api) #define PODOFO_EXCEPTION_API(api)
#endif #endif
/* Set up some other compiler-specific but not platform-specific macros */ /* Set up some other compiler-specific but not platform-specific macros */
#if defined(__GNUC__) #if defined(__GNUC__)
/* gcc will issue a warning if a function or variable so annotated is u sed */ /* gcc will issue a warning if a function or variable so annotated is u sed */
#define PODOFO_DEPRECATED __attribute__((deprecated)) #define PODOFO_DEPRECATED __attribute__((deprecated))
skipping to change at line 143 skipping to change at line 149
* guaranteed not to throw. If it does throw, undefined behaviour will result, * guaranteed not to throw. If it does throw, undefined behaviour will result,
* so be VERY careful with this. This is NOT the same as the PODOFO_NOT HROW qualifier * so be VERY careful with this. This is NOT the same as the PODOFO_NOT HROW qualifier
* (see CODINGSTYLE.txt) .*/ * (see CODINGSTYLE.txt) .*/
#define PODOFO_NOTHROW __attribute__((nothrow)) #define PODOFO_NOTHROW __attribute__((nothrow))
#else #else
#define PODOFO_DEPRECATED #define PODOFO_DEPRECATED
#define PODOFO_PURE_FUNCTION #define PODOFO_PURE_FUNCTION
#define PODOFO_NOTHROW __declspec(nothrow) #define PODOFO_NOTHROW __declspec(nothrow)
#endif #endif
// Peter Petrov 27 April 2008
// Disable warnings
#ifdef _WIN32
#pragma warning(disable: 4251)
#pragma warning(disable: 4309)
#endif // _WIN32
#endif // PODOFO_API_H #endif // PODOFO_API_H
 End of changes. 6 change blocks. 
3 lines changed or deleted 16 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/