PhpSpreadsheet icon indicating copy to clipboard operation
PhpSpreadsheet copied to clipboard

Mpdf options: exposeVersion -> false

Open michalfordonski opened this issue 3 years ago • 1 comments

This is:

- [ ] a bug report
- [ ] a feature request
- [x] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)

What is the expected behavior?

When registering Mpdf as a writer, I cannot pass configuration, and would like to pass the exposeVersion option as false Can I do this somehow with your repo setup?

michalfordonski avatar Aug 19 '22 12:08 michalfordonski

I don't know that we want to get into the business of directly supporting all configuration options for products with which we interface. But I believe you should be able to do what you want by extending the Mpdf class.

use PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf;

class Mpdf2 extends Mpdf
{
    protected function createExternalWriterInstance($config)
    {
        $config['exposeVersion'] = false;
        return new \Mpdf\Mpdf($config);
    }
}
...
$writer = new Mpdf2($spreadsheet);
$writer->save(...);

oleibman avatar Aug 19 '22 16:08 oleibman