Loading module/Oscar/src/Oscar/Controller/ConventionModeleEtapeAdministrationController.php +32 −9 Original line number Diff line number Diff line Loading @@ -130,15 +130,38 @@ class ConventionModeleEtapeAdministrationController extends AbstractOscarControl $documentLocation = $this->getOscarConfigurationService()->getDocumentDropLocation(); $documentPath = $documentLocation . DIRECTORY_SEPARATOR . $conventionModeleEtape->fichier; $templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor($documentPath); //$templateProcessor->setValue('name', 'myvar'); //$templateProcessor->saveAs($documentPath . '2'); \PhpOffice\PhpWord\Settings::setPdfRendererName(\PhpOffice\PhpWord\Settings::PDF_RENDERER_DOMPDF); \PhpOffice\PhpWord\Settings::setPdfRendererPath(__DIR__ . '/../../../../../vendor/dompdf/dompdf'); $phpWord = \PhpOffice\PhpWord\IOFactory::load($documentPath); $pdfWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord , 'PDF'); $pdfWriter->save($documentPath . '.pdf'); $reader = new \XMLReader(); $reader->open('zip://' . $documentPath . "#content.xml"); $odt_meta = array(); while ($reader->read()) { if ($reader->nodeType == \XMLREADER::ELEMENT) { $elm = $reader->name; } else { if ($reader->nodeType == \XMLREADER::END_ELEMENT && $reader->name == 'office:meta') { break; } if (!trim($reader->value)) { continue; } $odt_meta[$elm] = $reader->value; } } // $templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor($documentPath); // //$templateProcessor->setValue('name', 'myvar'); // //$templateProcessor->saveAs($documentPath . '2'); // \PhpOffice\PhpWord\Settings::setPdfRendererName(\PhpOffice\PhpWord\Settings::PDF_RENDERER_DOMPDF); // \PhpOffice\PhpWord\Settings::setPdfRendererPath(__DIR__ . '/../../../../../vendor/dompdf/dompdf'); // $phpWord = \PhpOffice\PhpWord\IOFactory::load($documentPath); // $pdfWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord , 'PDF'); // $pdfWriter->save($documentPath . '.pdf'); } Loading Loading
module/Oscar/src/Oscar/Controller/ConventionModeleEtapeAdministrationController.php +32 −9 Original line number Diff line number Diff line Loading @@ -130,15 +130,38 @@ class ConventionModeleEtapeAdministrationController extends AbstractOscarControl $documentLocation = $this->getOscarConfigurationService()->getDocumentDropLocation(); $documentPath = $documentLocation . DIRECTORY_SEPARATOR . $conventionModeleEtape->fichier; $templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor($documentPath); //$templateProcessor->setValue('name', 'myvar'); //$templateProcessor->saveAs($documentPath . '2'); \PhpOffice\PhpWord\Settings::setPdfRendererName(\PhpOffice\PhpWord\Settings::PDF_RENDERER_DOMPDF); \PhpOffice\PhpWord\Settings::setPdfRendererPath(__DIR__ . '/../../../../../vendor/dompdf/dompdf'); $phpWord = \PhpOffice\PhpWord\IOFactory::load($documentPath); $pdfWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord , 'PDF'); $pdfWriter->save($documentPath . '.pdf'); $reader = new \XMLReader(); $reader->open('zip://' . $documentPath . "#content.xml"); $odt_meta = array(); while ($reader->read()) { if ($reader->nodeType == \XMLREADER::ELEMENT) { $elm = $reader->name; } else { if ($reader->nodeType == \XMLREADER::END_ELEMENT && $reader->name == 'office:meta') { break; } if (!trim($reader->value)) { continue; } $odt_meta[$elm] = $reader->value; } } // $templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor($documentPath); // //$templateProcessor->setValue('name', 'myvar'); // //$templateProcessor->saveAs($documentPath . '2'); // \PhpOffice\PhpWord\Settings::setPdfRendererName(\PhpOffice\PhpWord\Settings::PDF_RENDERER_DOMPDF); // \PhpOffice\PhpWord\Settings::setPdfRendererPath(__DIR__ . '/../../../../../vendor/dompdf/dompdf'); // $phpWord = \PhpOffice\PhpWord\IOFactory::load($documentPath); // $pdfWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord , 'PDF'); // $pdfWriter->save($documentPath . '.pdf'); } Loading