Beginning with Xojo 2022r1 you can use Xojo’s newPDFSignature
Form Control in your PDFDocuments. Using this allows your users to be able to sign documents using a Digital Certificate. Read on to learn how…
Once the document has been signed and saved to disk, anyone opening the document will be able to check if the signature on the document is still valid or if, on the contrary, there have been changes to the documents after it was signed.
Adding signing controls to a PDF Document with this code:
Var d As New PDFDocument // Creating a new PDFSignature instance Var signatureField As PDFSignature = New PDFSignature(1, X, Y, Width, Height, "SignatureField") // …and adding it to the Form controls in the PDFDocument instance d.AddControl(signatureField)
As you can see, you need to create a new instance from the PDFSignature
class providing to the Constructor
method the page number, X and Y coordinates, and the width and height values for the interactive signing box.
These screenshots show a PDF document with a PDFSignature
control added before it has been signed (on the left), and after it has been signed using a Digital Certificate (on the right). The project that produced the example below is included in the Example Projects folder in the Xojo download.
Lastly, and as it happens with many other features of the PDF format specification, the ability to digitally sign the PDF documents created with the PDFDocument
class is up to the PDF viewer you use. For example, the free app Adobe Acrobat Reader does support this feature, while that is not the case with the Preview app provided by macOS.
Paul learned to program in BASIC at age 13 and has programmed in more languages than he remembers, with Xojo being an obvious favorite. When not working on Xojo, you can find him talking about retrocomputing at Goto 10 and on Mastodon @lefebvre@hachyderm.io.