Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

757
Views
UI style changes when downloading PDF file using html2pdf

I'm using html2pdf to convert a html page to PDF file and download it. Everything is working fine in term of conversion and the PDF file is downloaded successfully, but when clicking on a button to generate the file a weird behavior is happening, the UI changes for a seconde ( colors, size and text font of the elements changes as shown in the attached captions )

html2pdf script :

          var opt = {
          pagebreak :   { after : ['.Card'] },
          margin:       1,
          filename:     'qrCodes.pdf',
          image:        { type: 'png', quality: 0.98 },
          html2canvas:  { scale: 2 },
          jsPDF:        { unit: 'pt', format: 'letter', orientation: 'portrait' }
        };
        html2pdf().from(myDocument).set(opt).save();

Normal UI state: Picture of normal UI state When generating the PDF: Picture of UI weird behavior When generating the PDF

This issue drives me crazy, any solutions ?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The problem is caused by the fact that JavaScript is single threaded so this type of processes must be implemented in separate thread via service workers for example. Actually this issue opened but not solved in html2pdf : The html2pdf processing freezes the UI

or as a workaround you can launch the conversion process in a separated component so it doesn't affects the current UI.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!