PAdES Digital Signatures
★ Pro — Commercial License Required
PAdES B-T, B-LT, and B-LTA signature levels require the Pro package.
TCPDF-Next Pro implements the full PAdES pipeline (ETSI EN 319 142) using CertificateInfo, DigitalSigner, ByteRangeCalculator, and SignatureAppearance.
Signature Levels
| Level | Enum Value | What It Adds |
|---|---|---|
| B-B | SignatureLevel::PAdES_B_B | CMS signature with signing certificate |
| B-T | SignatureLevel::PAdES_B_T | RFC 3161 signature timestamp |
| B-LT | SignatureLevel::PAdES_B_LT | Revocation data (OCSP + CRL) via DSS |
| B-LTA | SignatureLevel::PAdES_B_LTA | Document timestamp for indefinite validity |
CertificateInfo
Loads and parses X.509 certificates and private keys from PEM or PKCS#12 files.
php
use Yeeefang\TcpdfNext\Pro\Security\Signature\CertificateInfo;
// From PEM files
$cert = CertificateInfo::fromPem('/certs/signing.pem', '/certs/signing.key', 'pw');
$cert->chain(['/certs/intermediate.pem', '/certs/root.pem']);
// From PKCS#12 (chain extracted automatically)
$cert = CertificateInfo::fromPkcs12('/certs/signing.p12', 'p12-password');
// Inspect certificate details
echo $cert->subjectCN(); // "John Doe"
echo $cert->issuerCN(); // "Acme Intermediate CA"
echo $cert->validFrom(); // DateTimeImmutable
echo $cert->ocspResponderUrl(); // "https://ocsp.acme.com"DigitalSigner
Generates the CMS/PKCS#7 signature container and orchestrates timestamp and LTV embedding.
php
use Yeeefang\TcpdfNext\Core\Document;
use Yeeefang\TcpdfNext\Pro\Security\Signature\DigitalSigner;
use Yeeefang\TcpdfNext\Pro\Security\Timestamp\TsaClient;
use Yeeefang\TcpdfNext\Contracts\Enums\SignatureLevel;
$pdf = Document::create()->addPage()->text('Contract document.');
$cert = CertificateInfo::fromPkcs12('/certs/signer.p12', 'pw');
$tsa = new TsaClient('https://tsa.example.com/timestamp');
$signer = new DigitalSigner($cert);
$signer->level(SignatureLevel::PAdES_B_LTA);
$signer->timestampAuthority($tsa);
$signer->reason('Document approval');
$signer->location('Taipei, Taiwan');
$signer->sign($pdf);
$pdf->save('/output/signed.pdf');At B-LT and B-LTA levels, LtvManager is invoked internally to fetch OCSP responses and CRLs and build the DSS dictionary.
ByteRangeCalculator
Manages the signature placeholder and computes byte ranges. Handled internally by DigitalSigner; direct use is for advanced scenarios.
SignatureAppearance
Controls the visible representation of the signature on the page. Signatures are invisible by default.
php
use Yeeefang\TcpdfNext\Pro\Security\Signature\SignatureAppearance;
$appearance = SignatureAppearance::create()
->page(1)
->position(x: 20.0, y: 250.0, width: 80.0, height: 30.0)
->text("Digitally signed by John Doe\nDate: 2026-02-16")
->image('/images/handwritten-signature.png')
->imagePosition('left') // 'left', 'right', 'top', 'bottom', 'background'
->fontSize(8);
$signer->appearance($appearance);
$signer->sign($pdf);Complete B-LTA Example
php
use Yeeefang\TcpdfNext\Core\Document;
use Yeeefang\TcpdfNext\Pro\Security\Signature\{DigitalSigner, CertificateInfo, SignatureAppearance};
use Yeeefang\TcpdfNext\Pro\Security\Timestamp\TsaClient;
use Yeeefang\TcpdfNext\Contracts\Enums\SignatureLevel;
$pdf = Document::create()
->addPage()
->font('Helvetica', size: 14, style: 'B')
->text('Purchase Agreement')
->font('Helvetica', size: 11)
->text('This agreement is entered into on February 16, 2026...');
$cert = CertificateInfo::fromPkcs12('/certs/legal.p12', 'passphrase');
$tsa = new TsaClient('https://tsa.example.com/timestamp');
$signer = new DigitalSigner($cert);
$signer->level(SignatureLevel::PAdES_B_LTA);
$signer->timestampAuthority($tsa);
$signer->appearance(
SignatureAppearance::create()
->page(1)
->position(x: 20.0, y: 250.0, width: 80.0, height: 25.0)
->text("Signed by Legal Dept.\n2026-02-16")
);
$signer->reason('Purchase agreement execution');
$signer->location('Taipei, Taiwan');
$signer->sign($pdf);
$pdf->save('/contracts/purchase-agreement-signed.pdf');Next Steps
- Long-Term Validation -- DSS, OCSP, CRL, and archival timestamps.
- HSM Integration -- Sign with hardware security modules via PKCS#11.
- Pro Package Overview -- Full module listing and license information.