PrintRequestAttributeSet属性设置
时间: 2023-12-20 13:05:51 浏览: 23
PrintRequestAttributeSet属性可以用于设置打印任务的参数,包括打印机名称、纸张大小、打印质量等等。以下是一些常见的PrintRequestAttributeSet属性及其使用方法:
1. PrinterName:设置打印机名称
```
PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
attributes.add(new PrinterName("PrinterName", null));
```
2. MediaSizeName:设置纸张大小
```
PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
MediaSizeName mediaSizeName = MediaSizeName.ISO_A4;
attributes.add(mediaSizeName);
```
3. PrintQuality:设置打印质量
```
PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
PrintQuality printQuality = PrintQuality.HIGH;
attributes.add(printQuality);
```
4. Copies:设置打印份数
```
PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
Copies copies = new Copies(2);
attributes.add(copies);
```
5. Sides:设置双面打印
```
PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
Sides sides = Sides.DUPLEX;
attributes.add(sides);
```
以上是一些常用的PrintRequestAttributeSet属性及其用法,你可以根据自己的需求进行设置。
相关推荐
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)