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

146
Visualizações
Use toDataUrl 4 times or more, window.print causes a freezing tab in Chrome

I want to print charts from chartJs. For this purpose, I use the function document.getElementById('myChart').toDataURL();. The element of the id is my canvas, that is created by chartJs. Then, I build the content that I want to print. Later on, I print them using the function window.open().print().

At the beginning, it was working fine using one or two charts. But as soon as I add to the content a 4th chart, my Tab is freezing in Chrome. So I cant act in the form anymore and I have to close the Tab.

I created a jsFiddle to demonstrate it. To see the problem, you have to click on the "please print me" button.

Here is a running version, where I just print 3 Charts. You can print it as often as you want and you can use the select next to it: https://jsfiddle.net/u49e7qmL/2/

Here is a not running version, where I just print 4 Charts. As soon as you click on print, the tab makes a problem. You cannot print a 2nd time. Additionally you cannot use the select next to it. In my application, the whole tab freezes: https://jsfiddle.net/u49e7qmL/3/

What do I have to do that I can keep using the tab like when I print with just 3 elements?

about 4 years ago · Juan Pablo Isaza
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