Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

754
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda