For being able to sign a PDF using its existing signature field, I added this 
constructor to PdfSignatureField.cpp:

60c60,71
< void PdfSignatureField::SetAppearanceStream( PdfXObject* pObject )
---
> PdfSignatureField::PdfSignatureField( const PdfField & rhs )
>     : PdfField( rhs )
> {
>     if( this->GetType() != ePdfField_Signature )
>     {
>         PODOFO_RAISE_ERROR_INFO( ePdfError_InvalidDataType, "Field cannot be 
> converted into a PdfSignatureField" );
>     }
>     m_pSignatureObj = NULL;
>     Init();
> }

Hopefully i haven“t overlooked any options to sign a PDF without creating a new 
signature field?

Additionally  i changed PdfOutputDevice.cpp the following way:

59c57
<             std::fstream *pStream = new std::fstream(pszFilename, 
std::fstream::binary|std::ios_base::in | std::ios_base::out | 
std::ios_base::trunc);
---
>             std::fstream *pStream = new std::fstream(pszFilename, 
> std::fstream::binary|std::ios_base::in | std::ios_base::out);

Otherwise, it would delete the file at opening.

Please let me know if there is a way to sign an existing file without changing 
PoDoFo. If no, is it possible to take this changes into the next revision?

Regards
Thomas
------------------------------------------------------------------------------
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to