When a printer reports paper sizes CustomMediSizeName tries to match the reported size to one of the standard paper sizes such as "A4" that are defined in the javax.print.attribute.standard/MediaSize class and associated classes. This is then available as CustomMediSizeName.getStandardMedia() MediaSize,findMedia(..) is used to locate the matching standard media. We use whatever it returns which is wrong. It will try to find the closest paper, returning null only when the size we have is radically different. So often we end up matching a media with an inappropriate size. Instead we should consider it completely custom. If the sizes are not really close we should not report that it matches a standard media. This only affects CUPS printing as that is the only code path that uses CustomMediSizeName.getStandardMedia()