Sign a PDF at a chosen spot: visible signature with CodeB Wallet in the Aloaha PDF Editor

Code samples
VB.NET
Published

In short: In the Aloaha PDF Editor drag a rectangle with the mouse where the signature should go, click into it and choose Sign Document. If CodeB Wallet is selected in the signature settings, the PDF is sent to CodeB as a signing request and you sign on your Android phone in CodeB Wallet – the visible signature (handwritten, the image from your ID card or only your name) appears exactly in that rectangle. In the app you decide how to sign: with a signature card (qualified electronic signature when the card's certificate states it) or with the CodeB signing service without a card (advanced signature). The PDF Editor saves the signed PDF under the chosen name. Available from version 11.0.0.9.

Other terms for the same thing: place a signature field in a PDF, position a visible digital signature, sign a PDF with your phone, draw a signature box, PAdES signature with a visible appearance, sign a contract or an invoice at a marked spot.

At a glance

QuestionAnswer
Where?Aloaha PDF Editor: drag a rectangle, click into it, Sign Document
With what?CodeB Wallet (Aloaha's EUDI wallet for Android) – method CodeB Wallet in the signature settings
Who signs?Only you. Invitations from the signature settings are not used.
Which signature?Signature card: qualified (QES) when its certificate states it – e.g. Maltese eID or D-Trust card. CodeB signing service: advanced (AdES). You choose in the app.
FormatPAdES with a trusted timestamp, as an incremental update – the existing content and an embedded ZUGFeRD XML stay unchanged
Minimum field size60 × 20 points (about 2.1 × 0.7 cm)
Other methodsWith Local certificate the PDF Editor signs in the rectangle itself, as before.

Requirements

  • Aloaha PDF Editor 11.0.0.9 or later (download).
  • CodeB Wallet on an Android phone (access by invitation) and a CodeB account. For a qualified signature also an NFC signature card.
  • In the signature settings the method CodeB Wallet – signed on the phone with CodeB user name (login_hint), agent ID (client_id) and agent secret (client_secret). How to add the agent once per PC: agent ID and agent secret; every setting is explained in the settings one by one.
  • A valid licence of the PDF Editor or the SDK. Without one, signing shows a message with the options buy a licence or request a free evaluation key by e-mail to info@aloaha.com.

If the signature settings were never saved or a value is missing, Sign Document opens the settings dialog first.

Step by step

  1. Open the PDF – for example a contract, a quote or a finished ZUGFeRD invoice.
  2. Draw the field: hold the mouse button and drag a rectangle where the signature should go, at least about 2.1 × 0.7 cm.
  3. Sign Document: click into the rectangle and choose Sign Document in the menu. Then pick the name of the signed file.
  4. Approve the program: the status window shows a 4-digit code. On phone.codeb.io/agent-approvals.html the sign-in appears under Waiting for your approval – approve it if it shows the same code. The approval is valid for one hour.
  5. Sign in CodeB Wallet: the PDF is uploaded. Scan the QR code on phone.codeb.io/sign-request.html with the app, choose the appearance (handwritten, image from the ID card or name only) and sign with a signature card or the CodeB signing service.
  6. Done: the status window downloads the signed PDF and saves it under the chosen name; the PDF Editor shows it.

Which signature do I get?

You decide when you sign in the app. With a signature card you get a qualified electronic signature (QES) when the card's certificate states it; see which cards give a QES. With the CodeB signing service without a card you get an advanced electronic signature (AdES). While waiting, the status window shows the state on phone.codeb.io, after signing e.g. "me: signed (certificate states a qualified signature)".

That is why the PDF Editor always requests the level "advanced" for a drawn field: it accepts both ways, and a card with a qualified certificate still gives a QES. The level "qualified" from the signature settings applies only to Sign PDF without a field.

Where exactly does the signature go?

The PDF Editor converts the rectangle into PDF points of the marked page (origin bottom left) and passes it to the signing request as a signature field. Before signing, the CodeB server adds an empty signature field CodeB_Signer1 as an incremental update; CodeB Wallet signs exactly into that field and draws the appearance. A field must lie on the page and be at least 60 × 20 points; there is one field per signer and document.

Does a ZUGFeRD invoice stay valid?

Yes, the embedded XML is not changed. In our test the PDF/A-3 and XML checks gave the same result after signing as before. Details and notes on the visible signature: Does the ZUGFeRD invoice stay valid after signing? Important: embed the XML first, then sign – any later change invalidates the signature.

Drawn field or "Sign PDF"?

Rectangle + Sign DocumentSign PDF / Save digitally signed
Signersonly youas in the signature settings: you and/or up to 5 invited people one after another
Signature levelyou choose in the app (card or signing service)as in the signature settings (advanced or qualified)
Visible signaturein the drawn rectangleno fixed field; can be placed in the app

Typical mistakes

  • Rectangle too small: below 60 × 20 points the service refuses the field – the status window says so at once, before anything is uploaded. Draw it a little larger.
  • No approval: without approval under Waiting for your approval nothing is uploaded; the approval request is valid for 5 minutes.
  • Window closed early: the program asks whether to withdraw the request. If it stays open, download the signed PDF later on phone.codeb.io/sign-request.html.
  • Local certificate instead of CodeB Wallet: with another method in the signature settings the PDF Editor signs locally. Choose CodeB Wallet for the phone.
  • No licence: without a valid licence nothing is signed; the message offers to buy a licence or request an evaluation key. Enter the key in the licence settings afterwards.
  • PDF changed after signing: any later change (also saving again with another program) invalidates the signature.

For developers: the same from your own software

The PDF Editor uses the COM and .NET class WalletSignRequest of the Aloaha ZUGFeRD SDK. Add a visible field with AddSignatureField(Signer, Page, X1, Y1, X2, Y2) before CreateRequest – page from 1, coordinates in PDF points from the bottom left:

Dim w As New Aloaha_ZUGFeRD.WalletSignRequest
w.LicenseKey = "YOUR-LICENCE-KEY"
w.UserName = "your-codeb-user-name"         ' login_hint
w.AgentID = AgentIdFromYourConfiguration    ' client_id
w.AgentSecret = SecretFromProtectedStorage  ' client_secret, e.g. Windows Credential Manager
w.Level = "aes"                             ' card or signing service
w.SignMyself = True
If w.RequestApproval() AndAlso w.WaitForApproval(300) Then
    ' field for signer 1 on page 1: x 360-560, y 80-140 (PDF points)
    w.AddSignatureField(1, 1, 360, 80, 560, 140)
    If w.CreateRequest("C:\Invoices\INV-1001.pdf", "INV-1001.pdf") Then
        w.WaitUntilSigned("C:\Invoices\INV-1001_signed.pdf", 1800)
    End If
End If

Show the approval code (BindingMessage) to the user after RequestApproval. All methods and properties: Sign ZUGFeRD invoices with CodeB Wallet – SDK.

With a valid maintenance contract the upgrade to the new version is free.

Frequently asked questions

How do I put the signature at a specific spot in the PDF?

In the Aloaha PDF Editor drag a rectangle at that spot, click into it and choose Sign Document. With the method CodeB Wallet the signature appears exactly in that rectangle.

Can I sign qualified in the drawn field?

Yes. Sign in CodeB Wallet with a signature card whose certificate states a qualified electronic signature, for example a Maltese eID or a D-Trust card. Without a card the CodeB signing service gives an advanced signature.

Are other people invited for a drawn field?

No. With a drawn field only you sign. Invitations from the signature settings apply only to Sign PDF without a field.

How big must the field be?

At least 60 × 20 PDF points, about 2.1 × 0.7 cm. The signing service refuses smaller fields.

What does the visible signature show?

You choose in the app: a signature drawn with your finger, the signature image from your ID card or only your name.

Do I need a licence to sign?

Yes. Signatures in the PDF Editor and the ZUGFeRD GUI need a valid licence. A free evaluation key is available by e-mail to info@aloaha.com.

Does the ZUGFeRD XML stay valid after signing?

Yes. The signature is appended as an incremental update; the embedded XML and the existing content stay unchanged.