save
This commit is contained in:
parent
b55b4e87a6
commit
9f2a6e56ff
@ -254,8 +254,8 @@ public class PdfPrinter {
|
|||||||
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
|
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
|
||||||
|
|
||||||
// 设置纸张大小
|
// 设置纸张大小
|
||||||
String size = option.getSize() != null ? option.getSize() : "Letter";
|
// String size = option.getSize() != null ? option.getSize() : "Letter";
|
||||||
aset.add(PAPER_SIZES.getOrDefault(size, MediaSizeName.NA_LETTER));
|
// aset.add(PAPER_SIZES.getOrDefault(size, MediaSizeName.NA_LETTER));
|
||||||
|
|
||||||
// 设置颜色模式
|
// 设置颜色模式
|
||||||
setColorMode(aset, option.getColor());
|
setColorMode(aset, option.getColor());
|
||||||
@ -280,7 +280,7 @@ public class PdfPrinter {
|
|||||||
* @return PDF页面方向
|
* @return PDF页面方向
|
||||||
*/
|
*/
|
||||||
private static Orientation getPdfOrientation(String orientationStr) {
|
private static Orientation getPdfOrientation(String orientationStr) {
|
||||||
if (orientationStr != null && "ORI_LANDSCAPE".equalsIgnoreCase(orientationStr)) {
|
if ("ORI_LANDSCAPE".equalsIgnoreCase(orientationStr)) {
|
||||||
return Orientation.LANDSCAPE;
|
return Orientation.LANDSCAPE;
|
||||||
}
|
}
|
||||||
return Orientation.PORTRAIT; // 默认为纵向
|
return Orientation.PORTRAIT; // 默认为纵向
|
||||||
@ -293,7 +293,14 @@ public class PdfPrinter {
|
|||||||
* @param color 颜色模式字符串
|
* @param color 颜色模式字符串
|
||||||
*/
|
*/
|
||||||
private static void setColorMode(PrintRequestAttributeSet aset, String color) {
|
private static void setColorMode(PrintRequestAttributeSet aset, String color) {
|
||||||
if (color != null && ("Full Color".equalsIgnoreCase(color) || "Cover Letter Color Only".equalsIgnoreCase(color))) {
|
if (color == null) {
|
||||||
|
aset.add(Chromaticity.MONOCHROME);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String c = color.trim().toLowerCase();
|
||||||
|
|
||||||
|
if (c.equals("color") || c.equals("full color") || c.equals("cover letter color only")) {
|
||||||
aset.add(Chromaticity.COLOR);
|
aset.add(Chromaticity.COLOR);
|
||||||
} else {
|
} else {
|
||||||
aset.add(Chromaticity.MONOCHROME);
|
aset.add(Chromaticity.MONOCHROME);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user