cups 如何根据任务id获取到打印方向信息
时间: 2023-08-18 07:08:31 浏览: 84
要获取打印任务的方向信息,您可以使用以下命令:
```
lpoptions -p <printer_name> -l | grep -i orientation-requested
```
其中,`<printer_name>` 是打印机名称,`lpoptions` 命令用于显示或更改打印机选项,`-p` 选项指定打印机名称,`-l` 选项用于列出所有可用的选项。`grep` 命令用于查找“orientation-requested”关键字,以获取打印方向信息。
如果您知道打印任务的ID,您可以使用以下命令来获取该任务的打印方向信息:
```
lpoptions -p <printer_name> -l -o job-id=<job_id> | grep -i orientation-requested
```
其中,`<job_id>` 是打印任务的ID,`-o job-id=<job_id>` 选项用于指定打印任务的ID。
相关问题
cups 如何根据任务id获取到打印方向
可以通过以下命令获取任务id为`job_id`的打印任务的方向:
```
lpoptions -p <printer_name> -o job-attributes-job-id=<job_id> -l | grep -oP 'orientation-requested=(portrait|landscape)'
```
其中,`<printer_name>`表示打印机名称,`<job_id>`表示打印任务的id。如果输出结果中包含`orientation-requested=portrait`,则表示打印方向为竖向;如果包含`orientation-requested=landscape`,则表示打印方向为横向。
阅读全文
相关推荐
![-](https://img-home.csdnimg.cn/images/20210720083447.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)