How do I include Vuetify css on Vue js print?

303 Views Asked by At

I have tried this code

      // Get HTML to print from element
      const prtHtml = document.getElementById('print').innerHTML;

      // Get all stylesheets HTML
      let stylesHtml = '';
      for (const node of [...document.querySelectorAll('link[rel="stylesheet"], style')]) {
        stylesHtml += node.outerHTML;
      }
      console.log(stylesHtml);

      // Open the print window
      const WinPrint = window.open();

      WinPrint.document.write(`<!DOCTYPE html>
      <html>
        <head>
          ${stylesHtml}
        </head>
        <body>
          ${prtHtml}
        </body>
      </html>`);

      WinPrint.document.close();
      WinPrint.focus();
      WinPrint.print();
      WinPrint.close();

but it only add portions of vuetify css like v-btn. My problem is I am printing with a lot of helpers like d-flex text-right on a div but not working with this code.

0

There are 0 best solutions below