Skip to content

passing binary path #83

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

Closed
giulioprovasi opened this issue Dec 19, 2014 · 4 comments
Closed

passing binary path #83

giulioprovasi opened this issue Dec 19, 2014 · 4 comments

Comments

@giulioprovasi
Copy link

I have a problem when specifying a binary path with spaces in it:

"C:\Program Files..." doesn't work (Cannot find "C:\Program" error)

I've tried to add double quotes when passing it to the Pdf generator but I always get the same error.

Can you help me with this ?

@mikehaertl
Copy link
Owner

This is caused by this unsolved bug: mikehaertl/php-shellcommand#1

As I've explained there, I don't (and never will) use Windows for development, so it's a bit hard for me to debug the problem. But if you can help out to fix the above issue with shellcommands on windows I'm happy to include it. Feel free to further discuss the problem there.

@mikehaertl
Copy link
Owner

One more thing: Have you tried to set escapeCommand in the commandOptions? See here for how to set these options: https://github.com/mikehaertl/phpwkhtmltopdf#note-for-windows-users. You can try to replace the esacpeArgs line with 'escapeCommand' => true.

@giulioprovasi
Copy link
Author

I don't use windows either, but I have to use wkhtmltopdf on a windows production environment, that's why.

For now, I'll use a binary path without spaces, but i'll take a look the the command line project to see if I can solve this issue.

Edit: i've tried the escape, no difference

@giulioprovasi
Copy link
Author

I temporarily solved the problem by doing this:

$globalOptions = Zend_Registry::get('pdf');
$pdfOptions['commandOptions'] = array(
            'command' => '"' . $globalOptions['binary'] . '"',
            'escapeArgs' => false,
            'escapeCommand' => true,
            'procOptions' => array(
                // This will bypass the cmd.exe which seems to be recommended
                'bypass_shell' => true
            ),
        );

instead of passing the "binary" option directly to the pdf generator.
It's not the cleanest solution, but it allows to correct the bug without any changes to the library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants