|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-11-25 09:44 UTC] tt at prof4 dot net
-Package: *PDF functions
+Package: COM related
[2016-11-25 09:44 UTC] tt at prof4 dot net
[2016-11-25 14:05 UTC] ab@php.net
-Status: Open
+Status: Feedback
[2016-11-25 14:05 UTC] ab@php.net
[2016-11-25 14:16 UTC] tt at prof4 dot net
-Status: Feedback
+Status: Open
[2016-11-25 14:16 UTC] tt at prof4 dot net
[2016-11-25 17:39 UTC] ab@php.net
-Status: Open
+Status: Verified
[2016-11-25 17:39 UTC] ab@php.net
[2016-11-26 05:30 UTC] tt at prof4 dot net
-Type: Bug
+Type: Documentation Problem
[2016-11-26 05:30 UTC] tt at prof4 dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 02:00:01 2025 UTC |
Description: ------------ I am not sure if this is relating to the topic of "PDF functions". We tested the following script with PHP5.4 and PHP7. It works perfectly with PHP5.4 but generates an error in PHP7 (Same configuration for the environment but the Port for Apache24 is different to the port for Apache22 with PHP5.4) We also tested it with the SaveAs2 function and also we checked the parameters for "Open()". We are using Word Version 14. Test script: --------------- function rtf2pdf($path) { if (!class_exists('COM')) { return false; } $word = new COM("word.application"); if (!$word) { return false; } if ($word->Version < 12) { $word->Quit(); return false; } $word->Documents->Open($path, false, true); $wdSaveFormats = array( 'docx' => 16, 'html' => 10, 'rtf' => 6, 'txt' => 2, 'doc' => 0, 'pdf' => 17 ); $new_file = str_replace('.rtf', '.pdf', $path); $word->ActiveDocument->SaveAs($new_file, $wdSaveFormats['pdf']); $word->ActiveDocument->SaveAs2($new_file, $wdSaveFormats['pdf']); $word->ActiveDocument->Close(false); $word->Quit(); return $new_file; } echo rtf2pdf('C:\\mydoc.rtf'); Expected result: ---------------- C:\mydoc.pdf Actual result: -------------- Fatal error: Uncaught com_exception: Parameter 0: Typenkonflikt. in rtftest.php:24 Stack trace: #0 rtftest.php(24): variant->SaveAs('C:\\mydoc.pdf', 17) #1 rtftest.php(31): rtf2pdf('C:\\mydoc.rtf') #2 {main} thrown in rtftest.php on line 24