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

Bring forward 2.0 html raster refactoring with Monocle #632

Merged
merged 20 commits into from
May 26, 2020
Merged

Conversation

tresf
Copy link
Contributor

@tresf tresf commented May 7, 2020

Brings forward all race condition fixes (and performance improvement fixes) from #580 with Monocle as a headless HTML engine.

This PR supercedes #623.

@tresf tresf added this to the 2.1.1 milestone May 7, 2020
try { Thread.sleep(SLEEP); } catch(Exception ignore) {}
//software rendering required headless environments
if (PrintSocketServer.isHeadless()) {
System.setProperty("prism.order", "sw");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quoting the private bug tracker:

There is 1 thing that is still open: rendering on Linux with es2 (instead of sw) and Monocle. Should be doable to fix though.
...
rendering on Linux with es2 and Monocle is now working. Need to modify build procedures.

Interestingly, this passed in #586, so I'm not sure what the stability impact of this is to Linux.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gluon explains that this is likely due to the fallback order and that it's very likely it would still work. Anyway, they provided a new build with this patched, we just need to update the gluon binaries.

@klabarge
Copy link
Member

klabarge commented May 9, 2020

On macOS there's no dialogue warning (about restarting QZ Tray) when clicking "Use Monocle for HTML".

I ran this is in IntelliJ but I don't see any errors.

Environment:

  • macOS 10.15.4
  • AdoptOpenJDK 11.0.6

@klabarge
Copy link
Member

klabarge commented May 9, 2020

On Windows 10 using Java 8u211 HTML printing with rasterize: false has much different results than 2.1.1

mono-fastforward
image

2.1.0
image

@akberenz
Copy link
Member

@klabarge, what printer settings are you using, and are you using any other options in QZ for the print?
I tried with both j8u202 (what I had onhand) and then updated to the latest j8u251 and am getting the expected results with both.

@klabarge
Copy link
Member

and are you using any other options in QZ for the print?

@bberenz I'm using the sample.html for testing.
I can reproduce using this config: var config = qz.configs.create("PDFCreator", { rasterize: true, scaleContent: true});

[DEBUG] 2020-05-12 18:03:03,579 @ qz.ws.PrintSocketClient:?
	Message: {"call":"print","promise":{},"params":{"printer":{"name":"PDFCreator"},"options":{"bounds":null,"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":null,"units":"in","altPrinting":false,"encoding":null,"endOfDoc":null,"perSpool":1},"data":[{"type":"pixel","format":"html","flavor":"plain","data":"<html><body>  <table style=\"font-family: monospace; width: 100%\">    <tr>      <td>        <h2>* QZ Tray HTML Sample Print *</h2>        <span style=\"color: #D00;\">Version:</span> 2.1.0<br/>        <span style=\"color: #D00;\">Source:</span> https://qz.io/      </td>      <td align=\"right\">        <img src=\"file:///C:/Program%20Files/QZ%20Tray/demo/assets/img/image_sample.png\" />      </td>    </tr>  </table></body></html>","options":{"pageWidth":"","pageHeight":""}}]},"timestamp":1589320983570,"uid":"dhltt7","signAlgorithm":"SHA512","position":{"x":720,"y":430}}
[WARN] 2020-05-12 18:03:03,584 @ qz.ws.PrintSocketClient:?
	Bad signature on request
[DEBUG] 2020-05-12 18:03:03,602 @ qz.common.TrayManager:?
	Calculated dialog centered at: java.awt.Point[x=1293,y=762]
[INFO] 2020-05-12 18:03:04,854 @ qz.common.TrayManager:?
	Allowed localhost to print to PDFCreator
[TRACE] 2020-05-12 18:03:04,855 @ qz.utils.PrintingUtilities:?
	Waiting for processor, 0/1 already in use
[DEBUG] 2020-05-12 18:03:04,855 @ qz.utils.PrintingUtilities:?
	Using qz.printer.action.PrintHTML to print
[DEBUG] 2020-05-12 18:03:04,857 @ qz.printer.PrintServiceMatcher:?
	Searching for PrintService matching PDFCreator
[DEBUG] 2020-05-12 18:03:04,857 @ qz.printer.PrintServiceMatcher:?
	Found 9 printers
[DEBUG] 2020-05-12 18:03:04,858 @ qz.printer.PrintServiceMatcher:?
	Found match: PDFCreator
[DEBUG] 2020-05-12 18:03:04,903 @ qz.printer.action.PrintHTML:?
	Parsed 1 html records
[TRACE] 2020-05-12 18:03:04,911 @ qz.printer.action.WebApp:?
	Waiting on capture..
[TRACE] 2020-05-12 18:03:04,951 @ qz.printer.action.WebApp:?
	Setting starting size 6800.000000000001:0.0
[TRACE] 2020-05-12 18:03:04,983 @ qz.printer.action.WebApp:?
	Done: 100.0 > -1.0
[TRACE] 2020-05-12 18:03:04,984 @ qz.printer.action.WebApp:?
	New state: SUCCEEDED > READY
[TRACE] 2020-05-12 18:03:04,985 @ qz.printer.action.WebApp:?
	Done: -1.0 > 0.0
[TRACE] 2020-05-12 18:03:04,985 @ qz.printer.action.WebApp:?
	New state: READY > SCHEDULED
[TRACE] 2020-05-12 18:03:04,986 @ qz.printer.action.WebApp:?
	New state: SCHEDULED > RUNNING
[TRACE] 2020-05-12 18:03:04,992 @ qz.printer.action.WebApp:?
	Done: 0.0 > 100.0
[TRACE] 2020-05-12 18:03:04,993 @ qz.printer.action.WebApp:?
	New state: RUNNING > SUCCEEDED
[TRACE] 2020-05-12 18:03:04,994 @ qz.printer.action.WebApp:?
	Setting HTML page height to 850.0000000000001
[WARN] 2020-05-12 18:03:04,995 @ qz.printer.action.WebApp:?
	Zoom level 8.333333333333334 decreased to 3.0292823787332543 due to physical memory limitations
[TRACE] 2020-05-12 18:03:04,997 @ qz.printer.action.WebApp:?
	Zooming in by x3.0292823787332543 for increased quality
[DEBUG] 2020-05-12 18:03:05,014 @ qz.printer.action.WebApp:?
	Attempting image capture
[TRACE] 2020-05-12 18:03:05,534 @ qz.printer.action.PrintPixel:?
	DPI: [600.0x600.0]	CNV: 72.0
[TRACE] 2020-05-12 18:03:05,534 @ qz.printer.action.PrintPixel:?
	Drawable area: 0.0,0.0:8.5,11.0
[TRACE] 2020-05-12 18:03:05,535 @ qz.printer.action.PrintPixel:?
	[one-sided, (0.0,0.0)->(215.9,279.4)mm, color, 60000x60000 dphi]
[INFO] 2020-05-12 18:03:05,557 @ qz.printer.action.PrintPixel:?
	Starting printing (1 copies)
[TRACE] 2020-05-12 18:03:05,712 @ qz.printer.action.PrintImage:?
	Requested page 0 for printing
[TRACE] 2020-05-12 18:03:05,750 @ qz.printer.action.PrintImage:?
	Requested page 0 for printing
[DEBUG] 2020-05-12 18:03:05,761 @ qz.printer.action.PrintImage:?
	No need to upscale image
[DEBUG] 2020-05-12 18:03:05,761 @ qz.printer.action.PrintImage:?
	Paper area: 0,0:612,792
[TRACE] 2020-05-12 18:03:05,763 @ qz.printer.action.PrintImage:?
	Image size: 612.0,76.5
[TRACE] 2020-05-12 18:03:05,764 @ qz.printer.action.PrintImage:?
	{Image interpolation method key=Bicubic image interpolation mode, Stroke normalization control key=Pure stroke conversion for accurate paths, Text-specific antialiasing enable key=Antialiased text mode, Color rendering quality key=Highest quality color rendering mode, Global antialiasing enable key=Antialiased rendering mode, Alpha blending interpolation method key=Highest quality alpha blending methods, Fractional metrics enable key=Integer text metrics mode, Dithering quality key=Default dithering mode, Global rendering quality key=Highest quality rendering methods, Text-specific LCD contrast key=140}
[DEBUG] 2020-05-12 18:03:05,793 @ qz.printer.action.PrintImage:?
	Memory: 225m/910m
[INFO] 2020-05-12 18:03:05,910 @ qz.utils.PrintingUtilities:?
	Printing complete
[TRACE] 2020-05-12 18:03:05,912 @ qz.utils.PrintingUtilities:?
	Returning processor back to pool

what printer settings are you using

PDFCreator, set to US Letter.

Berenz and others added 3 commits May 13, 2020 21:31
@tresf
Copy link
Contributor Author

tresf commented May 19, 2020

For some reason on Mac the vector unit tests are failing for known sizes. The first page is OK, but the remainders are blank. This issue does NOT occur for fitted sizes.

image

@tresf
Copy link
Contributor Author

tresf commented May 19, 2020

Sizing issue patched via 96b084d, documented via c726cfa. It doesn't make sense and I don't expect this to work everywhere, so I'll test with some more configurations.

@tresf
Copy link
Contributor Author

tresf commented May 20, 2020

For rasterize: false, Java 11 with and without Monocle pass. Java 8 passes.

Unfortunately rasterize: true is failing for Java 8. The inconsistent sizing issues that plagued 2.0 seem to have returned with this branch. These results are from Windows 10 + Java 8 using the WebAppTest class:

image

@tresf
Copy link
Contributor Author

tresf commented May 20, 2020

@bberenz I was able to fix this raster issue above by replacing the calls toautosize(WebView webView) with webView.autosize();, but then it reintroduces #516 for vector prints. Can you help make it execute conditionally?

@tresf
Copy link
Contributor Author

tresf commented May 26, 2020

Raster prints are fixed with 12c3ca0. Was hitting "Cancelled" CUPS jobs on vector prints, but they've been magically circumvented via 59db6c3.

JavaFX 15ea+3 adds a fix for software rendering, so bumped that via 212ca4e. Will repeat some tests, fast forward and merge.

@tresf tresf removed the request for review from klabarge May 26, 2020 19:28
@tresf tresf merged commit 409be26 into master May 26, 2020
@tresf tresf deleted the mono-fastforward branch May 26, 2020 21:05
@tresf tresf mentioned this pull request May 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants