You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to convert from PDF to Word(docx, doc and other word files too,,,), I proceeded with this code but it gave me a big error. I'll give you below my code and the errors I received in this Library. I would like to say is there any way you know of that I could use to convert the PDF to Word file efficiently? Any way you think I could use without going through APIs please tell me!
<?phprequire_once'vendor/autoload.php';
usePhpOffice\PhpWord\IOFactoryasWordIOFactory;
/*********************** Convert a DOCM file to PDF ************************/// To enable pdf exporting with phpword
class_alias( \Dompdf\Dompdf::class, 'DOMPDF');
// Assuming dompdf_config.inc.php is in the same directoryuse \PhpOffice\PhpWord\Settings;
Settings::setPdfRenderer( Settings::PDF_RENDERER_DOMPDF, __DIR__ );
$phpWord = WordIOFactory::load('documents/ar-11_unlocked.pdf', 'PDF');
$objWriter = WordIOFactory::createWriter($phpWord, 'Word2007');
$objWriter->save('convert/test.pdf');
/*********************** END Convert a DOCM file to PDF ************************/
Here the errors that I get:
[30-Jan-202419:05:48America/New_York] PHPFatal error: UncaughtPhpOffice\PhpWord\Exception\Exception: "PDF" is not a valid Reader. in /opt/lampp/htdocs/filenigma/vendor/phpoffice/phpword/src/PhpWord/IOFactory.php:73Stack trace:
#0 /opt/lampp/htdocs/filenigma/vendor/phpoffice/phpword/src/PhpWord/IOFactory.php(54): PhpOffice\PhpWord\IOFactory::createObject()#1 /opt/lampp/htdocs/filenigma/vendor/phpoffice/phpword/src/PhpWord/IOFactory.php(87): PhpOffice\PhpWord\IOFactory::createReader()#2 /opt/lampp/htdocs/filenigma/index.php(59): PhpOffice\PhpWord\IOFactory::load()#3 {main}
thrown in /opt/lampp/htdocs/filenigma/vendor/phpoffice/phpword/src/PhpWord/IOFactory.php on line 73
PLEASE! Any help will be appreciated and don't hesitate to comment.
The text was updated successfully, but these errors were encountered:
I need to convert from PDF to Word(docx, doc and other word files too,,,), I proceeded with this code but it gave me a big error. I'll give you below my code and the errors I received in this Library. I would like to say is there any way you know of that I could use to convert the PDF to Word file efficiently? Any way you think I could use without going through APIs please tell me!
Here the errors that I get:
PLEASE! Any help will be appreciated and don't hesitate to comment.
The text was updated successfully, but these errors were encountered: