|
1 | 1 | /* |
2 | | - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 | 4 | * |
5 | 5 | * This code is free software; you can redistribute it and/or modify it |
@@ -203,16 +203,17 @@ public static CustomMediaSizeName create(String name, String choice, |
203 | 203 | if (value == null) { |
204 | 204 | value = new CustomMediaSizeName(name, choice, width, length); |
205 | 205 | customMap.put(key, value); |
206 | | - |
207 | | - // add this new custom media size name to MediaSize array |
208 | | - if ((width > 0.0) && (length > 0.0)) { |
209 | | - try { |
210 | | - new MediaSize(width, length, Size2DSyntax.INCH, value); |
211 | | - } catch (IllegalArgumentException e) { |
| 206 | + if (value.getStandardMedia() == null) { |
| 207 | + // add this new custom media size name to MediaSize array |
| 208 | + if ((width > 0.0) && (length > 0.0)) { |
| 209 | + try { |
| 210 | + new MediaSize(width, length, Size2DSyntax.INCH, value); |
| 211 | + } catch (IllegalArgumentException e) { |
212 | 212 | /* PDF printer in Linux for Ledger paper causes |
213 | 213 | "IllegalArgumentException: X dimension > Y dimension". |
214 | 214 | We rotate based on IPP spec. */ |
215 | | - new MediaSize(length, width, Size2DSyntax.INCH, value); |
| 215 | + new MediaSize(length, width, Size2DSyntax.INCH, value); |
| 216 | + } |
216 | 217 | } |
217 | 218 | } |
218 | 219 | } |
|
0 commit comments