我有以下代码:
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$sheet->getPageSetup()->setOrientation(PageSetup::ORIENTATION_LANDSCAPE);
$sheet->getPageMargins()
->setLeft(0.1)
->setRight(0.1)
->setTop(0.1)
->setBottom(0.1)
->setHeader(0);
$sheet->setCellValue('A1', 'Test input');
$writer = new Mpdf($spreadsheet);
$dateStamp = Carbon::now()->format('YmdHis');
$saveDirectory = REPORTS_DIR . Auth::user()->getAuthIdentifier() . '/';
if (is_dir($saveDirectory) === false) {
mkdir($saveDirectory, 755, true);
}
$writer->save($saveDirectory . $dateStamp . '-global.pdf');
页边距设置不正确。我已将其设置为大号和小号(如上所述),并且它们都没有更新打印的pdf文档。当我将Mpdf编写器换为Xlsx编写器时,边距有效,当我更改它时,它会相应地更新电子表格。
还有其他方法需要设置页边距以更新pdf大小吗?