If utilizing PHP on a Windows PC, take into account a COM interface to the Excel object library. This Windows-only add-on typically comes with PHP installation on computers.
Practically anything that Excel VBA can do may be done with this method, including utilizing the ExportAsFixedFormat method to generate PDF files. As long as the print page settings are adhered to, this method can be used on Workbook or Worksheet objects, even Chart and Range.
// EXCEL APP OBJECT
$xlapp = new COM("Excel.Application") or Die ("Did not instantiate Excel");
// WORKBOOK AND WORKSHEET OBJECTS
$wbk = $xlapp->Workbooks->Open("C:\\Path\\To\\Workbook.xlsx");
$wks = $wbk->Worksheets(1);
// SET CELL VALUE
$wks->Range("B8")->Value = "testing";
// OUTPUT WORKSHEET TO PDF
$xlTypePDF = 0;
$xlQualityStandard = 0;
try {
$wks->ExportAsFixedFormat($xlTypePDF, "C:\\Path\\To\\Output.pdf", $xlQualityStandard);
} catch(com_exception $e) {
echo $e->getMessage()."\n";
exit;
}
// OPEN WORKBOOK TO SCREEN
$xlapp->Visible = true;
// END PROCESS / FREE RESOURCES
$xlapp = NULL;
unset($xlapp);