I have to generate a PDF document and add a "signature field".
A signature field is a field that allow to third party service to digitally sign document.
Is it possible to do this in PHP with an open source solution ?
I saw https://manuals.setasign.com/setapdf-signer-manual/create-a-signature-field/.
I try to use tcpdf but i have no success.
Thanks.
As you already told that you have already gone through seta sign library documentation here
using setasign you can create a pdf document or use an existing one to create a digital signature field on it. Below is a code example:-
<?php
require_once('library/SetaPDF/Autoload.php');
// create a writer
$writer = new SetaPDF_Core_Writer_Http('visible-field.pdf', true);
// create a new document instance
$document = new SetaPDF_Core_Document($writer);
// create at least a single page
$document->getCatalog()->getPages()->create(SetaPDF_Core_PageFormats::A4);
// add a field left top with an offset of 10 points
SetaPDF_Signer_SignatureField::add(
$document,
'Signature field 1',
1,
SetaPDF_Signer_SignatureField::POSITION_LEFT_TOP,
array('x' => 10, 'y' => -10),
180,
70
);
// add a field absolutely position on the bottom left with an offset of 10 points
SetaPDF_Signer_SignatureField::add($document, 'Signature field 1', 1, 10, 10, 180, 70);
// save and finish
$document->save()->finish();
Note:- Use Adobe Acrobat Reader to open the generated document so you can see the digital signature field on pdf.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With