Hi Alexander,

On 27.06.2015 8:30, Александр Свиридов wrote:
Hi Anton,

I send all files. If you open index.html in IE and printpreview->set scale 100% -> print , you will get 16.8 cm of div on paper.

If you you print via application I did you will get quite different size.

WebView is a WebKit-based browser, IE is not. It doesn't mean they should behave differently, but they can. So, if you want to test WebView, you're better to compare it with the WebKit family browsers. Safari or Chrome (based on Blink, a WebKit fork) at least. In most cases WebView should behave the same, if it doesn't - this may be a sign of a bug (or it may be a problem of the WebKit codebase, WebView is based on currently).

In case of the test you've provided, Chrome behaves the same. I investigated it a little and found out that the reason of that the printed content differs in size from the content you see on screen is this style defined in the html file:

    <style>
    body{
        <!-- ... --->
        min-width: 1000px;
    }
    </style>

"For printers and high resolution screens 1px implies multiple device pixels." 
as can be found here:

http://www.w3schools.com/cssref/css_units.asp

I don't know why IE and Chrome produce different results on the same printer, but WebView behaves like Chrome in this case. So, I don't see a bug in WebView.

Regards,
Anton.



Пятница, 19 июня 2015, 17:03 +03:00 от "Anton V. Tarasov" 
<anton.tara...@oracle.com>:

    Hi Alexander,

    Could you please create and send a simple test case (fully functioning) 
with the exact URL of
    a page
    you're printing?

    Regards,
    Anotn.

    On 15.06.2015 8:53, Александр Свиридов wrote:
    > To print my html page I use the following code:
    > PrinterJob job =PrinterJob.createPrinterJob();if(job !=null&& 
job.showPrintDialog(null)){
    > webView.getEngine().print(job);
    > job.endJob();}
    > The problem is that webview changes the scale of printing page. For 
example, when I print
    this html page in IE with fit to size 100% I get 16.8 cm. When I print in 
my java application
    I get 11.4cm. The size in html file I set in pt - my width is 475pt(A4 
width=595pt,so
    475pt=16.8cm). How to print with webview and to have 100% width and height?



Reply via email to