Hi,

I'm trying to create a new pdf and sign it.
I'm using the latest version of Podofo, downloaded today on 17.3.2024.
I have manged to follow the "hello world" documentation to create a new doc.
I am trying to follow examples provided in [tests](https://github.com/podofo/podofo/blob/master/test/unit/SignatureTest.cpp) , as instructed in [issue 143](https://github.com/podofo/podofo/issues/143#issuecomment-2001945081),
but in those examples, it is assumed that the document already has an annotation for signatures, which mine does not have, 
thus its no surprise that annot = FirstPage.GetAnnotations().GetAnnotAt(0); fails with PdfErrorCode::ValueOutOfRange.
( i do not load the generated document from disk, I continue using the variable after FinishDrawing,GetMetadata().Set,Save)

I have tried to create one using :
PoDoFo::Rect AnnoRect(0,0,100,50);
PoDoFo::PdfAnnotation & annot = FirstPage.GetAnnotations().CreateAnnot(PoDoFo::PdfAnnotationType::Widget,AnnoRect);
PoDoFo::PdfField & field = dynamic_cast<PoDoFo::PdfAnnotationWidget&>(annot).GetField();
PoDoFo::PdfSignature & signature = dynamic_cast<PoDoFo::PdfSignature&>(field);

but the last statement, fails with std::bad_cast.

:-)




please provide instructions on how to create a PdfSignature
This is a GitHub Issue
repo:podofo
owner:podofo
Title : please provide instructions on how to create a PdfSignature
Issue date:

--- start body ---
Hi,

I'm trying to create a new pdf and sign it.
I'm using the latest version of Podofo, downloaded today on 17.3.2024.
I have manged to follow the "hello world" documentation to create a new doc.
I am trying to follow examples provided in [tests](https://github.com/podofo/podofo/blob/master/test/unit/SignatureTest.cpp) , as instructed in [issue 143](https://github.com/podofo/podofo/issues/143#issuecomment-2001945081),
but in those examples, it is assumed that the document already has an annotation for signatures, which mine does not have, 
thus its no surprise that annot = FirstPage.GetAnnotations().GetAnnotAt(0); fails with PdfErrorCode::ValueOutOfRange.
( i do not load the generated document from disk, I continue using the variable after FinishDrawing,GetMetadata().Set,Save)

I have tried to create one using :
PoDoFo::Rect AnnoRect(0,0,100,50);
PoDoFo::PdfAnnotation & annot = FirstPage.GetAnnotations().CreateAnnot(PoDoFo::PdfAnnotationType::Widget,AnnoRect);
PoDoFo::PdfField & field = dynamic_cast<PoDoFo::PdfAnnotationWidget&>(annot).GetField();
PoDoFo::PdfSignature & signature = dynamic_cast<PoDoFo::PdfSignature&>(field);

but the last statement, fails with std::bad_cast.

:-)




--- end body ---
