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

[Windows] Printing SVG document with WebView can produce blank pages

    Details

    • Subcomponent:
      web
    • CPU:
      generic
    • OS:
      windows

      Description

      FULL PRODUCT VERSION :
      java version "1.8.0_162-ea"
      Java(TM) SE Runtime Environment (build 1.8.0_162-ea-b03)
      Java HotSpot(TM) Client VM (build 25.162-b03, mixed mode, sharing)

      I original discovered this in a much earlier release.

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]
      Microsoft Windows [Version 10.0.15063]

      A DESCRIPTION OF THE PROBLEM :
      The test program is a bit more intricate than a normal but report would be, since it has a more complete test case. However, a very quick way to reproduce this is to:
      - Open the application
      - Set your printer
      - (I use the “Microsoft XPS Document Writer” to save paper, and because I can set the margins to zero)
      - Click on the “Direct” checkbox.
      - Click the “Print” button
      - Set your margins to zero all around
       
      What you will get is two blank pages. Set your margins up a bit, and you will get 1 page. Setting the margins to zero is a reliable way to reproduce this, but it happens sporadically with different values as well. I have been unable to find a pattern or a workaround.

      This may seem like a corner case, but since I need to control the print, I hit it a lot. This spill over to another page when the printable area and the content area sizes are the same is a big issue for me.
       
      I have SVG files that are more interesting than these, but with these we can tell that it is not the SVG that is causing the problem. J
       
      The difference between the two SVG files are the units the bounding box is specified in. One is in points and the other in pixels. Both will have a “value”, which is in pixels, and a “valueInSpecifiedUnits”, which is the specified value.
       
      Here are the properties of “document.getElementsByTagName('svg')[0].width.baseVal”. I got these from another test program I have which allows me to run JavaScript directly on the running webview to get information like this. (Very handy.)
       
      unitType:: 5
      value:: 612
      valueInSpecifiedUnits:: 612
      valueAsString:: 612px


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      - Open the application
      - Set your printer
      - (I use the “Microsoft XPS Document Writer” to save paper, and because I can set the margins to zero)
      - Click on the “Direct” checkbox.
      - Click the “Print” button
      - Set your margins to zero all around

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      No blank pages.
      ACTUAL -
      Blank pages, depending upon the settings.

      REPRODUCIBILITY :
      This bug can be reproduced often.

      ---------- BEGIN SOURCE ----------
      The source code is in the form of a Netbeans project. I will upload later
      ---------- END SOURCE ----------

        Attachments

          Activity

            People

            • Assignee:
              ghb Guru Hb
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: