log('Hide grid lines'); $spreadsheet->getActiveSheet()->setShowGridLines(false); $helper->log('Set orientation to landscape'); $spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(PageSetup::ORIENTATION_LANDSCAPE); function yellowBody(string $html): string { $newstyle = << body { background-color: yellow; } EOF; return preg_replace('@@', "$newstyle", $html); } $helper->log('Write to Dompdf'); $writer = new Dompdf($spreadsheet); $filename = $helper->getFileName('21a_Pdf_dompdf.xlsx', 'pdf'); $writer->setEditHtmlCallback('yellowBody'); $writer->save($filename); $helper->log('Write to Mpdf'); $writer = new Mpdf($spreadsheet); $filename = $helper->getFileName('21a_Pdf_mpdf.xlsx', 'pdf'); $writer->setEditHtmlCallback('yellowBody'); $writer->save($filename); $helper->log('Write to Tcpdf'); $writer = new Tcpdf($spreadsheet); $filename = $helper->getFileName('21a_Pdf_tcpdf.xlsx', 'pdf'); $writer->setEditHtmlCallback('yellowBody'); $writer->save($filename);