For those newly facing the same problem:
Open the file: `vendor/tecnickcom/tcpdf/config/tcpdf_config.php`
After changing the constant K_TCPDF_CALLS_IN_HTML
value to true
You still need to allow the method for using define('K_ALLOWED_TCPDF_TAGS', '|write2DBarcode|');
Check the following reply for understanding this constant: