Skip to content

Spawn Error - Windows 10 #127

Description

@Samerkassem

I have:

this.wkhtmltopdf = async function () {
    try {
        console.log("createpdf")
        var response = await $http({
            url: '/wkhtmltopdf',
            method: "POST",
            responseType: 'blob',
            data:{"b":"XXX"}
        });

        if (response.status != 200) {
            this.message = this.gs("downloadFailed", "There was an error downloading the file");
            return;
        }

        var blob = new Blob([response.data], { type: 'application/*' });
        saveAs(blob, 'test.pdf');
    } catch (err) {
        $window.alert('There was an error in getting the file');
    }
};

It is installed in package:

"wkhtmltopdf": "^0.3.4"

I have installed the tool from their official website as recommended by SO users in other threads, and in the official npm:
https://www.npmjs.com/package/wkhtmltopdf

From https://wkhtmltopdf.org/downloads.html#stable

I have this PATH in my environment variables, both User and System vars enter image description here

And STILL getting this error on my machine, but on cloud it's working:

C:\Users\Samer\Desktop\ALL fineon projects\azure-fineon-webapp-fo\node_modules\wkhtmltopdf\index.js:161
    throw new Error(err); // critical error
    ^

Error: Error: spawn wkhtmltopdf ENOENT
    at ChildProcess.<anonymous> (C:\Users\xxx\Desktop\ALL xxprojects\azure-xx-webapp-fo\node_modules\wkhtmltopdf\index.js:161:11)
    at Object.onceWrapper (events.js:286:20)
    at ChildProcess.emit (events.js:198:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
    at onErrorNT (internal/child_process.js:415:16)

So what else to do?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions