1 thought on “Responsive causes problem with print

  1. This can be solved with the following code:

    function beforePrint () {
      for (const id in Chart.instances) {
        Chart.instances[id].resize()
      }
    }
    
    if (window.matchMedia) {
      let mediaQueryList = window.matchMedia('print')
      mediaQueryList.addListener((mql) => {
        if (mql.matches) {
          beforePrint()
        }
      })
    }
    
    window.onbeforeprint = beforePrint

    Basically hook into the print event and resize all of the charts.

Comments are closed.