Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent HTML printing #32

Closed
klabarge opened this issue Apr 12, 2016 · 27 comments
Closed

Inconsistent HTML printing #32

klabarge opened this issue Apr 12, 2016 · 27 comments

Comments

@klabarge
Copy link
Member

I sent 10 identical print jobs to a PDF printer on Ubuntu 14.04. I used complete defaults from https://demo.qz.io/ except I changed the job name for each print.

I don't see any difference in the console between the three different outcomes, but I have provided the stacktraces anyway. I have not provided logs for rasterize : false but can be provided if needed.

Here are the results:

  • (2) sent as 17.9kb
  • (3) sent as 36.3kb
  • (5) sent as 136.7kb

I then sent an additional 10 jobs with rasterize : false

  • (8) 19.8kb
  • (1) 9.0kb
  • (1) 20.5kb

With Rastorize

  1. 17.9kb

    • Result:
      image
    • Stacktrace:
    [DEBUG] 2016-04-12 01:14:26,074 @ qz.ws.PrintSocketClient:?
    Message: {"call":"print","promise":{},"params":{"printer":{"name":"PDF"},"options":{"colorType":"color","copies":"1","density":"","duplex":false,"interpolation":"","jobName":"9","margins":"0","orientation":"","paperThickness":"","printerTray":"","rasterize":true,"rotation":"0","scaleContent":true,"size":null,"units":"in","altPrinting":false,"encoding":"","endOfDoc":"","perSpool":"1"},"data":[{"type":"html","format":"plain","data":"<html>   <table style=\"font-family: monospace; border: 1px;\">       <tr style=\"height: 6cm;\">           <td valign=\"top\"><h2>*&nbsp; QZ Print Plugin HTML Printing &nbsp;*</h2><span style=\"color: #F00;\">Version:</span> 2.0.0-RC5<br/><span style=\"color: #F00;\">Visit:</span> https://qz.io/</td>           <td valign=\"top\"><img src=\"https://demo.qz.io/assets/img/image_sample.png\"></td>       </tr>   </table></html>"}]},"timestamp":1460438066034,"uid":"fmeu41"}
    [WARN] 2016-04-12 01:14:26,076 @ qz.ws.PrintSocketClient:?
    Bad signature on request
    [INFO] 2016-04-12 01:14:27,320 @ qz.common.TrayManager:?
    Allowed localhost to print to PDF
    [DEBUG] 2016-04-12 01:14:27,322 @ qz.printer.PrintServiceMatcher:?
    Searching for PrintService matching PDF
    [DEBUG] 2016-04-12 01:14:27,334 @ qz.printer.PrintServiceMatcher:?
    Found 3 printers
    [DEBUG] 2016-04-12 01:14:27,340 @ qz.printer.PrintServiceMatcher:?
    Found match: PDF
    [WARN] 2016-04-12 01:14:27,341 @ qz.printer.PrintOptions:?
    Cannot read  as a double for density, using default
    [WARN] 2016-04-12 01:14:27,341 @ qz.printer.PrintOptions:?
    Cannot read  as a valid value for interpolation, using default
    [WARN] 2016-04-12 01:14:27,342 @ qz.printer.PrintOptions:?
    Cannot read  as a valid value for orientation, using default
    [WARN] 2016-04-12 01:14:27,342 @ qz.printer.PrintOptions:?
    Cannot read  as a double for paperThickness, using default
    [DEBUG] 2016-04-12 01:14:27,343 @ qz.ws.PrintSocketClient:?
    Using qz.printer.action.PrintHTML to print
    [TRACE] 2016-04-12 01:14:27,343 @ qz.printer.action.WebApp:?
    Waiting for capture..
    [TRACE] 2016-04-12 01:14:27,406 @ qz.printer.action.WebApp:?
    Done: 100.0 > -1.0
    [TRACE] 2016-04-12 01:14:27,409 @ qz.printer.action.WebApp:?
    New state: SUCCEEDED > READY
    [TRACE] 2016-04-12 01:14:27,410 @ qz.printer.action.WebApp:?
    Done: -1.0 > 0.0
    [TRACE] 2016-04-12 01:14:27,410 @ qz.printer.action.WebApp:?
    New state: READY > SCHEDULED
    [TRACE] 2016-04-12 01:14:27,410 @ qz.printer.action.WebApp:?
    New state: SCHEDULED > RUNNING
    [TRACE] 2016-04-12 01:14:27,472 @ qz.printer.action.WebApp:?
    Done: 0.0 > 100.0
    [TRACE] 2016-04-12 01:14:27,484 @ qz.printer.action.WebApp:?
    New state: RUNNING > SUCCEEDED
    [TRACE] 2016-04-12 01:14:27,488 @ qz.printer.action.WebApp:?
    Zooming in by x4.166666666666667 for increased quality
    [TRACE] 2016-04-12 01:14:27,488 @ qz.printer.action.WebApp:?
    Setting HTML page width to 3400.0000000000005
    [TRACE] 2016-04-12 01:14:27,666 @ qz.printer.action.WebApp:?
    Setting HTML page height to 1025.0
    [DEBUG] 2016-04-12 01:14:27,844 @ qz.printer.action.WebApp:?
    Attempting image capture
    [DEBUG] 2016-04-12 01:14:28,365 @ qz.printer.action.PrintHTML:?
    Parsed 1 html records
    [TRACE] 2016-04-12 01:14:28,366 @ qz.printer.action.PrintPixel:?
    DPI: 300.0  CNV: 72.0
    [TRACE] 2016-04-12 01:14:28,366 @ qz.printer.action.PrintPixel:?
    Drawable area: 0.0,0.0:8.5,11.0
    [TRACE] 2016-04-12 01:14:28,367 @ qz.printer.action.PrintPixel:?
    [color, (0.0,0.0)->(215.9,279.4)mm, 30000x30000 dphi]
    [INFO] 2016-04-12 01:14:28,367 @ qz.printer.action.PrintPixel:?
    Starting printing (1 copies)
    [WARN] 2016-04-12 01:14:28,368 @ qz.printer.action.PrintPixel:?
    Supported printer densities not found
    [TRACE] 2016-04-12 01:14:28,370 @ qz.printer.action.PrintImage:?
    Requested page 0 for printing
    [TRACE] 2016-04-12 01:14:28,380 @ qz.printer.action.PrintImage:?
    {Color rendering quality key=Highest quality color rendering mode, Text-specific antialiasing enable key=Default antialiasing text mode, Stroke normalization control key=Pure stroke conversion for accurate paths, Alpha blending interpolation method key=Highest quality alpha blending methods, Image interpolation method key=Bicubic image interpolation mode, Text-specific LCD contrast key=140, Global rendering quality key=Highest quality rendering methods, Fractional metrics enable key=Integer text metrics mode, Global antialiasing enable key=Antialiased rendering mode}
    [DEBUG] 2016-04-12 01:14:28,380 @ qz.printer.action.PrintImage:?
    Paper area: 0,0:612,792
    [TRACE] 2016-04-12 01:14:28,385 @ qz.printer.action.PrintImage:?
    Image size: 612,184
    [TRACE] 2016-04-12 01:14:28,386 @ qz.printer.action.PrintImage:?
    Requested page 0 for printing
    [TRACE] 2016-04-12 01:14:28,388 @ qz.printer.action.PrintImage:?
    {Color rendering quality key=Highest quality color rendering mode, Text-specific antialiasing enable key=Default antialiasing text mode, Stroke normalization control key=Pure stroke conversion for accurate paths, Alpha blending interpolation method key=Highest quality alpha blending methods, Image interpolation method key=Bicubic image interpolation mode, Text-specific LCD contrast key=140, Global rendering quality key=Highest quality rendering methods, Fractional metrics enable key=Integer text metrics mode, Global antialiasing enable key=Antialiased rendering mode}
    [DEBUG] 2016-04-12 01:14:28,389 @ qz.printer.action.PrintImage:?
    Paper area: 0,0:612,792
    [TRACE] 2016-04-12 01:14:28,391 @ qz.printer.action.PrintImage:?
    Image size: 612,184
    [INFO] 2016-04-12 01:14:28,727 @ qz.ws.PrintSocketClient:?
    Printing complete
    
  2. 36.3kb

    • Result:
      image
    • Stacktrace:
    [DEBUG] 2016-04-12 01:14:20,310 @ qz.ws.PrintSocketClient:?
    Message: {"call":"print","promise":{},"params":{"printer":{"name":"PDF"},"options":{"colorType":"color","copies":"1","density":"","duplex":false,"interpolation":"","jobName":"8","margins":"0","orientation":"","paperThickness":"","printerTray":"","rasterize":true,"rotation":"0","scaleContent":true,"size":null,"units":"in","altPrinting":false,"encoding":"","endOfDoc":"","perSpool":"1"},"data":[{"type":"html","format":"plain","data":"<html>   <table style=\"font-family: monospace; border: 1px;\">       <tr style=\"height: 6cm;\">           <td valign=\"top\"><h2>*&nbsp; QZ Print Plugin HTML Printing &nbsp;*</h2><span style=\"color: #F00;\">Version:</span> 2.0.0-RC5<br/><span style=\"color: #F00;\">Visit:</span> https://qz.io/</td>           <td valign=\"top\"><img src=\"https://demo.qz.io/assets/img/image_sample.png\"></td>       </tr>   </table></html>"}]},"timestamp":1460438060268,"uid":"ile3pj"}
    [WARN] 2016-04-12 01:14:20,312 @ qz.ws.PrintSocketClient:?
    Bad signature on request
    [INFO] 2016-04-12 01:14:21,626 @ qz.common.TrayManager:?
    Allowed localhost to print to PDF
    [DEBUG] 2016-04-12 01:14:21,630 @ qz.printer.PrintServiceMatcher:?
    Searching for PrintService matching PDF
    [DEBUG] 2016-04-12 01:14:21,631 @ qz.printer.PrintServiceMatcher:?
    Found 3 printers
    [DEBUG] 2016-04-12 01:14:21,631 @ qz.printer.PrintServiceMatcher:?
    Found match: PDF
    [WARN] 2016-04-12 01:14:21,632 @ qz.printer.PrintOptions:?
    Cannot read  as a double for density, using default
    [WARN] 2016-04-12 01:14:21,633 @ qz.printer.PrintOptions:?
    Cannot read  as a valid value for interpolation, using default
    [WARN] 2016-04-12 01:14:21,634 @ qz.printer.PrintOptions:?
    Cannot read  as a valid value for orientation, using default
    [WARN] 2016-04-12 01:14:21,639 @ qz.printer.PrintOptions:?
    Cannot read  as a double for paperThickness, using default
    [DEBUG] 2016-04-12 01:14:21,649 @ qz.ws.PrintSocketClient:?
    Using qz.printer.action.PrintHTML to print
    [TRACE] 2016-04-12 01:14:21,650 @ qz.printer.action.WebApp:?
    Waiting for capture..
    [TRACE] 2016-04-12 01:14:21,727 @ qz.printer.action.WebApp:?
    Done: 100.0 > -1.0
    [TRACE] 2016-04-12 01:14:21,754 @ qz.printer.action.WebApp:?
    New state: SUCCEEDED > READY
    [TRACE] 2016-04-12 01:14:21,756 @ qz.printer.action.WebApp:?
    Done: -1.0 > 0.0
    [TRACE] 2016-04-12 01:14:21,758 @ qz.printer.action.WebApp:?
    New state: READY > SCHEDULED
    [TRACE] 2016-04-12 01:14:21,760 @ qz.printer.action.WebApp:?
    New state: SCHEDULED > RUNNING
    [TRACE] 2016-04-12 01:14:21,790 @ qz.printer.action.WebApp:?
    Done: 0.0 > 100.0
    [TRACE] 2016-04-12 01:14:21,790 @ qz.printer.action.WebApp:?
    New state: RUNNING > SUCCEEDED
    [TRACE] 2016-04-12 01:14:21,791 @ qz.printer.action.WebApp:?
    Zooming in by x4.166666666666667 for increased quality
    [TRACE] 2016-04-12 01:14:21,791 @ qz.printer.action.WebApp:?
    Setting HTML page width to 3400.0000000000005
    [TRACE] 2016-04-12 01:14:21,944 @ qz.printer.action.WebApp:?
    Setting HTML page height to 1025.0
    [DEBUG] 2016-04-12 01:14:22,068 @ qz.printer.action.WebApp:?
    Attempting image capture
    [DEBUG] 2016-04-12 01:14:22,655 @ qz.printer.action.PrintHTML:?
    Parsed 1 html records
    [TRACE] 2016-04-12 01:14:22,657 @ qz.printer.action.PrintPixel:?
    DPI: 300.0  CNV: 72.0
    [TRACE] 2016-04-12 01:14:22,658 @ qz.printer.action.PrintPixel:?
    Drawable area: 0.0,0.0:8.5,11.0
    [TRACE] 2016-04-12 01:14:22,658 @ qz.printer.action.PrintPixel:?
    [color, (0.0,0.0)->(215.9,279.4)mm, 30000x30000 dphi]
    [INFO] 2016-04-12 01:14:22,659 @ qz.printer.action.PrintPixel:?
    Starting printing (1 copies)
    [WARN] 2016-04-12 01:14:22,660 @ qz.printer.action.PrintPixel:?
    Supported printer densities not found
    [TRACE] 2016-04-12 01:14:22,662 @ qz.printer.action.PrintImage:?
    Requested page 0 for printing
    [TRACE] 2016-04-12 01:14:22,686 @ qz.printer.action.PrintImage:?
    {Color rendering quality key=Highest quality color rendering mode, Text-specific antialiasing enable key=Default antialiasing text mode, Stroke normalization control key=Pure stroke conversion for accurate paths, Alpha blending interpolation method key=Highest quality alpha blending methods, Image interpolation method key=Bicubic image interpolation mode, Text-specific LCD contrast key=140, Global rendering quality key=Highest quality rendering methods, Fractional metrics enable key=Integer text metrics mode, Global antialiasing enable key=Antialiased rendering mode}
    [DEBUG] 2016-04-12 01:14:22,690 @ qz.printer.action.PrintImage:?
    Paper area: 0,0:612,792
    [TRACE] 2016-04-12 01:14:22,711 @ qz.printer.action.PrintImage:?
    Image size: 612,184
    [TRACE] 2016-04-12 01:14:22,741 @ qz.printer.action.PrintImage:?
    Requested page 0 for printing
    [TRACE] 2016-04-12 01:14:22,742 @ qz.printer.action.PrintImage:?
    {Color rendering quality key=Highest quality color rendering mode, Text-specific antialiasing enable key=Default antialiasing text mode, Stroke normalization control key=Pure stroke conversion for accurate paths, Alpha blending interpolation method key=Highest quality alpha blending methods, Image interpolation method key=Bicubic image interpolation mode, Text-specific LCD contrast key=140, Global rendering quality key=Highest quality rendering methods, Fractional metrics enable key=Integer text metrics mode, Global antialiasing enable key=Antialiased rendering mode}
    [DEBUG] 2016-04-12 01:14:22,742 @ qz.printer.action.PrintImage:?
    Paper area: 0,0:612,792
    [TRACE] 2016-04-12 01:14:22,743 @ qz.printer.action.PrintImage:?
    Image size: 612,184
    [INFO] 2016-04-12 01:14:23,496 @ qz.ws.PrintSocketClient:?
    Printing complete
    
  3. 136.7kb

    • Result:
      image
    • Stacktrace:
    [DEBUG] 2016-04-12 01:14:31,851 @ qz.ws.PrintSocketClient:?
    Message: {"call":"print","promise":{},"params":{"printer":{"name":"PDF"},"options":{"colorType":"color","copies":"1","density":"","duplex":false,"interpolation":"","jobName":"10","margins":"0","orientation":"","paperThickness":"","printerTray":"","rasterize":true,"rotation":"0","scaleContent":true,"size":null,"units":"in","altPrinting":false,"encoding":"","endOfDoc":"","perSpool":"1"},"data":[{"type":"html","format":"plain","data":"<html>   <table style=\"font-family: monospace; border: 1px;\">       <tr style=\"height: 6cm;\">           <td valign=\"top\"><h2>*&nbsp; QZ Print Plugin HTML Printing &nbsp;*</h2><span style=\"color: #F00;\">Version:</span> 2.0.0-RC5<br/><span style=\"color: #F00;\">Visit:</span> https://qz.io/</td>           <td valign=\"top\"><img src=\"https://demo.qz.io/assets/img/image_sample.png\"></td>       </tr>   </table></html>"}]},"timestamp":1460438071825,"uid":"ew2opp"}
    [WARN] 2016-04-12 01:14:31,855 @ qz.ws.PrintSocketClient:?
    Bad signature on request
    [INFO] 2016-04-12 01:14:33,333 @ qz.common.TrayManager:?
    Allowed localhost to print to PDF
    [DEBUG] 2016-04-12 01:14:33,340 @ qz.printer.PrintServiceMatcher:?
    Searching for PrintService matching PDF
    [DEBUG] 2016-04-12 01:14:33,354 @ qz.printer.PrintServiceMatcher:?
    Found 3 printers
    [DEBUG] 2016-04-12 01:14:33,357 @ qz.printer.PrintServiceMatcher:?
    Found match: PDF
    [WARN] 2016-04-12 01:14:33,361 @ qz.printer.PrintOptions:?
    Cannot read  as a double for density, using default
    [WARN] 2016-04-12 01:14:33,363 @ qz.printer.PrintOptions:?
    Cannot read  as a valid value for interpolation, using default
    [WARN] 2016-04-12 01:14:33,363 @ qz.printer.PrintOptions:?
    Cannot read  as a valid value for orientation, using default
    [WARN] 2016-04-12 01:14:33,366 @ qz.printer.PrintOptions:?
    Cannot read  as a double for paperThickness, using default
    [DEBUG] 2016-04-12 01:14:33,368 @ qz.ws.PrintSocketClient:?
    Using qz.printer.action.PrintHTML to print
    [TRACE] 2016-04-12 01:14:33,369 @ qz.printer.action.WebApp:?
    Waiting for capture..
    [TRACE] 2016-04-12 01:14:33,461 @ qz.printer.action.WebApp:?
    Done: 100.0 > -1.0
    [TRACE] 2016-04-12 01:14:33,462 @ qz.printer.action.WebApp:?
    New state: SUCCEEDED > READY
    [TRACE] 2016-04-12 01:14:33,463 @ qz.printer.action.WebApp:?
    Done: -1.0 > 0.0
    [TRACE] 2016-04-12 01:14:33,463 @ qz.printer.action.WebApp:?
    New state: READY > SCHEDULED
    [TRACE] 2016-04-12 01:14:33,463 @ qz.printer.action.WebApp:?
    New state: SCHEDULED > RUNNING
    [TRACE] 2016-04-12 01:14:33,554 @ qz.printer.action.WebApp:?
    Done: 0.0 > 100.0
    [TRACE] 2016-04-12 01:14:33,555 @ qz.printer.action.WebApp:?
    New state: RUNNING > SUCCEEDED
    [TRACE] 2016-04-12 01:14:33,557 @ qz.printer.action.WebApp:?
    Zooming in by x4.166666666666667 for increased quality
    [TRACE] 2016-04-12 01:14:33,558 @ qz.printer.action.WebApp:?
    Setting HTML page width to 3400.0000000000005
    [TRACE] 2016-04-12 01:14:33,673 @ qz.printer.action.WebApp:?
    Setting HTML page height to 1025.0
    [DEBUG] 2016-04-12 01:14:33,784 @ qz.printer.action.WebApp:?
    Attempting image capture
    [DEBUG] 2016-04-12 01:14:34,376 @ qz.printer.action.PrintHTML:?
    Parsed 1 html records
    [TRACE] 2016-04-12 01:14:34,380 @ qz.printer.action.PrintPixel:?
    DPI: 300.0  CNV: 72.0
    [TRACE] 2016-04-12 01:14:34,381 @ qz.printer.action.PrintPixel:?
    Drawable area: 0.0,0.0:8.5,11.0
    [TRACE] 2016-04-12 01:14:34,382 @ qz.printer.action.PrintPixel:?
    [color, (0.0,0.0)->(215.9,279.4)mm, 30000x30000 dphi]
    [INFO] 2016-04-12 01:14:34,382 @ qz.printer.action.PrintPixel:?
    Starting printing (1 copies)
    [WARN] 2016-04-12 01:14:34,383 @ qz.printer.action.PrintPixel:?
    Supported printer densities not found
    [TRACE] 2016-04-12 01:14:34,390 @ qz.printer.action.PrintImage:?
    Requested page 0 for printing
    [TRACE] 2016-04-12 01:14:34,390 @ qz.printer.action.PrintImage:?
    {Color rendering quality key=Highest quality color rendering mode, Text-specific antialiasing enable key=Default antialiasing text mode, Stroke normalization control key=Pure stroke conversion for accurate paths, Alpha blending interpolation method key=Highest quality alpha blending methods, Image interpolation method key=Bicubic image interpolation mode, Text-specific LCD contrast key=140, Global rendering quality key=Highest quality rendering methods, Fractional metrics enable key=Integer text metrics mode, Global antialiasing enable key=Antialiased rendering mode}
    [DEBUG] 2016-04-12 01:14:34,391 @ qz.printer.action.PrintImage:?
    Paper area: 0,0:612,792
    [TRACE] 2016-04-12 01:14:34,391 @ qz.printer.action.PrintImage:?
    Image size: 612,184
    [TRACE] 2016-04-12 01:14:34,392 @ qz.printer.action.PrintImage:?
    Requested page 0 for printing
    [TRACE] 2016-04-12 01:14:34,395 @ qz.printer.action.PrintImage:?
    {Color rendering quality key=Highest quality color rendering mode, Text-specific antialiasing enable key=Default antialiasing text mode, Stroke normalization control key=Pure stroke conversion for accurate paths, Alpha blending interpolation method key=Highest quality alpha blending methods, Image interpolation method key=Bicubic image interpolation mode, Text-specific LCD contrast key=140, Global rendering quality key=Highest quality rendering methods, Fractional metrics enable key=Integer text metrics mode, Global antialiasing enable key=Antialiased rendering mode}
    [DEBUG] 2016-04-12 01:14:34,395 @ qz.printer.action.PrintImage:?
    Paper area: 0,0:612,792
    [TRACE] 2016-04-12 01:14:34,396 @ qz.printer.action.PrintImage:?
    Image size: 612,184
    [INFO] 2016-04-12 01:14:34,663 @ qz.ws.PrintSocketClient:?
    Printing complete
    

Without Rasterize

  1. 19.8kb
    • Result:

      image

  2. 9.0kb
    • Result:

      image

  3. 20.5kb
    • Result:

      image

@tresf
Copy link
Contributor

tresf commented Apr 12, 2016

May be a duplicate of https://bugs.openjdk.java.net/browse/JDK-8073710 (unresolved).

One work-around is to set the look and feel to Metal, which can be forced here:

https://github.com/qzind/tray/blob/2.0/src/qz/utils/SystemUtilities.java#L178

- UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+ UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());

@klabarge can you see if the problem disappears when you force the Metal look and feel? If so, we may want to shim a L&F workaround for this HTML window on Ubuntu.

@tresf
Copy link
Contributor

tresf commented Apr 14, 2016

- UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+ UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());

@klabarge can you see if the problem disappears when you force the Metal look and feel?

Unfortunately, this doesn't remedy this problem, HTML printing is still inconsistently sized on Ubuntu 14.04 + Java 8u25, or Java 8u77. I don't believe this is related to https://bugs.openjdk.java.net/browse/JDK-8073710.

image

What does seem to work is changing setPrefWidth(...), setPrefHeight(...) to setMinWidth(...), setMinHeight(...) which yields a consistent 135.6 KB each print tested 6 times in a row.

image

@bberenz thoughts?

@akberenz
Copy link
Member

What does seem to work is changing setPrefWidth(...), setPrefHeight(...) to setMinWidth(...), setMinHeight(...)

You state this and I'm reminded of setting layouts in swing. So it shouldn't hurt to set both pref and min (and we probably should), especially if it fixes problems with linux.
Done via eb85fb0

@tresf
Copy link
Contributor

tresf commented Apr 14, 2016

screen shot 2016-04-14 at 6 08 47 pm

👍 51 successful prints, closing as resolved.

@tresf tresf closed this as completed Apr 14, 2016
@klabarge
Copy link
Member Author

This issue resurfaces when using a custom page size

I am using A4 size (8.3in x 11.7in) and sometimes my results are 35.5kb, 16.5kb, or 135.5kb.

@klabarge klabarge reopened this Apr 23, 2016
@tresf
Copy link
Contributor

tresf commented Apr 27, 2016

@klabarge actually I believe it was never fixed.

  • Ubuntu 12.04 x64 + Oracle Java 1.8 u92, if re-using the same settings, it seems to be fine after the first print.
    • However, each dimension change seems to break it.

First print:

image

Second print (same default settings):

image

Change paper size (US Letter):

image

@tresf
Copy link
Contributor

tresf commented Apr 27, 2016

There's definitely something hairy going on and it's relatively consistent...

@bberenz any thoughts here? You should be able to reproduce this in VM.

If I change:

webView.setMinSize(100, 100); to
webView.setMinSize(100,600);

This yields different results, the content doesn't seem to be getting cut off at the same place... So I had to make the content taller to reproduce the cutoff...

First print (fresh load of QZ Tray):
image

Second print (same exact settings):
image

And then with the following code...

webView.setMinSize(100,1200);

First print (frest load of QZ Tray):
image

Second print (same exact settings):
image

@tresf
Copy link
Contributor

tresf commented Apr 27, 2016

Hmm... I commented out the webView.setMinSize(100,100); entirely and still receive the same results as this. 😢

@bberenz new question... why aren't we doing this...

Platform.runLater(new Thread() {
            public void run() {
                try {
                    pageWidth = width;
                    pageHeight = height;
                    pageZoom = zoom;

+                   webView.setMinSize(zoom * width, zoom * height);
+                   webView.setPrefSize(zoom * width, zoom * height);
+                   webView.autosize();

@akberenz
Copy link
Member

Because we don't know what values we can use at that point in the capture.
The width might not zoom after loading, in which case we change the zoom to 1. Now, we might be able to move the zoom logic, though I'm not sure if it needs the webView to be in a Worker.State.SUCCEEDED, so that would need tested first.
We definitely cannot move the height though, as in most cases we calculate the height after adjusting the page to the desired width, and it's passed as 0 at your point in the capture.

@tresf
Copy link
Contributor

tresf commented Apr 27, 2016

Well, FWIW, the above logic seems to "fix" it on Linux. Without it, the height is shortened the first go-round.

@akberenz
Copy link
Member

@bberenz any thoughts here? You should be able to reproduce this in VM.

Unless I'm doing something wrong, I could not reproduce this on a VM running ubuntu 15.10, 14.04, or 12.04. (running without your alteration, just what currently sits in the repo)

the above logic seems to "fix" it on Linux. Without it, the height is shortened the first go-round.

Are you supplying the pageHeight option? Otherwise it's suprising that this fixes it since it would be set to a height of 0 there. Which raises the question, is it fixed if the calls are changed to set..Size(0,0);?

@tresf
Copy link
Contributor

tresf commented Apr 27, 2016

I could not reproduce this on a VM running ubuntu 15.10, 14.04, or 12.04. (running without your alteration, just what currently sits in the repo)

Hmm...

I just fired up a different 12.04 x64 VM...

  • ✅ First Attempt - Success
  • ⛔ Second Attempt - Cut off

screen shot 2016-04-27 at 5 42 18 pm

Some things Kyle and I may have in common:

  • Everything is virtualized using VirtualBox 5.x. Kyle and I both use VirtualBox and we generally turn on the Guest Additions for desktop resizing capabilities, etc. (we have a license for VMWare Fusion and we can buy Parallels for Mac if we need to switch up the VM host application)
  • Another item worth noting is we had previously had OpenJDK 7 installed via PPA and then used the helper script to upgrade to Oracle Java 8.
  • We've historically used Windows 10 x64 as our host OS but these two attempts in this post were from a Mac 10.11 host Machine.
  • I don't run Ubuntu updates that often. I'll do that now to rule that out.

@tresf
Copy link
Contributor

tresf commented Apr 27, 2016

Ok....

  • Ran updates, rebooted, printed 12 times cannot reproduce...

@klabarge, can you confirm this?

@klabarge
Copy link
Member Author

After running updates and rebooting I am still able to reproduce this issue.

I used the Software Updater and also ran a sudo apt-get upgrade
image

I sent 20 print jobs: 10 without setting a page size and 10 with setting a page size.

  • Names 1-10 are with page size
  • Names 177no-size_x are without

The desired file size is 135,510 bytes, but notice almost half of the prints are 35,491 bytes.

image

@lite1979
Copy link
Contributor

Testing on hardware on 2 Unbutu-based computers:

Ubuntu 14.04 LTS - AMD FX 8320 - 24GB RAM - 12 tests - no flaws, no partial prints

Linux Mint 17.3 - Intel i5 - 6GB RAM - 10 tests - no flaws, no partial prints

@lite1979
Copy link
Contributor

Recreated Kyle's symptoms in 16.04 LTS in Virtual Box using Oracle Java 8 from the webupd8team.

Note: VM was struggling to keep up, and I had to wait several seconds for each print job.

VM specs: 8GB virtual hard drive, 768MB RAM, 1 processor

@lite1979
Copy link
Contributor

lite1979 commented Apr 28, 2016

Bumping up Video memory to 128MB and RAM to 2048MB produces zero errors and no partial prints in above VM. (recommended video memory was 4MB)

Brought video memory back down to 4MB, still produced zero errors.

Brought RAM back down to 1024MB, zero errors.

Brought RAM down to 512MB and got this (expected):

virtualbox_ubuntu16_28_04_2016_01_41_22

@tresf tresf added the bug label Apr 29, 2016
@tresf tresf added this to the 2.0 milestone Apr 29, 2016
@klabarge
Copy link
Member Author

I have an Ubuntu 14.04 laptop that I've done some testing on - unable to reproduce this on physical hardware.

I think it's worth mentioning that I used Oracle Java 8 from the webupd8team

30 prints and all are the same size... 😕

@tresf tresf added wontfix and removed bug labels Apr 30, 2016
@tresf
Copy link
Contributor

tresf commented Apr 30, 2016

@klabarge thanks. That's an overwhelming amount of "it an't broke", so we'll close this one out and monitor it from support perspective.

P.S. Thanks for getting that UEFI/Chromebook working today. The test results are much appreciated. Thanks to the rest as well. This is a very sporadic bug and I have a feeling it will rear its head again, and we can reopen it then. 👍

@tresf tresf closed this as completed Apr 30, 2016
@tresf tresf changed the title Inconsistent HTML printing on Linux Inconsistent HTML printing May 11, 2016
@tresf
Copy link
Contributor

tresf commented May 11, 2016

Just reproduced this on Mac, reopening (happened first time only).

screen shot 2016-05-10 at 8 59 53 pm

@tresf tresf reopened this May 11, 2016
@tresf tresf added upstream and removed wontfix labels Jun 1, 2016
@tresf tresf modified the milestones: 2.1, 2.0 Jun 1, 2016
@tresf
Copy link
Contributor

tresf commented Jun 1, 2016

Marking as upstream bug. If we can get a Short, Self Contained, Correct Example of this it will make it much easier to escalate to Oracle.

@tresf tresf removed this from the 2.1 milestone Jun 1, 2016
@tresf
Copy link
Contributor

tresf commented Oct 19, 2016

@tresf
Copy link
Contributor

tresf commented Nov 4, 2016

@klabarge when I run the software with -Dprism.order=j2d in Ubuntu 14.04 this problem seems to go away. Can you confirm?

Note, Java recommends replacing this command with -Dprism.order=sw as the j2d option has been deprecated.

@klabarge
Copy link
Member Author

klabarge commented Nov 6, 2016

I launched the software via java -Xms512M -Dprism.order=j2d -jar /opt/qz-tray/qz-tray.jar and the problem did not go away. However, I am using CUPS PDF and we have had grief with ghostcript before. I had updated ghostscript with no luck.

image

@klabarge
Copy link
Member Author

klabarge commented Nov 7, 2016

I also tested with -Dprism.order=sw and the issue still occurred.

Here's a snippet of what the 8.6kb PDF is, a black bar at the top right-hand corner.

image

@tresf
Copy link
Contributor

tresf commented Jul 6, 2017

I'm closing this since we can't reproduce on physical hardware and its upstream anyway.

I have a feeling this will resurface since Mac has already shown some blank pages but we can open a dedicated issue on that once 2.1 QA starts.

Closing, marking as not our bug. We can reopen if we have a more reliable mechanism to reproduce.

@tresf tresf closed this as completed Jul 6, 2017
@Devil-Boy
Copy link

Sorry. I know this is an old, closed ticket.

My team was having this issue with partial prints on the first job. I resolved it entirely by increasing the time before the HTML snapshot.

In "src/qz/printer/action/WebApp.java", I arbitrarily changed:
snap = new PauseTransition(Duration.millis(100));
to
snap = new PauseTransition(Duration.millis(1000));

I figured I'd mention this in case the issue persists into future versions of QZ Tray.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants