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

parameters not passed to mPDF engenie #313

Open
nilsonpena opened this issue Apr 4, 2021 · 3 comments
Open

parameters not passed to mPDF engenie #313

nilsonpena opened this issue Apr 4, 2021 · 3 comments

Comments

@nilsonpena
Copy link

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,
        ]);
@ADmad
Copy link
Member

ADmad commented Apr 6, 2021

Well the options set through engine config are merged with other options and passed to Mpdf class constructor.

$options = array_merge($options, (array)$this->getConfig('options'));
$Mpdf = $this->_createInstance($options);

@nilsonpena
Copy link
Author

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?

@ADmad
Copy link
Member

ADmad commented Apr 26, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants