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

How to specify the working directory - cwd #137

Open
abdennour opened this issue Jul 6, 2021 · 3 comments
Open

How to specify the working directory - cwd #137

abdennour opened this issue Jul 6, 2021 · 3 comments

Comments

@abdennour
Copy link

var stream = wkhtmltopdf(fs.createReadStream('file.html'));

but i need to navigate inside the directory where the file.html resides (/i.e: /data/files)so the relative paths inside the html file (./style.css ,... so on) is resolvable.

Note that it works with the following snippet:

execSync('wkhtmltopdf file.html file.pdf', {cwd: '/data/files'})
@abdennour
Copy link
Author

as per official docs of the command line , there is an option called --cache-dir.
I used it and it works :

wkhtmltopdf(fs.createReadStream('file.html'), {cacheDir: '/data/files' });

@abdennour
Copy link
Author

please reopen this issue.
I was wrong

@abdennour abdennour reopened this Jul 6, 2021
@Its-Just-Nans
Copy link

Its-Just-Nans commented Aug 13, 2021

Hi,

I think you can try to do that :

wkhtmltopdf('http://google.com/', {
    spawnOptions : {
        cwd : '/data/files'
    }
})

Reference :

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

No branches or pull requests

2 participants