Unable to use borderless printing on Linux and Mac
Gennadiy Krivoshein
gennadiy.krivoshein at bell-sw.com
Thu Feb 6 11:58:39 UTC 2025
Hi, client-libs-dev.
I faced a problem with borderless printing on Linux and Mac. It's
impossible to use borderless printing if I print without a print dialog or
use a common print dialog.
After my investigation, I found two problems.
1. It's impossible to select borderless media in the common print
dialog because it has the same name as bordered media. For example, I see
two "A4 (ISO/DIN & JIS)" media in the media combobox, but my printer's PPD
file contains A4 and A4_borderless media with the same paper size and
different imageable areas.
2. PSPrinterJob doesn't provide the required borderless media to CUPS.
I can select InputSlot, but I can't select the necessary borderless media.
I see two possible options to solve the first problem.
1. Squash the same media names. In this case, there are no media name
collisions, but it requires a new selector to select the type of margins.
It might be a combobox with 3 values ("No margins", "minimal margins",
"custom margins"), the first value means borderless printing. But there is
no one-to-one mapping of the MediaSizeName to the MediaPrintableArea; one
MediaSizeName will be mapped to 2 MediaPrintableAreas (bordered and
borderless);
2. Do not map media names from the CUPS to the standard names to see
all media without name collision. This case requires mapping of all CUPS
media to the MediaSize so the MediaSize's static mediaMap field will
contain duplicates (one value for bordered media and one for borderless).
Two possible options to pass borderless selection to CUPS:
1. Add four new IPP attributes (media-left-margin, media-right-margin,
media-top-margin, media-bottom-margin) and use them as described in 6.3.1.1
"Media Selection and Full-Bleed Printing" of the "IPP Job Extensions v2.1"
, use borderless print option if a user passes all of them with 0 value and
necessary MediaSizeName ("margin-left=0 margin-right=0 margin-top=0
margin-bottom=0 media=A4"). But it's impossible to use it as described in
the IPP standard with CUPS, because CUPS ignores these attributes, it
should be mapped to the particular CUPS media name (for example, use
"media=A4_borderless" instead of "media=A4 margin-left=0 margin-right=0
margin-top=0 margin-bottom=0").
2. Add a new PrintRequestAttribute class (Borderless.class) and pass it
as a marker with MediaSizeName attribute if a user wants to use the
borderless print option. This attribute is not an IPP attribute but
requires less effort.
All of these options require a new public API and I would like to ask for
advice before proceeding with a PR&CSR.
BR,
Gennadiy.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/client-libs-dev/attachments/20250206/ebd417e8/attachment.htm>
More information about the client-libs-dev
mailing list