RFR: 8372952: Printed content is cut off when width > height [v2]
GennadiyKrivoshein
duke at openjdk.org
Wed Feb 4 08:26:01 UTC 2026
> These changes fix https://bugs.openjdk.org/browse/JDK-8372952 "Printed content is cut off when width > height".
>
> There are three issues which cause this bug.
> #### The first issue
> Media printable area does not match the corresponding media size for the landscape-oriented medias. \
> An example of the actual prints on a paper 80mmx40mm (Epson T-TA88V)
> [actual_cut_off.pdf](https://github.com/user-attachments/files/25064646/actual_cut_off.pdf)
>
> #### The second issue
> _MediaSize_ does not allow landscape-oriented medias (X dimension bigger than Y dimension of the media) so rotated size is used, but the media printable area stays the same - landscape-oriented.
> Current implementation does not allow to use landscape-oriented paper because _MediaSize_
> constructor allows portrait paper only (width < height).
>
> I read comments about _MediaSize_ restrictions (width<height) in https://bugs.openjdk.org/browse/JDK-8041911, which states that this is "by design" and specification. But I did not find media size restrictions in the https://datatracker.ietf.org/doc/html/rfc2911.
> The RFC defines "orientation-requested" attribute, that was mentioned in the JDK-8041911 comments, but this attribute indicates the desired orientation for printed print-stream pages and is used for only a subset of the supported document formats ('text/plain' or 'text/html') to format the document. \
> As described in the RFC https://datatracker.ietf.org/doc/html/rfc2911#section-15.3
>> If the document data has been formatted, then go to step 2. Otherwise, the document data MUST be formatted. The formatting detection algorithm is implementation defined and is not specified by this document. The formatting of the document data uses the "orientation-requested" attribute to determine how the formatted print data should be placed on a print-stream page
>
> Therefore, if a printer object uses a landscape-oriented paper, a document format is "text/plain" and an "orientation-requested" attribute contains "portrait" value then the printer object should rotate the document 90 degrees. \
> If a printer uses a portrait-oriented paper, a document format is "text/plain," and an "orientation-requested" attribute contains value "portrait" then the printer object does no rotation.
>
> Also, https://datatracker.ietf.org/doc/html/rfc3382 defines a "media-size" IPP attribute which identifies the size of the media. The RFC contains an example of this attribute where the X-dimension (the width of the media in inch) larger than the...
GennadiyKrivoshein has updated the pull request incrementally with one additional commit since the last revision:
Reformat test
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/29560/files
- new: https://git.openjdk.org/jdk/pull/29560/files/95935d4f..8fdbdb2a
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=29560&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=29560&range=00-01
Stats: 33 lines in 1 file changed: 3 ins; 0 del; 30 mod
Patch: https://git.openjdk.org/jdk/pull/29560.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/29560/head:pull/29560
PR: https://git.openjdk.org/jdk/pull/29560
More information about the client-libs-dev
mailing list