I want to read a pdf file. for that i want to use dompdf. i generated dompdf from phpmaker. Now the folder is available inside vendor/hkvstore/dompdf.
but I want to get the directory for pdf( like the excel directory given below )
You may write PDF with PhpSpreadSheet, but are you sure you can read a PDF file with it? I doubt if it can read PDF.
The PhpSpreadsheet is a composer package, you don’t need to require or include the file yourself. If the PhpSpreadsheet extension is enabled, you can use it directly, e.g.
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, ‘Pdf’);
in this above code error is showing like
Fatal error: Uncaught Error: Class “PHPExcel_IOFactory” not found in C:\xampp\htdocs\athira\fin_scm_dev_poc\excel_read.php:6 Stack trace: #0 {main} thrown in C:\xampp\htdocs\athira\fin_scm_dev_poc\excel_read.php on line 6
how to fix this? Thanks
The PhpSpreadsheet is a composer package, you don’t need to require or include the file yourself. If the PhpSpreadsheet extension is enabled, you can use it directly, e.g.
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, ‘Pdf’);
this showing error
Fatal error: Uncaught TypeError: PhpOffice\PhpSpreadsheet\IOFactory::createWriter(): Argument #1 ($spreadsheet) must be of type PhpOffice\PhpSpreadsheet\Spreadsheet, string given, called in C:\xampp\htdocs\athira\fin_scm_dev_poc\excel_read.php on line 6 and defined in C:\xampp\htdocs\athira\fin_scm_dev_poc\vendor\phpoffice\phpspreadsheet\src\PhpSpreadsheet\IOFactory.php:60 Stack trace: #0 C:\xampp\htdocs\athira\fin_scm_dev_poc\excel_read.php(6): PhpOffice\PhpSpreadsheet\IOFactory::createWriter(‘demoexcel.xls’) #1 {main} thrown in C:\xampp\htdocs\athira\fin_scm_dev_poc\vendor\phpoffice\phpspreadsheet\src\PhpSpreadsheet\IOFactory.php on line 60
Again: The PhpSpreadsheet is a composer package, you don’t need to require or include the file yourself. If the PhpSpreadsheet extension is enabled, you can use it directly.,
As the error clearly said:
PhpOffice\PhpSpreadsheet\ > IOFactory::createWriter(): Argument #1 ($spreadsheet) must be of type PhpOffice\PhpSpreadsheet\Spreadsheet, string given
Review your code, check the second argument of createWriter() in your code.