mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 01:54:47 +02:00
6601097: Margins are not reset to hardware margins when width/height is 0 or -ve alongwith x, y
Reviewed-by: prr, jdv
This commit is contained in:
parent
69128416e4
commit
1d8080cca9
2 changed files with 55 additions and 9 deletions
|
@ -683,7 +683,21 @@ public abstract class RasterPrinterJob extends PrinterJob {
|
|||
float iw = (float)(page.getPaper().getImageableWidth()/DPI);
|
||||
float iy = (float)(page.getPaper().getImageableY()/DPI);
|
||||
float ih = (float)(page.getPaper().getImageableHeight()/DPI);
|
||||
if (ix < 0) ix = 0f; if (iy < 0) iy = 0f;
|
||||
|
||||
if (ix < 0) ix = 0; if (iy < 0) iy = 0;
|
||||
if (iw <= 0) iw = (float)(page.getPaper().getWidth()/DPI) - (ix*2);
|
||||
|
||||
// If iw is still negative, it means ix is too large to print
|
||||
// anything inside printable area if we have to leave the same margin
|
||||
// in the right side of paper so we go back to default mpa values
|
||||
if (iw < 0) iw = 0;
|
||||
|
||||
if (ih <= 0) ih = (float)(page.getPaper().getHeight()/DPI) - (iy*2);
|
||||
|
||||
// If ih is still negative, it means iy is too large to print
|
||||
// anything inside printable area if we have to leave the same margin
|
||||
// in the bottom side of paper so we go back to default mpa values
|
||||
if (ih < 0) ih = 0;
|
||||
try {
|
||||
pageAttributes.add(new MediaPrintableArea(ix, iy, iw, ih,
|
||||
MediaPrintableArea.INCH));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue