N
Nicola Talbot
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
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