If a PDF contains annotations (be they form fields/widgets or others) and no 
appearance dictionary (/AP) is provided, then you use the NeedAppearances key 
to inform the viewer that it needs to construct them. However, in order for the 
viewer to create them, it has to modify the PDF by adding all the new objects.  
And having all these new objects, breaks the signature.   It’s one of many 
reasons why appearances are required in all the subset standards – and is also 
now required in PDF 2.0 files!!

So the best thing here is to add appearance generation functionality and then 
invoke it as part of Signing.

Leonard

On 11/16/16, 10:22 AM, "zyx" <z...@litepdf.cz> wrote:

    On Mon, 2016-09-26 at 15:32 +0000, Thomas Szendefi wrote:
    > Leonard kindly checked the generated PDF for me and found out that
    > the code is not adding the signatures annotation to the page.
    
        Hello,
    that was one of the issues, that's true. Unfortunately it wasn't the
    only one.
    
    I made some semi-extensive changes in the PoDoFo trunk code recently,
    currently ending at revision 1790, where I removed the obsolete
    PdfSigInc* API. There were many issues with it, as you noticed, apart
    of being a very single-purpose API and very hard to extend. I replaced
    it with something fully generic. That is:
    
    * PdfMemDocument can load existing documents for incremental updates
    now (the Load() methods received a new optional argument pForUpdate),
    and such loaded documents can be saved using a new WriteUpdate() method
    (instead of Write()), to save an incremental update, instead of a full
    file rewrite. This way the incremental signing happens in the same way
    as before, with all the freedom what would be included in the drawing
    and what not, you only call WriteUpdate() instead of Write() at the end
    and that's all (+ you Load() the document with bForUpdate = true, of
    course).
    
    * I added a tool named 'podofosign' (tools/podofosign/podofosign.cpp),
    which can be used to sign existing PDF files. It serves also as an
    example of "how the things work in PoDoFo".
    
    The signing happens better with the incremental update, specifically
    for the linearized documents or documents with XRef streams, because
    such were resaved silently in the background, which doesn't conform as
    an incremental update.
    
    I also checked the testrun.pdf file you sent me on 2016-09-29 with the
    new code and it "fails" to show the added signature annotation, despite
    it being properly added into the page and the AcroForm. I tracked the
    issue down to AcroForm's "/NeedAppearances true" key. When I remove it,
    then the Acrobat Reader will show the added annotation (and will claim
    that the document had been modified since it had been signed, the same
    as all the default values in the form are gone, thus the form is all
    empty).
    
    I'd appreciate any insight on the /NeedAppearances key with respect of
    the signature fields, because I didn't find anything useful in
    the PDF 1.7 reference/specification (the word as such is only twice in
    the document (excluding the Index), and its description references only
    'Variable Text' fields, which is not a Sig, right?).
    
        Bye,
        zyx
    
    -- 
    http://www.litePDF.cz                                 i...@litepdf.cz
    
    
------------------------------------------------------------------------------
    _______________________________________________
    Podofo-users mailing list
    Podofo-users@lists.sourceforge.net
    https://lists.sourceforge.net/lists/listinfo/podofo-users
    

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

Reply via email to