Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8118415

WebView cannot be printed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8
    • 8
    • javafx
    • web

      WebView is not printed when submitted to PrinterJob.printPage().

      There is a number of problems related to printing a WebView:
      1) WebPage should not try to print contents of the backbuffer as that would result in upscaling. Instead it should request a complete repaint and flush the resulting rendering queue onto the printer.
      2) PrinterGraphics is a J2DGraphics, while PrismImages typically hold D3D/GL textures. Those cannot be rendered onto a PrinterGraphics directly, so we should convert them temporarily to J2D textures.
      3) WCGraphicsPrismContext.init() has the following code:
          baseGraphics = g != null ? g.getRenderTarget().createGraphics() : null;
          createGraphics() causes an exception with the implementation of PrinterGraphics we get when printing.
      4) PrismInvoker.runOnRenderThread() assumes it can be called from either FX thread or Render thread. As printing may occur on any thread, this assumption is no longer correct.

      This bug applies to printing WebView as a Node. A separate issue, RT-17666, discusses printing WebView _contents_ as a document.

            peterz Peter Zhelezniakov
            peterz Peter Zhelezniakov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: