Answer the question
In order to leave comments, you need to log in
How to change settings in print driver, PDF?
I am using PhpSpreadsheet to generate a pdf file:
require 'vendor/autoload.php';
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf;
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$sheet->setCellValue('A1', 'Hello World !');
$writerPDF = new Mpdf($spreadsheet);
$sheet->getPageSetup()->setPaperSize(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_C5_ENVELOPE);
$sheet->getPageSetup()->setOrientation(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE);
$writerPDF->writeAllSheets()
->setPreCalculateFormulas(false)
->save('envelope.pdf');
I looked at the applied parameters in XLS and there the print format "when printing" is saved, but it does not apply to PDF
Answer the question
In order to leave comments, you need to log in
Unfortunately, the print settings are at the mercy of the operating system on which the generated pdf file will be opened.
Also, the operating system print settings can be partially affected by the application through which the generated file will be viewed.
And to generate a pdf that will change the settings of the operating system in which it will be opened is already at the level of fantasy)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question