question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Does jspdf even work server side ?

See original GitHub issue

###Does jspdf even work server side ?

Same Issue #566 #1891 😦

node -v 
v11.5.0

"jspdf": "^1.5.3",

/home/unknown/.nvm/versions/node/v11.5.0/lib/node_modules/ts-node/src/index.ts:261 return new TSError(diagnosticText, diagnosticCodes) ^ TSError: ⨯ Unable to compile TypeScript: test-jspdf.ts(18,8): error TS2339: Property ‘window’ does not exist on type ‘Global’. test-jspdf.ts(19,8): error TS2339: Property ‘navigator’ does not exist on type ‘Global’. test-jspdf.ts(20,8): error TS2339: Property ‘btoa’ does not exist on type ‘Global’.

at createTSError (/home/unknown/.nvm/versions/node/v11.5.0/lib/node_modules/ts-node/src/index.ts:261:12)
at getOutput (/home/unknown/.nvm/versions/node/v11.5.0/lib/node_modules/ts-node/src/index.ts:367:40)
at Object.compile (/home/unknown/.nvm/versions/node/v11.5.0/lib/node_modules/ts-node/src/index.ts:558:11)
at Module.m._compile (/home/unknown/.nvm/versions/node/v11.5.0/lib/node_modules/ts-node/src/index.ts:439:43)
at Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Object.require.extensions.(anonymous function) [as .ts] (/home/unknown/.nvm/versions/node/v11.5.0/lib/node_modules/ts-node/src/index.ts:442:12)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:774:12)

Even if it is run directly in JS, we have following issue

ReferenceError: html2pdf is not defined
    at /home/unknown/Projects/project-api/node_modules/jspdf/dist/jspdf.min.js:202:16291
    at /home/unknown/Projects/project-api/node_modules/jspdf/dist/jspdf.min.js:1:124
    at Object.<anonymous> (/home/unknown/Projects/project-api/node_modules/jspdf/dist/jspdf.min.js:1:128)
    at Module._compile (internal/modules/cjs/loader.js:721:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
    at Module.load (internal/modules/cjs/loader.js:620:32)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:15

github_iconTop GitHub Comments

0reactions
Uzlopakcommented, Apr 11, 2019

You have to clone the repository and then run in your console npm run-script build. If you do it in your project-folder then there is no wonder, that it doesnt work 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Does jspdf even work server side ? · Issue #2226 - GitHub
And it is not really a matter if jsPdf works only front side because JsPdf is already one of the greatest JS lib...
Read more >
jsPDF server side (node.js) usage using node-jspdf
You can actually use jspdf directly ( npm install jspdf instead of npm install node-jspdf ). Jspdf is currently (v1.3.2) not built with...
Read more >
jsPDF PDF Generation Library Crash Course 2022 in Node.js ...
jspdf #nodejs #expressVisit my Online Free Media Tool Website ... [What is AJAX and How it Works | Short Tutorial for Beginners] ...
Read more >
Rendering PDF files in the browser with JS - 60devs
There are 2 ways of rendering PDFs for your website or application. The first way is the server-side rendering, which is probably the...
Read more >
Export Pdf to Serer – We can not find the parameter for server ...
Please kindly note that the jsPDF object is used only for PDF export ... this answer works for exporting from the client to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found