1

On my windows with xamp local server I follow pdf generator from html step 1 & 2 (wkhtmltopdf http://www.test.com test.pdf) goes fine but step 3

3. In php you should execute the tool using shell_exec:

shell_exec("/usr/local/bin/wkhtmltopdf-i386 http://test.com test.pdf");
//for Linux 32 bits operating system
//for Linux 64 bits operating system use wkhtmltopdf-amd64
//for windows just put the path of the exe file.
$allfile = file_get_contents("test.pdf");
header('Content-Type: application/pdf');
header('Content-Length: '.strlen($allfile));
header('Content-Disposition: inline; filename="test.pdf"');
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');
ini_set('zlib.output_compression','0');

does not do any thing... :(

I installed at e drive and used:

exec("e:\wkhtmltopdf\wkhtmltopdf.exe http://www.google.com/ test.pdf");

Actually I creates PDF correctly but does not send output to browser.. any idea what I had missed ...?

Community
  • 1
  • 1
PHP Ferrari
  • 15,754
  • 27
  • 83
  • 149
  • Is this still an issue? Anything solved, any progress reports? I still stand by my answer, this looks like a path issue. – Joel Peltonen Oct 21 '13 at 07:03

1 Answers1

0

I'm guessing but the issue might be file locations. Does file_get_contents actually find the file?

I'm not very sure where the pdf file gets generated during the exec, try to use full paths for both the output pdf location and the file_get_contents location, they might not be correct by default. Maby even check somehow that the files exist and what folder are they both using (I cant remember how to do this in PHP :))

Joel Peltonen
  • 13,025
  • 6
  • 64
  • 100