Stamp a Drawn Signature on Page 1 of a PDF
• 5 min read
To add a signature to a PDF in Docify, pick a local application/pdf file, draw on the 500×200 canvas, then click Sign and download. The pad is captured with canvas.toDataURL() (default PNG), embedded via pdf-lib embedPng, and drawn on getPages()[0] at x: 50, y: 50 (150×50 pt). The download is signed-document.pdf. Nothing is uploaded.
Signing is a button, not a live stamp as you draw. The PDF signer does not type a name, accept a signature image, or let you drag the PNG. For why this is not ESIGN / eIDAS e-sign, see visual stamp vs electronic signature. For PKCS#7 / PAdES and the mouse-only pad, see not a digital certificate signature.
How Sign and download places the PNG
- Upload PDF keeps files whose
typeisapplication/pdf. Anything else is rejected withalert(). Preview is aniframepointed atURL.createObjectURL. - The pad is a 500×200 canvas. The 2d context uses black stroke, line width 2, and round caps. Mouse down/move/up map through
getBoundingClientRect. Mouseup (and mouseleave) storecanvas.toDataURL(). - Sign and download reads the file with
arrayBuffer()andPDFDocument.load. OnlygetPages()[0]is used. The data URL is fetched to bytes and embedded withembedPng. drawImageplaces the PNG atx: 50, y: 50with width 150 and height 50 (PDF user space; origin at the bottom left).pdfDoc.save()becomes anapplication/pdfdownload namedsigned-document.pdf. Errors surface withalert().
What this page does not do
- It does not let you position the stamp, sign page 2+, or upload a signature image. The old “place it anywhere” step was not about this tool.
- It does not stamp as you draw. You click Sign and download after both the PDF and the data URL exist.
- It does not claim a legally binding electronic signature. The stamp is a picture on page 1.
Stamp a local PDF
Draw on the canvas, click Sign and download, save signed-document.pdf. No upload.
FAQ
- Does adding a signature upload my PDF?
- No. The picker reads an application/pdf file, preview uses a local object URL, and pdf-lib loads arrayBuffer() in the browser. The page does not send the PDF or the canvas PNG to a server.
- Does Sign and download run when I pick a file?
- No. Choosing a PDF only sets the iframe preview. You still draw on the canvas (mouseup stores canvas.toDataURL()) and click Sign and download. The button stays disabled until both a PDF and a stored data URL exist.
- Can I type my name or upload a signature image?
- No. The only pad is a 500×200 canvas with a 2d context (black stroke, width 2, round caps). There is no typed-name field and no signature-image picker. The old “draw, type, or upload” step was not about this page.
- Where does the stamp appear?
- Only on getPages()[0]. pdf-lib drawImage places the PNG at x: 50, y: 50 (user space, origin bottom-left) with width 150 and height 50. You cannot drag the stamp or pick another page.