void () { final float width = <error descr="Cannot resolve method 'getSize' in 'ParenBug'">getSize</error>().width; // actual width in dots final float height = <error descr="Cannot resolve method 'getSize' in 'ParenBug'">getSize</error>().height; // actual height in dots // to determine the ratio, do the following: final float ratio; if (pageWidth != -1) { ratio = pageWidth / (width / (float) resolution * (float) 2.54); // should not warn here } else { ratio = pageHeight / (height / (float) resolution * (float) 2.54); } System.out.println("resolution: X=" + resolution); System.out.println("page_width (cm): " + pageWidth); System.out.println("ratio=" + ratio); System.out.println(64 / (2 * 16 / 4 * 2 * 2)); }