Hello,
Please note that the available classes and methods to sign a PDF document are detailed on:
https://www.phpdocx.com/api-documentation/digital-signature-package/digitally-sign-docx-pdf-with-PHP
You need to use SignPDF or SignPDFPlus to sign a PDF document, not TCPDI with a custom code. Please note that TCPDI is an internal class used by phpdocx methods; it shouldn't be used standalone.
If you have any issue using SignPDF or SignPDFPlus to sign a PDF, please send this document to contact[at]phpdocx.com and we'll check it.
Please note we only can provide support for phpdocx methods. If you want to generate custom code with TCPDI we recommend you check the code available in phpdocx classes.
Regards.