G
G
Galdar Turin2019-03-13 16:05:23
PHP
Galdar Turin, 2019-03-13 16:05:23

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');

Only here the PAPERSIZE_C5_ENVELOPE parameter is applied visually, but when printing, the format is not put on the C% envelope , what can be, can someone solve this issue?

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

1 answer(s)
I
ivankomolin, 2019-03-25
@Galdar

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 question

Ask a Question

731 491 924 answers to any question