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.

Deprecation warning using minified version jspdf

See original GitHub issue

Running an export causes a warning about eventual deprecation, is this known or maybe already fixed?

jspdf.es.min.js?8baf:197 [Deprecation] Synchronous

[Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user’s experience. For more help, check https://xhr.spec.whatwg.org/.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8

github_iconTop GitHub Comments

3reactions
HackbrettXXXcommented, Nov 6, 2020

I assume the warning comes when loading images from a URL? The thing is, that the API of addImage is synchronous for historic reasons and we therefore need to make synchronous requests. There is an easy workaround, though, by preloading the image and passing it e.g. as data url to the addImage method. We might consider making addImage optionally async.

0reactions
PatricNoxcommented, Nov 11, 2021

I lost track of this issue, I’m so sorry. @Steflie comment made a ping so I found it again.

I solved it by doing like so:

  private setDocumentImage(): void {
    const image = new Image();
    image.src = PDFExport.APP_IMAGE_PATH;
    this.document.addImage(
      image,
      "png",
      PDFExport.APP_IMAGE.position.x,
      PDFExport.APP_IMAGE.position.y,
      PDFExport.APP_IMAGE.dimension.width,
      PDFExport.APP_IMAGE.dimension.height,
    );
  }
Read more comments on GitHub >

github_iconTop Results From Across the Web

Deprecation warning using minified version jspdf · Issue #2994
I assume the warning comes when loading images from a URL? The thing is, that the API of addImage is synchronous for historic...
Read more >
How to properly use jsPDF library - javascript - Stack Overflow
Using the debug version of jspdf worked, where the other versions in any configuration did not. Maybe minification is breaking it somehow? or...
Read more >
jsPDF: Client-side JavaScript PDF Generation for Everyone
A library to generate PDFs in JavaScript. ... In "compat" API mode, jsPDF has the same API as MrRio's original version, which means...
Read more >
jspdf - npm
PDF Document creation from JavaScript. Latest version: 2.5.1, last published: a year ago. Start using jspdf in your project by running `npm ...
Read more >
jsPDF table example - Unsaved project - Plunker
See mrrio.github.io/jsPDF/doc/symbols/PubSub.html * Backward compatible ... and ')' with pdf-safe versions * * Doing to8bitStream does NOT make this PDF ...
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