JDK-5095586 : Add new MediaSize to javax.print.attribute.standard
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 5.0
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2004-09-01
  • Updated: 2016-03-22
Related Reports
Duplicate :  
Description
Name: rmT116609			Date: 09/01/2004


A DESCRIPTION OF THE REQUEST :
CR80 (3 3/8" x 2 1/8") is the most common size for cards, when you try to use a card printer (tested with Datacard SP55 and Datacard SP35 printers) on Windows 2000/XP it's not posible to select the CR80 page size (although you can with Windows 98 SE).
Since you can not use javax.print.attribute.standard.MediaSize to create a custom MediaSize, CR80 should be a standard one included on the JDK.

JUSTIFICATION :
Card printers are not-so-uncommon peripherals, and with the actual behavior are unusable with Java unless you do some custom developments on the printer side, with a custom PrintService or something simmilar.
In order to use cards printers from Java applications we need a CR80 MediaSize definition.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
  To be able to select CR80 as MediaSize when using card (only) printers.
ACTUAL -
Since the card printers usually only accepts card specific MediaSizes (CR80, sometimes CR50 also) you can not select any MediaSize present on JDK, and it selects javax.print.attribute.standard.MediaSize.NA.LETTER as default, messing the printer output.
(Incident Review ID: 301631) 
======================================================================
FULL PRODUCT VERSION :
java version "1.5.0_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
4NT  6.01.233U   Windows XP 5.1

A DESCRIPTION OF THE PROBLEM :
It is not possible to select a media size of US Standard Fanfold (14.875" x 11") in the printer setup dialogue because it is not defined in the javax.print.attribute.standard.Media* classes.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the sample below; pick a printer that should support US Std Fanfold paper.  All other standard paper sizes are available except for that one.

Comments
EVALUATION We do query the driver for its custom sizes and report those back so this should work already. I installed the Datacard (www.datacard.com) Smart Driver for the SP55 on XP SP2 to help me understand the problem. It looks like this driver reports back the correct size (540x857 mm) and name "CR80 2.13 x 3.38" but it reports the windows paper ID as "9". This is the windows ID for A4 paper size. So this looks to be a driver bug. It should be set to a custom ID. So we get as far as creating the custom paper but then we notice its supposed to be A4 and substitute that. Also if we call OpenPrinter() and get a devmode, the driver sets the DM_PAPERSIZE bit, and has set its value to "1" which is the windows ID for LETTER. This looks like another driver bug. I noticed that when installing the driver I was warned it hadn't passed Window certification testing! Sounds about right. We could add some extra checking for these cases, but I don't much like the idea of the extra complexity for the benefit of a buggy driver.
18-06-2007