tray
tray copied to clipboard
HTML scaleContent 2.0 vs 2.1
In 2.1 using scaleContent: true, the full width of the page is not used.
Below is an HTML page containing a table that will span to 2 pages (in 2.1) if scaleContent: false
HTML to Reproduce
<!DOCTYPE html>
<html>
<body>
<div>
<table style="width:100%">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>1</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>2</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>3</td>
</tr>
<tr>
<td>Eve1</td>
<td>Jackson1</td>
<td>4</td>
</tr>
<tr>
<td>Eve2</td>
<td>Jackson2</td>
<td>5</td>
</tr>
<tr>
<td>Eve3</td>
<td>Jackson3</td>
<td>6</td>
</tr>
<tr>
<td>Eve4</td>
<td>Jackson4</td>
<td>7</td>
</tr>
<tr>
<td>Eve5</td>
<td>Jackson5</td>
<td>8</td>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>9</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>10</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>11</td>
</tr>
<tr>
<td>Eve1</td>
<td>Jackson1</td>
<td>12</td>
</tr>
<tr>
<td>Eve2</td>
<td>Jackson2</td>
<td>13</td>
</tr>
<tr>
<td>Eve3</td>
<td>Jackson3</td>
<td>14</td>
</tr>
<tr>
<td>Eve4</td>
<td>Jackson4</td>
<td>15</td>
</tr>
<tr>
<td>Eve5</td>
<td>Jackson5</td>
<td>16</td>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>17</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>18</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>19</td>
</tr>
<tr>
<td>Eve1</td>
<td>20</td>
</tr>
</table>
<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>1</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>2</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>3</td>
</tr>
<tr>
<td>Eve1</td>
<td>Jackson1</td>
<td>4</td>
</tr>
<tr>
<td>Eve2</td>
<td>Jackson2</td>
<td>5</td>
</tr>
<tr>
<td>Eve3</td>
<td>Jackson3</td>
<td>6</td>
</tr>
<tr>
<td>Eve4</td>
<td>Jackson4</td>
<td>7</td>
</tr>
<tr>
<td>Eve5</td>
<td>Jackson5</td>
<td>8</td>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>9</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>10</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>11</td>
</tr>
<tr>
<td>Eve1</td>
<td>Jackson1</td>
<td>12</td>
</tr>
<tr>
<td>Eve2</td>
<td>Jackson2</td>
<td>13</td>
</tr>
<tr>
<td>Eve3</td>
<td>Jackson3</td>
<td>14</td>
</tr>
<tr>
<td>Eve4</td>
<td>Jackson4</td>
<td>15</td>
</tr>
<tr>
<td>Eve5</td>
<td>Jackson5</td>
<td>16</td>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>17</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>18</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>19</td>
</tr>
<tr>
<td>Eve1</td>
<td>20-LAST ROW</td>
</tr>
</table>
</div>
</body>
</html>
function printHTML() {
var config = qz.configs.create("PDF", {size: { width: 4, height: 6 }, scaleContent: true });
var printData = [
{
//2.9
type: 'html',
format: 'file',
data: 'table.html'
//2.1
// type: 'pixel',
// format: 'html',
// flavor: 'file',
// data: 'table.html'
}
];
qz.print(config, printData).catch(displayError);
}

2.0.9 stacktrace
[DEBUG] 2019-03-18 21:05:03,182 @ qz.ws.PrintSocketClient:?
Message: {"call":"print","promise":{},"params":{"printer":{"name":"PDF"},"options":{"colorType":"color","copies":1,"density":0,"duplex":false,"fallbackDensity":null,"interpolation":"bicubic","jobName":null,"legacy":false,"margins":0,"orientation":null,"paperThickness":null,"printerTray":null,"rasterize":true,"rotation":0,"scaleContent":true,"size":{"width":4,"height":6},"units":"in","altPrinting":false,"encoding":null,"endOfDoc":null,"perSpool":1},"data":[{"type":"html","format":"file","data":"file:///Applications/QZ%20Tray.app/demo/table.html"}]},"timestamp":1552957503176,"uid":"wrf8nz","position":{"x":720,"y":421.5}}
[WARN] 2019-03-18 21:05:03,191 @ qz.ws.PrintSocketClient:?
Bad signature on request
[DEBUG] 2019-03-18 21:05:03,225 @ qz.common.TrayManager:?
Calculated dialog centered at: java.awt.Point[x=550,y=335]
[INFO] 2019-03-18 21:05:04,370 @ qz.common.TrayManager:?
Allowed localhost to print to PDF
[DEBUG] 2019-03-18 21:05:04,468 @ qz.utils.PrintingUtilities:?
Allowing 7 simultaneous processors based on memory available (3817 MB)
[TRACE] 2019-03-18 21:05:04,470 @ qz.utils.PrintingUtilities:?
Waiting for processor, 0/7 already in use
[DEBUG] 2019-03-18 21:05:04,484 @ qz.utils.PrintingUtilities:?
Using qz.printer.action.PrintHTML to print
[DEBUG] 2019-03-18 21:05:04,500 @ qz.printer.PrintServiceMatcher:?
Searching for PrintService matching PDF
[DEBUG] 2019-03-18 21:05:04,669 @ qz.printer.PrintServiceMatcher:?
Found 3 printers
[DEBUG] 2019-03-18 21:05:04,727 @ qz.printer.PrintServiceMatcher:?
Found match: PDFwriter
[DEBUG] 2019-03-18 21:05:04,743 @ qz.utils.ShellUtilities:?
Executing: [lpstat, -a]
[DEBUG] 2019-03-18 21:05:04,775 @ qz.utils.ShellUtilities:?
Executing: [lpstat, -l, -p, EPSON_WF_3730_Series]
[INFO] 2019-03-18 21:05:04,800 @ qz.utils.ShellUtilities:?
EPSON_WF_3730_Series: EPSON WF-3730 Series
[DEBUG] 2019-03-18 21:05:04,802 @ qz.utils.ShellUtilities:?
Executing: [lpstat, -l, -p, Zebra_Pixel]
[INFO] 2019-03-18 21:05:04,832 @ qz.utils.ShellUtilities:?
Zebra_Pixel: Zebra LP2844
[DEBUG] 2019-03-18 21:05:04,832 @ qz.utils.ShellUtilities:?
Executing: [lpstat, -l, -p, PDFwriter]
[INFO] 2019-03-18 21:05:04,861 @ qz.utils.ShellUtilities:?
PDFwriter: PDFwriter
[DEBUG] 2019-03-18 21:05:04,861 @ qz.utils.ShellUtilities:?
Executing: [lpoptions, -p, EPSON_WF_3730_Series, -l]
[DEBUG] 2019-03-18 21:05:04,895 @ qz.utils.ShellUtilities:?
Executing: [lpoptions, -p, Zebra_Pixel, -l]
[DEBUG] 2019-03-18 21:05:04,933 @ qz.utils.ShellUtilities:?
Parsed default density from CUPS Zebra_Pixel: 203dpi
[DEBUG] 2019-03-18 21:05:04,934 @ qz.utils.ShellUtilities:?
Executing: [lpoptions, -p, PDFwriter, -l]
[WARN] 2019-03-18 21:05:04,972 @ qz.printer.PrintOptions:?
Cannot read null as a double for fallbackDensity, using default
[TRACE] 2019-03-18 21:05:05,010 @ qz.printer.action.WebApp:?
Waiting for JavaFX..
[DEBUG] 2019-03-18 21:05:05,123 @ qz.printer.action.WebApp:?
Started JavaFX
[DEBUG] 2019-03-18 21:05:05,262 @ qz.printer.action.PrintHTML:?
Parsed 1 html records
[TRACE] 2019-03-18 21:05:05,263 @ qz.printer.action.WebApp:?
Waiting on capture..
[TRACE] 2019-03-18 21:05:05,597 @ qz.printer.action.WebApp:?
Done: -1.0 > 0.0
[TRACE] 2019-03-18 21:05:05,598 @ qz.printer.action.WebApp:?
New state: READY > SCHEDULED
[TRACE] 2019-03-18 21:05:05,598 @ qz.printer.action.WebApp:?
New state: SCHEDULED > RUNNING
[TRACE] 2019-03-18 21:05:05,662 @ qz.printer.action.WebApp:?
Done: 0.0 > 50.0
[TRACE] 2019-03-18 21:05:05,680 @ qz.printer.action.WebApp:?
Done: 50.0 > 100.0
[TRACE] 2019-03-18 21:05:05,681 @ qz.printer.action.WebApp:?
New state: RUNNING > SUCCEEDED
[TRACE] 2019-03-18 21:05:05,714 @ qz.printer.action.WebApp:?
Zooming in by x8.333333333333334 for increased quality
[TRACE] 2019-03-18 21:05:05,715 @ qz.printer.action.WebApp:?
Setting HTML page width to 6800.000000000001
[TRACE] 2019-03-18 21:05:05,825 @ qz.printer.action.WebApp:?
Setting HTML page height to 7991.666666666667
[DEBUG] 2019-03-18 21:05:06,095 @ qz.printer.action.WebApp:?
Attempting image capture
[TRACE] 2019-03-18 21:05:06,342 @ qz.printer.action.WebApp:?
Waiting on capture..
[WARN] 2019-03-18 21:05:07,343 @ qz.printer.action.PrintHTML:?
HTML capture failed due to size, attempting at default zoom
[TRACE] 2019-03-18 21:05:07,345 @ qz.printer.action.WebApp:?
Waiting on capture..
[TRACE] 2019-03-18 21:05:07,369 @ qz.printer.action.WebApp:?
Done: 100.0 > -1.0
[TRACE] 2019-03-18 21:05:07,369 @ qz.printer.action.WebApp:?
New state: SUCCEEDED > READY
[TRACE] 2019-03-18 21:05:07,369 @ qz.printer.action.WebApp:?
Done: -1.0 > 0.0
[TRACE] 2019-03-18 21:05:07,370 @ qz.printer.action.WebApp:?
New state: READY > SCHEDULED
[TRACE] 2019-03-18 21:05:07,371 @ qz.printer.action.WebApp:?
New state: SCHEDULED > RUNNING
[TRACE] 2019-03-18 21:05:07,408 @ qz.printer.action.WebApp:?
Done: 0.0 > 50.0
[TRACE] 2019-03-18 21:05:07,414 @ qz.printer.action.WebApp:?
Done: 50.0 > 100.0
[TRACE] 2019-03-18 21:05:07,415 @ qz.printer.action.WebApp:?
New state: RUNNING > SUCCEEDED
[TRACE] 2019-03-18 21:05:07,418 @ qz.printer.action.WebApp:?
Zooming in by x1.0 for increased quality
[TRACE] 2019-03-18 21:05:07,419 @ qz.printer.action.WebApp:?
Setting HTML page width to 816.0
[TRACE] 2019-03-18 21:05:07,524 @ qz.printer.action.WebApp:?
Setting HTML page height to 944.0
[DEBUG] 2019-03-18 21:05:07,640 @ qz.printer.action.WebApp:?
Attempting image capture
[TRACE] 2019-03-18 21:05:08,363 @ qz.printer.action.PrintPixel:?
DPI: 600.0 CNV: 72.0
[TRACE] 2019-03-18 21:05:08,364 @ qz.printer.action.PrintPixel:?
Drawable area: 0.0,0.0:4.0,6.0
[TRACE] 2019-03-18 21:05:08,364 @ qz.printer.action.PrintPixel:?
[color, (0.0,0.0)->(101.6,152.4)mm, 60000x60000 dphi]
[INFO] 2019-03-18 21:05:08,373 @ qz.printer.action.PrintPixel:?
Starting printing (1 copies)
[WARN] 2019-03-18 21:05:08,374 @ qz.printer.action.PrintPixel:?
Supported printer densities not found
[TRACE] 2019-03-18 21:05:08,441 @ qz.printer.action.PrintImage:?
Requested page 0 for printing
[TRACE] 2019-03-18 21:05:08,448 @ qz.printer.action.PrintImage:?
Requested page 0 for printing
[DEBUG] 2019-03-18 21:05:08,457 @ qz.printer.action.PrintImage:?
Scaling image up by x1.0
[DEBUG] 2019-03-18 21:05:08,463 @ qz.printer.action.PrintImage:?
Paper area: 0,0:288,432
[TRACE] 2019-03-18 21:05:08,464 @ qz.printer.action.PrintImage:?
Image size: 288.0,333.1764705882353
[TRACE] 2019-03-18 21:05:08,466 @ qz.printer.action.PrintImage:?
{Fractional metrics enable key=Integer text metrics mode, Text-specific LCD contrast key=140, Alpha blending interpolation method key=Highest quality alpha blending methods, Image interpolation method key=Bicubic image interpolation mode, Global rendering quality key=Highest quality rendering methods, Global antialiasing enable key=Antialiased rendering mode, Text-specific antialiasing enable key=Default antialiasing text mode, Color rendering quality key=Highest quality color rendering mode, Stroke normalization control key=Pure stroke conversion for accurate paths}
[DEBUG] 2019-03-18 21:05:08,470 @ qz.printer.action.PrintImage:?
Memory: 283m/3641m
[INFO] 2019-03-18 21:05:08,509 @ qz.utils.PrintingUtilities:?
Printing complete
[TRACE] 2019-03-18 21:05:08,510 @ qz.utils.PrintingUtiliti
2.1-RC6 stacktrace
[DEBUG] 2019-03-18 21:01:05,734 @ qz.ws.PrintSocketClient:?
Message: {"call":"print","promise":{},"params":{"printer":{"name":"PDF"},"options":{"colorType":"color","copies":1,"density":0,"duplex":false,"fallbackDensity":null,"interpolation":"bicubic","jobName":null,"legacy":false,"margins":0,"orientation":null,"paperThickness":null,"printerTray":null,"rasterize":false,"rotation":0,"scaleContent":true,"size":{"width":4,"height":6},"units":"in","altPrinting":false,"encoding":null,"endOfDoc":null,"perSpool":1},"data":[{"type":"html","format":"file","data":"file:///Applications/QZ%20Tray.app/demo/table.html"}]},"timestamp":1552957265731,"uid":"4ec2s2","position":{"x":720,"y":421.5}}
[WARN] 2019-03-18 21:01:05,742 @ qz.ws.PrintSocketClient:?
Bad signature on request
[DEBUG] 2019-03-18 21:01:05,810 @ qz.common.TrayManager:?
Calculated dialog centered at: java.awt.Point[x=550,y=335]
[INFO] 2019-03-18 21:01:06,732 @ qz.common.TrayManager:?
Allowed localhost to print to PDF
[DEBUG] 2019-03-18 21:01:06,824 @ qz.utils.PrintingUtilities:?
Allowing 7 simultaneous processors based on memory available (3817 MB)
[TRACE] 2019-03-18 21:01:06,828 @ qz.utils.PrintingUtilities:?
Waiting for processor, 0/7 already in use
[DEBUG] 2019-03-18 21:01:06,839 @ qz.utils.PrintingUtilities:?
Using qz.printer.action.PrintHTML to print
[DEBUG] 2019-03-18 21:01:06,843 @ qz.printer.PrintServiceMatcher:?
Searching for PrintService matching PDF
[DEBUG] 2019-03-18 21:01:07,031 @ qz.printer.PrintServiceMatcher:?
Found 3 printers
[DEBUG] 2019-03-18 21:01:07,082 @ qz.printer.PrintServiceMatcher:?
Found match: PDFwriter
[DEBUG] 2019-03-18 21:01:07,097 @ qz.utils.ShellUtilities:?
Executing: [lpstat, -a]
[DEBUG] 2019-03-18 21:01:07,131 @ qz.utils.ShellUtilities:?
Executing: [lpstat, -l, -p, EPSON_WF_3730_Series]
[INFO] 2019-03-18 21:01:07,155 @ qz.utils.ShellUtilities:?
EPSON WF-3730 Series: EPSON_WF_3730_Series
[DEBUG] 2019-03-18 21:01:07,155 @ qz.utils.ShellUtilities:?
Executing: [lpstat, -l, -p, PDFwriter]
[INFO] 2019-03-18 21:01:07,184 @ qz.utils.ShellUtilities:?
PDFwriter: PDFwriter
[DEBUG] 2019-03-18 21:01:07,184 @ qz.utils.ShellUtilities:?
Executing: [lpstat, -l, -p, Zebra_Pixel]
[INFO] 2019-03-18 21:01:07,213 @ qz.utils.ShellUtilities:?
Zebra LP2844: Zebra_Pixel
[DEBUG] 2019-03-18 21:01:07,214 @ qz.utils.ShellUtilities:?
Executing: [lpoptions, -p, EPSON WF-3730 Series, -l]
[DEBUG] 2019-03-18 21:01:07,253 @ qz.utils.ShellUtilities:?
Executing: [lpoptions, -p, PDFwriter, -l]
[DEBUG] 2019-03-18 21:01:07,282 @ qz.utils.ShellUtilities:?
Executing: [lpoptions, -p, Zebra LP2844, -l]
[WARN] 2019-03-18 21:01:07,316 @ qz.printer.PrintOptions:?
Cannot read null as a double for fallbackDensity, using default
[TRACE] 2019-03-18 21:01:07,348 @ qz.printer.action.WebApp:?
Waiting for JavaFX..
[DEBUG] 2019-03-18 21:01:07,454 @ qz.printer.action.WebApp:?
Started JavaFX
[DEBUG] 2019-03-18 21:01:07,604 @ qz.printer.action.PrintHTML:?
Parsed 1 html records
[TRACE] 2019-03-18 21:01:07,728 @ qz.printer.action.PrintHTML:?
Collation = UNCOLLATED
Copies = 1
Sides = ONE_SIDED
JobName = QZ Tray HTML Print
Page ranges = null
Print color = COLOR
Print quality = NORMAL
Print resolution = Feed res=300dpi. Cross Feed res=300dpi.
Paper source = Paper source : Automatic
Page layout = Paper=Paper: Custom size=4.0x6.0 INCH Orient=PORTRAIT leftMargin=0.0 rightMargin=0.0 topMargin=0.0 bottomMargin=0.0
[TRACE] 2019-03-18 21:01:07,819 @ qz.printer.action.WebApp:?
Waiting on print..
[TRACE] 2019-03-18 21:01:08,019 @ qz.printer.action.WebApp:?
Setting starting size 384.0:0.0
[TRACE] 2019-03-18 21:01:08,048 @ qz.printer.action.WebApp:?
Done: -1.0 > 0.0
[TRACE] 2019-03-18 21:01:08,049 @ qz.printer.action.WebApp:?
New state: READY > SCHEDULED
[TRACE] 2019-03-18 21:01:08,050 @ qz.printer.action.WebApp:?
New state: SCHEDULED > RUNNING
[TRACE] 2019-03-18 21:01:08,084 @ qz.printer.action.WebApp:?
Done: 0.0 > 50.0
[TRACE] 2019-03-18 21:01:08,112 @ qz.printer.action.WebApp:?
Done: 50.0 > 100.0
[TRACE] 2019-03-18 21:01:08,113 @ qz.printer.action.WebApp:?
New state: RUNNING > SUCCEEDED
[TRACE] 2019-03-18 21:01:08,139 @ qz.printer.action.WebApp:?
Setting HTML page height to 944.0
[DEBUG] 2019-03-18 21:01:08,281 @ qz.printer.action.WebApp:?
Paper area: 0,0:288,432
[DEBUG] 2019-03-18 21:01:08,282 @ qz.printer.action.WebApp:?
Document will be printed across 1 pages
[INFO] 2019-03-18 21:01:08,820 @ qz.utils.PrintingUtilities:?
Printing complete
[TRACE] 2019-03-18 21:01:08,823 @ qz.utils.PrintingUtilities:?
Returning processor back to pool
I seem to have kind of the same issue, if I have scaleContent set to true, it is a bit more than half the A4 page, and if I have it set to false, it goes to the second page.
I seem to have kind of the same issue, if I have scaleContent set to true, it is a bit more than half the A4 page, and if I have it set to false, it goes to the second page.
Do you mind sharing some sample HTML?
I seem to have kind of the same issue, if I have scaleContent set to true, it is a bit more than half the A4 page, and if I have it set to false, it goes to the second page.
Do you mind sharing some sample HTML?
Hello, sorry for late reply, lost track of the notification.
Apparently I got it fixed, the issue for me was that the HTML content, was overflowing the actual page sizes.
In preview, everything looked good because apparently overflow:hidden worked in the preview, but when printing, it scaled the whole page to make the whole HTML visible, no matter the overflow: hidden.
I fixed it by making sure no elements are overflowing the page sizes.
I seem to have kind of the same issue, if I have scaleContent set to true, it is a bit more than half the A4 page, and if I have it set to false, it goes to the second page.
Do you mind sharing some sample HTML?
Hello, sorry for late reply, lost track of the notification.
Apparently I got it fixed, the issue for me was that the HTML content, was overflowing the actual page sizes.
In preview, everything looked good because apparently overflow:hidden worked in the preview, but when printing, it scaled the whole page to make the whole HTML visible, no matter the overflow: hidden.
I fixed it by making sure no elements are overflowing the page sizes.
Thanks for the update!