parameters not passed to mPDF engenie
Metadata parameters not passed to mPDF engine. Am I doing something wrong? Cakephp 3.9 mPDF 8.0.4
Configure::write('CakePdf', [
'engine' => [
'className' => 'CakePdf.Mpdf',
'options' => [
'SetTitle' => $this->titulo,
'SetAuthor' => $this->autor,
'SetCreator' => $this->criador,
'SetSubject' => $this->assunto,
'ShowWatermarkText' => true,
'SetWatermarkText' => 'RASCUNHO'
]
],
'orientation' => 'portrait',
'download' => true,
'filename' => $local_file,
]);
Well the options set through engine config are merged with other options and passed to Mpdf class constructor.
https://github.com/FriendsOfCake/CakePdf/blob/f8b945187877f59030e307c1ab51a3457f7c6b67/src/Pdf/Engine/MpdfEngine.php#L34-L36
Ok.... SetTitle, SetAuthor, SetSubject and SetCreator are methods of MPDF Class. It wont work this way!!!
But setWatermarkText and showWatermarkText are config variables.... Shuld works....
So, is there another way to set metadata (title, subject, creator, author) of PDF files?
No, currently you can only pass options to the vendor class' constructor. There's no way to access the internal vendor class instance of the engine classes, so that you can call the methods you need.