2

I'm trying to use qz-tray for printing a raw html that contains a table that can go over 2-3 pages.. I put a table head so that it repeats on every page.. But once i send to data to qz tray, i don't see the heads being repeated, also the print is quite pixelated.

const config = qz.configs.create('printerName');
const data = [{
  type: 'html',
  format: 'plain',
  scaleContent: false,
  data: htmlToRender,
}];
return qz.print(config, data);
JiN
  • 818
  • 1
  • 7
  • 14

1 Answers1

0

html that contains a table that can go over 2-3 pages.

At time of writing this, QZ Tray uses Java FX's HTML WebView under the covers, incapable of honoring @media print or page-break styles.

the print is quite pixelated

This is a limitation of QZ Tray 2.0. It used Java 7's WebView and took a screenshot of the HTML content.

QZ Tray 2.1 fixes the quality issues by using Java 8's WebView, which has basic printing support, no longer requiring the poor-quality screenshot code.

Note, QZ Tray's PDF API doesn't suffer either of the above issues, but you would need an intermediary PDF converter step.

tresf
  • 7,103
  • 6
  • 40
  • 101