Olá pessoal,
estou tentando adicionar duas assinaturas digitais em um único arquivo PDF utilizando a biblioteca Aspose.PDF, porém estou enfrentando dificuldades.
Consegui inserir a primeira assinatura sem problemas, mas ao tentar adicionar a segunda, o PDF resultante fica corrompido ou a segunda assinatura substitui a primeira. Já tentei criar novos campos de assinatura e também assinar incrementalmente, mas não funcionou como esperado.
Alguém já conseguiu inserir múltiplas assinaturas digitais em um PDF usando Aspose.PDF?
Qual é o procedimento correto ou um exemplo funcional em C#/Java para criar dois campos de assinatura e assiná-los separadamente?
Summary
Aspose.PDF can add more than one digital signature to the same PDF, but each signature must be placed in its own signature field and the document has to be saved incrementally (append mode) after each signing operation. A full rewrite of the PDF overwrites earlier signatures and can corrupt the file.
Why it happens
In a PDF each digital signature is stored as a separate object. When the file is saved with a full rewrite the existing signature objects are replaced, so a later signing operation removes the previous one.
The default Save operation in Aspose.PDF writes a new file. To preserve earlier signatures you need to use incremental (append) saving and give each signature field a unique name.
What to do next
Open the original PDF and add a signature field (e.g., Signature1).
Sign that field using a PdfSignature (or equivalent) object.
Save the PDF with incremental/append mode enabled.
Reload the newly saved PDF, add a second signature field (e.g., Signature2).
Sign the second field and again save with incremental/append mode.
Checklist
Ensure each signature field has a distinct name.
Verify that the save operation is performed in append (incremental) mode for both signing steps.
After the final save, open the PDF in a viewer such as Adobe Acrobat/Reader and confirm that both signatures appear in the signature panel.
If you encounter issues, consult the Aspose.PDF documentation for the exact property/method to enable incremental saving (e.g., AppendMode in .NET or setAppendMode(true) in Java) and for examples of creating signature fields.
Note: The answer is based on general PDF signing principles and typical Aspose.PDF usage patterns; please verify the exact API names and options in the version of Aspose.PDF you are using.
I could not fully verify this explanation against the retrieved sources. Please double-check the behaviour in your environment and confirm the exact SDK/version.
Poderia, por gentileza, compartilhar seu arquivo PDF de exemplo e o trecho de código que você tem utilizado? Testaremos o cenário em nosso ambiente e o abordaremos adequadamente.
Obrigado por compartilhar o trecho de código de exemplo. Você poderia, por favor, compartilhar arquivos PDF e PFX de exemplo para nossa referência também?
Você pode compartilhar arquivos confidenciais em uma mensagem privada, onde apenas a equipe da Aspose tem acesso. Garantimos que utilizamos os arquivos apenas para fins de teste e, assim que a investigação for concluída, os removemos do nosso sistema.
Você pode enviar uma mensagem privada clicando no nome de usuário e pressionando o botão azul de mensagem.