<AWT Dev> Clarification regarding PageFormat and Paper getImageable* functions orientation consideration

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

<AWT Dev> Clarification regarding PageFormat and Paper getImageable* functions orientation consideration

Rajat Mahajan

Hi all,

 

Issue:

 

I am working on https://bugs.openjdk.java.net/browse/JDK-8203395  and this bug is about “PageFormat showing wrong printer margins in LANDSCAPE orientation” .

 

Application code it trying to print in Landscape and Portrait but both show same margins:

 

Margins default : 12,12,17,17

Margins OrientationRequested.LANDSCAPE : 12,12,17,17

 

The code of the application uses Paper object for getting margins :

           

PageFormat pf = printerJob.getPageFormat(aset);

       Paper paper = pf.getPaper();

       long paperTopMargin = Math.round(paper.getImageableY());
       long paperLeftMargin = Math.round(paper.getImageableX());
       long paperRightMargin = Math.round(paper.getWidth() - paper.getImageableWidth() - paperLeftMargin);
       long paperBottomMargin = Math.round(paper.getHeight() - paper.getImageableHeight() - paperTopMargin);

 

When I looked at the latest JDK code, PageFormat getImageable functions are taking into account Orientation and Paper getImageable functions are not , and hence we see the same output.

 

Using Page format object instead of Paper shows the correct output:

          

Margins default : 12,12,17,17

Margins OrientationRequested.LANDSCAPE : 17,17,12,12

 

Question:

 

My question is that should Paper getImageable* functions also need take into account orientation as per spec ?, or is the current behavior of them not considering orientation correct and why ?

Reply | Threaded
Open this post in threaded view
|

Re: <AWT Dev> Clarification regarding PageFormat and Paper getImageable* functions orientation consideration

Philip Race
Wrong list. That is a 2D API.

-phil.

On 3/22/21 12:09 PM, Rajat Mahajan wrote:

Hi all,

 

Issue:

 

I am working on https://bugs.openjdk.java.net/browse/JDK-8203395  and this bug is about “PageFormat showing wrong printer margins in LANDSCAPE orientation” .

 

Application code it trying to print in Landscape and Portrait but both show same margins:

 

Margins default : 12,12,17,17

Margins OrientationRequested.LANDSCAPE : 12,12,17,17

 

The code of the application uses Paper object for getting margins :

           

PageFormat pf = printerJob.getPageFormat(aset);

       Paper paper = pf.getPaper();

       long paperTopMargin = Math.round(paper.getImageableY());
       long paperLeftMargin = Math.round(paper.getImageableX());
       long paperRightMargin = Math.round(paper.getWidth() - paper.getImageableWidth() - paperLeftMargin);
       long paperBottomMargin = Math.round(paper.getHeight() - paper.getImageableHeight() - paperTopMargin);

 

When I looked at the latest JDK code, PageFormat getImageable functions are taking into account Orientation and Paper getImageable functions are not , and hence we see the same output.

 

Using Page format object instead of Paper shows the correct output:

          

Margins default : 12,12,17,17

Margins OrientationRequested.LANDSCAPE : 17,17,12,12

 

Question:

 

My question is that should Paper getImageable* functions also need take into account orientation as per spec ?, or is the current behavior of them not considering orientation correct and why ?