MediaPrintableArea changed from JDK5 to JDK6

Discussion in 'Java' started by Nicola Talbot, Aug 3, 2008.

  1. Hi,

    I'm getting different results for the printable area for different
    versions of java (running on Linux 2.6.17-1.2142_FC4). The code below
    just gets the printable area for A4 landscape.

    Using java version "1.5.0_09", I get:

    (6.35,6.35)->(197.3,284.3)mm

    This area is centred on A4 landscape paper, which is what I expect.

    Using java version "1.6.0_07", I get:

    (12.7,12.7)->(197.203,284.339)mm

    Since A4 landscape is (297mm x 210mm), this means that the printable
    area goes slightly off the edge of the paper. It seems the offset has
    been doubled and the area has (very slightly) increased. I searched
    the bug database, but couldn't find anything that matched (although
    it's possible I may have missed something). Has anyone else come
    across this? Both examples were run using the same printer and printer
    driver.

    import java.awt.print.*;
    import javax.print.*;
    import javax.print.attribute.*;
    import javax.print.attribute.standard.*;

    public class TestMediaPrintableArea
    {
    public static void main(String[] args)
    {
    HashPrintRequestAttributeSet aset
    = new HashPrintRequestAttributeSet();

    aset.add(MediaSizeName.ISO_A4);
    aset.add(OrientationRequested.LANDSCAPE);

    PrintService[] services = PrinterJob.lookupPrintServices();

    if (services.length > 0)
    {
    MediaPrintableArea[] mpa = (MediaPrintableArea[])
    services[0].getSupportedAttributeValues(
    MediaPrintableArea.class,null,
    aset);

    for (int i = 0; i < mpa.length; i++)
    {
    System.out.println(mpa);
    }
    }
    }
    }

    Regards
    Nicola Talbot
    Nicola Talbot, Aug 3, 2008
    #1
    1. Advertising

  2. Nicola Talbot wrote:
    > I'm getting different results for the printable area for different
    > versions of java (running on Linux 2.6.17-1.2142_FC4). [snip]


    Further searching through the bug database led me to
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6726691
    which may be the same problem. (I obviously didn't choose the right
    keywords on my previous search.)

    Regards
    Nicola Talbot
    Nicola Talbot, Aug 5, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Barth?l?my von Haller

    jdk5.0 and javadoc

    Barth?l?my von Haller, Oct 1, 2004, in forum: Java
    Replies:
    2
    Views:
    1,422
    Tor Iver Wilhelmsen
    Oct 1, 2004
  2. metfan

    Is JDK5.0 stable enough?

    metfan, Nov 23, 2004, in forum: Java
    Replies:
    6
    Views:
    719
    Oscar kind
    Nov 24, 2004
  3. Replies:
    3
    Views:
    4,128
    Dale King
    May 10, 2005
  4. TsanChung
    Replies:
    4
    Views:
    1,058
    TsanChung
    Sep 26, 2008
  5. jojo.hikaru
    Replies:
    0
    Views:
    1,762
    jojo.hikaru
    Jun 25, 2009
Loading...

Share This Page