Copies ignored when printing from Chromium with duplex (splix PPD lacks *Collate; CUPS chain passes NumCopies correctly)
还没有人认领这个 Issue。
评估
调研方向
从 src/rastertoqpdl.cpp 和 include/request.h 开始,追踪 CUPS 的份数值如何传递到 Request,然后阅读输出 PJL 作业头的 src/printer.cpp。当请求的份数大于一时,将其添加到作业头中,并确认两份作业包含 @PJL SET COPIES=2,而一份作业保持不变。
由索引模型根据 Issue 内容生成。
描述
Summary
rastertoqpdl silently drops the number of copies requested by the application: every job prints exactly one copy, no matter what "copies" value is passed through CUPS. This is most visible when printing from a browser (Chromium/Edge: duplex + N copies → only one sheet comes out), but it affects every client that requests copies through the CUPS job options, including plain lp -n 2.
Root cause
src/rastertoqpdl.cppreads the copies count from the CUPS filterargv[4]and stores it in theRequestobject (Request::_copiesNr, set inloadRequest()).- But
_copiesNr/copiesNr()is never read anywhere afterwards. - The copy count that actually ends up in the QPDL page header (
src/qpdl.cpp:header[0x2..0x3] = page->copiesNr()) is taken from the CUPS raster page header (src/document.cpp:page->setCopiesNr(header.NumCopies)), which raster producers leave at 1.
Net effect: the requested copies count is discarded.
How to reproduce
lp -n 2 -d <splix-driven-queue> # a one-page job prints exactly one copy
Observed on a Samsung ML-2160 (USB), splix 2.0.2, CUPS 2.4.16, Ubuntu 26.10.
Suggested fix
Let the printer engine duplicate the job: emit @PJL SET COPIES=N in the PJL job header when N > 1. Engine-side duplication keeps per-copy duplex collation correct, whereas duplicating page data inside the QPDL stream would break collation for duplex jobs.
The following patch against 2.0.2 was built and verified on an ML-2160: after applying it, a 2-copy job stream contains @PJL SET COPIES=2, while 1-copy jobs are untouched.
--- splix-pristine/include/request.h
+++ splix-patched/include/request.h
@@ -110,6 +110,10 @@
*/
Duplex duplex() const {return _duplex;}
/**
+ * @return the number of copies requested for this job.
+ */
+ unsigned long copiesNr() const {return _copiesNr;}
+ /**
* @return TRUE if it's a reversed duplex. Otherwise it returns FALSE.
*/
bool reverseDuplex() const {return _reverseDuplex;}
--- splix-pristine/src/printer.cpp
+++ splix-patched/src/printer.cpp
@@ -272,6 +272,11 @@
break;
}
+ // Honor the number of copies requested by the application (CUPS argv[4]):
+ // the engine duplicates the job, which keeps duplex collation correct.
+ if (request.copiesNr() > 1)
+ printf("@PJL SET COPIES=%lu\n", request.copiesNr());
+
// Set some job options
if (request.ppd()->get("MediaType").isNull())
printf("@PJL SET PAPERTYPE=OFF\n");
Happy to prepare a proper PR if that helps.
- 主要语言
- C++
- 星标
- 54
- 派生
- 20
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
OpenPrinting/splix 的其他 Issue
-
难度 5/5 一周以上 新手友好度 35/100
OpenPrinting/splix#26 · 3 条评论 ·
-
Multi-threading issues可能已有人在做 @dutch2005 于 188 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 38/100
OpenPrinting/splix#15 · 6 条评论 ·
-
难度 4/5 3-5 天 新手友好度 42/100
OpenPrinting/splix#8 · 5 条评论 ·
查看 OpenPrinting/splix 的全部 Issue
相似的 Issue
-
Shell: serve the home app's Cookie Policy on a hard reload可能已有人在做 @2001anshkaushik 今天认领。 未关闭feature module:ai
难度 2/5 1-3 小时 新手友好度 88/100
rocketride-org/rocketride-server#2899 · 1 条评论 ·
维护者通常 2 天内回复
-
难度 1/5 1 小时以内 新手友好度 85/100
rice-solar-physics/HYDRAD#113 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 3 天内回复
-
status:needs-triage
难度 2/5 1-3 小时 新手友好度 76/100
PX4/PX4-Autopilot#29496 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 66/100
madskristensen/FileIcons#385 ·