One of my projects requires the conversion of DOCX to PDF. I came across the phpdocx project and everything converts fine, but it serves the file to the browser, which prompts the user to download after conversion. I need to keep the file, just read the data for MySQL storage. Any ideas?
Here is the code I'm using:
$docx = new TransformDoc();
$docx ->setStrFile($tmpName);
$docx ->generatePDF();
Using Tim's modifications below produces the following error:
i
Warning: session_start() [function.session-start]:
Cannot send session cache limiter - headers already sent
(output started at /home/zbtech/public_html/DocCon/classes/TransformDoc.inc:1)
in /home/zbtech/public_html/scribpub.php on line 5
Unable to generate PDF file string. exception 'DOMPDF_Exception' with message
'Unknown image type: files/files_/tmp/phpNQFatu/media/word/.'
in /home/zbtech/public_html/DocCon/pdf/include/image_cache.cls.php:175 Stack trace:
#0 /home/zbtech/public_html/DocCon/pdf/include/image_frame_decorator.cls.php(88):
Image_Cache::resolve_url('files/files_/tm...', NULL, '', '')
#1 /home/zbtech/public_html/DocCon/pdf/include/frame_factory.cls.php(173): Image_Frame_Decorator-
>__construct(Object(Frame), Object(DOMPDF))
#2 /home/zbtech/public_html/DocCon/pdf/include/dompdf.cls.php(499): Frame_Factory::decorate_frame
(Object(Frame), Object(DOMPDF)) #3 /home/zbtech/public_html/DocCon/classes/TransformDoc.inc
(282): DOMPDF->render() #4 /home/zbtech/public_html/scribpub.php(68): TransformDoc->generatePDF
() #5 {main}