Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
Hi, I have tried installing the new 2.5 install on two seperate system. One is Windows with Apache and the 2nd one is CentOS and Apache.
Both web servers have the required plugins enabled, PHPdocx 2.4 is running on both the servers (Staging and Live)
I am getting the following notices when I run any example files
[code]Notice: Trying to get property of non-object in E:\webroot\phpdocx_pro\classes\CreateDocx.inc on line 627
Notice: Undefined variable: newName in E:\webroot\phpdocx_pro\classes\CreateDocx.inc on line 5307
Notice: Undefined variable: newName in E:\webroot\phpdocx_pro\classes\CreateDocx.inc on line 5307
Notice: Undefined variable: newName in E:\webroot\phpdocx_pro\classes\CreateDocx.inc on line 5307
Notice: Undefined variable: newName in E:\webroot\phpdocx_pro\classes\CreateDocx.inc on line 5307
Notice: Undefined variable: newName in E:\webroot\phpdocx_pro\classes\CreateDocx.inc on line 5307
Notice: Undefined variable: newName in E:\webroot\phpdocx_pro\classes\CreateDocx.inc on line 5307
Notice: Undefined variable: newName in E:\webroot\phpdocx_pro\classes\CreateDocx.inc on line 5307
Notice: Undefined variable: newName in E:\webroot\phpdocx_pro\classes\CreateDocx.inc on line 5307[/code]
I have same notices but DOCX documents are saved in examples/docx directory
[code]Strict Standards: Declaration of MYPDF::ImageSVG() should be compatible with that of TCPDF::ImageSVG() in C:Program FilesEasyPHP-5.3.3wwwphpdocx2.5phpdocx_propdfclass.tcpdf.php on line 4
Notice: Trying to get property of non-object in C:Program FilesEasyPHP-5.3.3wwwphpdocx2.5phpdocx_proclassesCreateDocx.inc on line 627
Notice: Undefined variable: newName in C:Program FilesEasyPHP-5.3.3wwwphpdocx2.5phpdocx_proclassesCreateDocx.inc on line 5307
Notice: Undefined variable: newName in C:Program FilesEasyPHP-5.3.3wwwphpdocx2.5phpdocx_proclassesCreateDocx.inc on line 5307
Notice: Undefined variable: newName in C:Program FilesEasyPHP-5.3.3wwwphpdocx2.5phpdocx_proclassesCreateDocx.inc on line 5307
Notice: Undefined variable: newName in C:Program FilesEasyPHP-5.3.3wwwphpdocx2.5phpdocx_proclassesCreateDocx.inc on line 5307
Notice: Undefined variable: newName in C:Program FilesEasyPHP-5.3.3wwwphpdocx2.5phpdocx_proclassesCreateDocx.inc on line 5307
Notice: Undefined variable: newName in C:Program FilesEasyPHP-5.3.3wwwphpdocx2.5phpdocx_proclassesCreateDocx.inc on line 5307
Notice: Undefined variable: newName in C:Program FilesEasyPHP-5.3.3wwwphpdocx2.5phpdocx_proclassesCreateDocx.inc on line 5307
Notice: Undefined variable: newName in C:Program FilesEasyPHP-5.3.3wwwphpdocx2.5phpdocx_proclassesCreateDocx.inc on line 5307
[/code]
Oh thanks. Found the files!
Noticed another problem. When I change the $docx->createDocx to createDocxandDownload
The file downloaded is corrupt but opens okay. Same file with only createDocx works okay. Same thing happens with all the demo files too.
Any ideas?
I've got the same error, but since you have post your question nobody response.
I tried to use this in an ajax post but i get this error and block my process to generate dynamically a word or pdf document.
ErrorException [ Strict ]: Declaration of MYPDF::ImageSVG() should be compatible with that of TCPDF::ImageSVG()
I just use it since today and I got a development error. Please, Mr Developer, help us to be happy to use your program.
Thx.
Notice: Undefined variable: newName in C:\wamp\projets\sandbox\www\[etc...]\phpdocx_pro\classes\CreateDocx.inc on line 5885
Okay, let's go and see that (It's non blocking but I hate notice :-) )
/**
*
* Adds directory contents recursively into a zip.
*
* @param string $dirName. The path to the dir to add.
*
* @param string $myZip. The zip where the contents of the dir should be added.
*
*/
private function recursiveInsert($myZip, $fileName, $basePath){
$length = strlen($basePath);
if(is_dir($fileName)){
$dirName = substr($fileName, $length);
$myZip->addEmptyDir($newName); // <=== HERE ! undefined $newName ... to be replaced by $dirName, isn't it ?? :-)
$contentsDir = scandir($fileName);
foreach($contentsDir as $element){
if($element != "." && $element !=".."){
$this->recursiveInsert($myZip, $fileName."/".$element, $basePath);
}
}
}else{
$newName = substr($fileName, $length + 1);
$myZip->addFile($fileName, $newName);
}
}
We'll check that.
Thanks.
Regarding the Issue with the file being corrupt. After searching, I found that there is supposedly extra html or php headers being appended to the end of the document.
The workaround that others found and posted is as follows,
[code]
/*
* Old code that was working but gave corrupt file that had to be recovered.
*/
//$docx->createDocx('../phpdocx/phpdocx_pro/Output/MPS_Assessment');
//$docx->createDocxAndDownload('../phpdocx/phpdocx_pro/Output/test');
$filename = '../phpdocx/phpdocx_pro/Output/test';//<< My document is going to be called Test and placed in a directory.
$docx->createDocx($filename);//<< Create my Document
unset($docx);
header("Content-Type: application/vnd.ms-word");
header("Content-Length: ".filesize($filename.'.docx'));
header('Content-Disposition: attachment; filename=MPS_Assessment.docx');
header('Content-Transfer-Encoding: binary');
ob_clean();
flush();
readfile($filename.'.docx');//<< Sends the file to the user for download
unlink($filename.'.docx');//<< removes the file from the server for security reasons, comment out to keep if you want to retain a copy.
exit;//<< REQUIRED TO STOP THE ANNOYING CORRUPT NOTICE
[/code]
Hope this helps you out, all credit to the original writers that posted over on stackoverflow
jc