Obtaining Available Paper Sizes
Why is it that the following code does not show all page sizes defined in the printer driver (not even all standard ones?)
PrintService[] printServices;
PrintServiceAttributeSet attribs;
MediaSize ms;
attribs = new HashPrintServiceAttributeSet();
printServices = PrintServiceLookup.lookupPrintServices(null, attribs);
for (PrintService ps : printServices)
{
System.out.println(ps.getName());
for (Media media : (Media[]) ps.getSupportedAttributeValues(Media.class, null, null))
{
if (media instanceof MediaSizeName)
{
ms = MediaSize.getMediaSizeForname((MediaSizeName) media);
System.out.println("\t" + media + ": " + ms);
}
else
{
System.out.println("\t" + media);
}
}
}
-
To answer my own question: it turns out that java refuses paper sizes with x > y; it does not fit in a MediaSize.
Java seems to have a different notion of orientation (from the java 1.7 api of OrientationRequested):
PORTRAIT The content will be imaged across the short edge of the medium.
LANDSCAPE The content will be imaged across the long edge of the medium.
so in java, orientation is not related to the print direction.
0
Please sign in to leave a comment.
Comments
1 comment