tecnickcom / TCPDF

Official clone of PHP library to generate PDF documents and barcodes
https://tcpdf.org
Other
4.18k stars 1.51k forks source link

Trying to access array offset on value of type bool with PDF/A #583

Closed simonbuehler closed 1 year ago

simonbuehler commented 1 year ago

Hi,

when building a pdf/a i get this exception:

Trying to access array offset on value of type bool

  at vendor/tecnickcom/tcpdf/tcpdf.php:9917
    9913▕                               }
    9914▕                               $out .= ' >> >>';
    9915▕                       }
    9916▕                       $font = $this->getFontBuffer('helvetica');
  ➜ 9917▕                       $out .= ' /DA (/F'.$font['i'].' 0 Tf 0 g)';
    9918▕                       $out .= ' /Q '.(($this->rtl)?'2':'0');
    9919▕                       //$out .= ' /XFA ';
    9920▕                       $out .= ' >>';
    9921▕                       // signatures

the problem is IMO in the line https://github.com/tecnickcom/TCPDF/blob/2fb1c01bc37487d1f94fe1297f8d8ad1b5c290bb/tcpdf.php#L9928

which should be

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

can you reproduce and fix, thanks!

williamdes commented 1 year ago

Can you open a pull-request here?