I'm not sure if this is the intended behavior or not, but the attached
podofo-producer.cpp will try to read the Producer of a PdfMemDocument
(as specified as the first argument), but will read PoDoFo as the
producer. producer.diff changes this behavior, but I understand that it
may be intentional.
-Mike Slegeir
Index: src/PdfInfo.h
===================================================================
--- src/PdfInfo.h (revision 1135)
+++ src/PdfInfo.h (working copy)
@@ -38,13 +38,13 @@
/** Create a new PdfInfo object
* \param pParent the parent of this object
*/
- PdfInfo( PdfVecObjects* pParent );
+ PdfInfo( PdfVecObjects* pParent, bool bModify = false );
/** Create a PdfInfo object from an existing
* object in the PDF file.
* \param pObject must be an info dictionary.
*/
- PdfInfo( PdfObject* pObject );
+ PdfInfo( PdfObject* pObject, bool bModify = true );
/** Destructor
*/
Index: src/PdfInfo.cpp
===================================================================
--- src/PdfInfo.cpp (revision 1135)
+++ src/PdfInfo.cpp (working copy)
@@ -29,16 +29,16 @@
namespace PoDoFo {
-PdfInfo::PdfInfo( PdfVecObjects* pParent )
+PdfInfo::PdfInfo( PdfVecObjects* pParent, bool bModify )
: PdfElement( NULL, pParent )
{
- Init( false );
+ Init( bModify );
}
-PdfInfo::PdfInfo( PdfObject* pObject )
+PdfInfo::PdfInfo( PdfObject* pObject, bool bModify )
: PdfElement( NULL, pObject )
{
- Init( true );
+ Init( bModify );
}
PdfInfo::~PdfInfo()
@@ -53,6 +53,7 @@
date.ToString( str );
m_pObject->GetDictionary().AddKey( bModify ? "ModDate" : "CreationDate", str );
+ if(bModify)
m_pObject->GetDictionary().AddKey( "Producer", PdfString( PRODUCER_STRING) );
}
Index: src/PdfMemDocument.cpp
===================================================================
--- src/PdfMemDocument.cpp (revision 1135)
+++ src/PdfMemDocument.cpp (working copy)
@@ -123,7 +123,7 @@
pTrailer->GetDictionary().AddKey( "Info", pInfoObj->GetObject()->Reference() );
}
else
- pInfoObj = new PdfInfo( pInfo );
+ pInfoObj = new PdfInfo( pInfo, false );
if( pParser->GetEncrypted() )
{
#include <podofo/podofo.h>
#include <iostream>
int main(int argc, char* argv[]){
PoDoFo::PdfMemDocument doc(argv[1]);
PoDoFo::PdfInfo* info = doc.GetInfo();
std::cout << "Produced by " << info->GetProducer().GetString() << std::endl;
return 0;
}
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Podofo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/podofo-users