Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using form fields relies on helvetica font #708

Open
srsbiz opened this issue Apr 4, 2024 · 0 comments
Open

Using form fields relies on helvetica font #708

srsbiz opened this issue Apr 4, 2024 · 0 comments

Comments

@srsbiz
Copy link

srsbiz commented Apr 4, 2024

TCPDF/tcpdf.php

Line 9941 in d4adef4

$font = $this->getFontBuffer((($this->pdfa_mode) ? 'pdfa' : '') .'helvetica');

When using custom font defined in constant PDF_FONT_NAME_MAIN, helvetica is not loaded into font buffer and using form fields produces following error:

PHP Warning:  Trying to access array offset on value of type bool in .../vendor/tecnickcom/tcpdf/tcpdf.php on line 9942

I think it should use value of PDF_FONT_NAME_MAIN, but I don't know how exacly it works with pdfa or if helvetica is required somewhere else and should be always loaded?

MRE:

<?php

error_reporting(-1);

require __DIR__ . '/vendor/autoload.php';

define('K_TCPDF_EXTERNAL_CONFIG', true);
define('PDF_FONT_NAME_MAIN', 'freesans');
define('PDF_FONT_NAME_DATA', 'freesans');

$pdf = new TCPDF();
$pdf->AddPage();
$pdf->TextField('test', 40, 10);
$pdf->output(__DIR__ . '/test.pdf', 'F');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant