Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Path must be absolute ("/tmp/") - Windows machine #33

Closed
Soufraz opened this issue Aug 22, 2014 · 15 comments
Closed

Path must be absolute ("/tmp/") - Windows machine #33

Soufraz opened this issue Aug 22, 2014 · 15 comments
Labels

Comments

@Soufraz
Copy link

Soufraz commented Aug 22, 2014

Hi folks,
On windows run a xampp server, when I try generate a pdf with wkhtmltopdf, I get this error:

Path must be absolute ("/tmp/")

How to fixed this specifically on windows?
I need set my windows path tmp? I did try it, buth nothing yet..
Thanks advance..

@Soufraz
Copy link
Author

Soufraz commented Aug 22, 2014

I fixed enter the full path to a tmp folder I created in my root project folder in windows ..
But now, when I try to regenerate the wkhtmltopdf says: 'WKHTMLTODPF did not return any data'
I need to configure something specific to windows ??

@chonthu
Copy link
Member

chonthu commented Aug 23, 2014

http://wkhtmltopdf.org/downloads.html youll need to download the windows binary and point your config to the right path

@briedis
Copy link

briedis commented Aug 28, 2014

I created a config file for my local environment (windows) in this path:

app/config/packages/nitmedia/wkhtml2pdf/local/config.php

And the contents look like this:

return [
    'debug' => true,
    'binpath' => '/Program Files/wkhtmltopdf/bin/',
    'binfile' => 'wkhtmltopdf.exe',
    'tmppath' => '/tmp/',
];

I created an empty directory too (so it matches needed /tmp/ path):

C:\\tmp\

@parhs
Copy link

parhs commented Aug 31, 2014

Did it work ? I didnt have any luck and I used this fork . https://github.com/vodun/wkhtml2pdf

It seems to work fine. Seems/claims that it works fine for large files

@chonthu
Copy link
Member

chonthu commented Sep 3, 2014

Don't see much changes other than the config file pointing to a windows executable

@parhs
Copy link

parhs commented Sep 3, 2014

On my windows machine to get it working I had to make these changes but at pipeexec() it hangs for ever. A quick fix was to disable error pipe.I guess the problem is that windows and with php work in blocking mode with pipes no matter your setting.
I am going to provide another solution that should work as nonblocking but not sure about its quality.

@briedis
Copy link

briedis commented Sep 3, 2014

@parhs YES! I had the same problem! Windows7, downloaded win executable. It hangs on fgets() call, loads forever... Sometimes it even generates the pdf, but mostly freezes.

@parhs
Copy link

parhs commented Sep 3, 2014

@briedis Does setting this false works for you ?

https://github.com/NitMedia/wkhtml2pdf/blob/master/src/Nitmedia/Wkhtml2pdf/Wkhtml2pdf.php#L939

I mean for me seems to work as a quick temp fix.

@briedis
Copy link

briedis commented Sep 4, 2014

@parhs Yes, setting $read_error = true; to false solves the problem on windows (7)! Thanks!

@chonthu
Copy link
Member

chonthu commented Sep 4, 2014

Ok, let me make that into a config option then, so you don't have to edit the core files

Nithin Meppurathu

On Sep 4, 2014, at 6:27 AM, briedis notifications@github.com wrote:

@parhs Yes, setting $read_error = true; to false solves the problem on windows (7)! Thanks!


Reply to this email directly or view it on GitHub.

@cristinadd
Copy link

Hi,
I am on windows and run a xampp server too, I tried all things above, downloaded the windows binary creating the config file,the tmp directory, set $read_error = false but I get ["stderr"]=> string(101) "'C:\Program' is not recognized as an internal or external command, operable program or batch file. "
I installed the wkhtmltopdf in another location,and the error is not displaying anymore, but it still doesn't create the pdf, just the html in the tmp directory. I am using laravel 4.1.31.

@parhs
Copy link

parhs commented Feb 2, 2015

@cristinadd I said read_output for false check the link. However clonthu might have added it

@cristinadd
Copy link

@parhs Thanks for your replay, I set and $read_output = false but nothing happens, just the html is outputted.

@chonthu chonthu added the bug label Mar 11, 2016
@bretto36
Copy link
Contributor

@cristinadd Can you install the files in c: instead of in Program files folder as the shell commands don't like spaces. You normally have to use the special naming for Program~% or something like that. It was easier to uninstall the files, then reinstall in a base folder. C:/wkhtml2pdf/

@nahuelhds
Copy link

In my case, I'm on windows 64 bits, and the problem was because the wkhtmltopdf-i386 is 32bits, so I needed to include the 64 bits binary. Plus, I've renamed the file with ".exe" to make it work.

@Soufraz Soufraz closed this as completed Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants