0

I'm trying to run the 36chartreadwritePDF.php example of PHPExcel. I have the lastest of the jpgraph and mpdf library placed within the Example folder of the PHPExcel folder (as folders mpdf and jpgraph respectively). Now To link the code to the library, this is what I have:

$rendererLibrary = 'mpdf.php';
//$rendererLibrary = 'domPDF0.6.0beta3';
$rendererLibraryPath = dirname(__FILE__) . '/mpdf/src/' . $rendererLibrary;

$rendererLibrary = 'jpgraph.php';
$rendererLibraryPath = dirname(__FILE__) . '/jpgraph/src/' . $rendererLibrary;

I tried to echo the first $rendererLibraryPath I got C:\wamp\www\PHPExcel\Examples/mpdf/src/mpdf.php which really cannot load the library cause the there is a coombination of backslashes \ and forwardslashes /

Now if I change /jpgraph/src/ to \jpgraph\src\ and /mpdf/src/ to \mpdf\src\ I typically get a unexpected string error.

So what's the way around this to link the libraries right on windows (8.1)

Ojchris
  • 188
  • 1
  • 3
  • 11

1 Answers1

0

I solved this by adding the line:

$rendererLibraryPath = str_replace('/', '\\', $rendererLibraryPath);
Ojchris
  • 188
  • 1
  • 3
  • 11
  • why not just modify to $rendererLibraryPath = dirname(__FILE__) . '\\mpdf\\src\\' . $rendererLibrary; $rendererLibrary = 'jpgraph.php'; $rendererLibraryPath = dirname(__FILE__) . '\\jpgraph\\src\\' . $rendererLibrary; – JoSSte Mar 30 '17 at 10:19
  • thanks @JoSSte Yea that works too. But despite the correct path I'm now getting 'Unable to load PDF Rendering library' error seems PHPExcel might not be compatible with mpdf 7.0. Any experince with mdf 7.0 and phpexcel? – Ojchris Mar 30 '17 at 10:42
  • I have a project using phpexcel but I don't think i use those two libraries. I will try running 36chartreadwritePDF.php when I get home. It'll be at least 6 hours from now. – JoSSte Mar 30 '17 at 10:43
  • @JoSSte please were you able to try this out? – Ojchris Apr 03 '17 at 13:06
  • I've been backed up. I will try and squeeze it in tonight. – JoSSte Apr 04 '17 at 10:32
  • I have gone through, and checked, and I do not have a mdpf folder in PHPexcel/Examples. which versionare you using I'm using the repo at https://github.com/PHPOffice/PHPExcel.git . Looking at questions like http://stackoverflow.com/questions/6954294/is-the-jpgraph-library-dead?rq=1 from 2014 i think you have a very old version of the library. maybe you should try a newer edition? – JoSSte Apr 08 '17 at 09:11
  • Not really. I have the version 1.8. MPDF and JPGRAPH are library folders. I placed each in the example folder so as to be able to reference them as dependencies for use in generating the PDF charts for example file 36chartreadwritePDF.php. – Ojchris Apr 12 '17 at 05:56