[{"data":1,"prerenderedAt":496},["ShallowReactive",2],{"ofd-doc:\u002Fguide\u002Fprinting":3,"ofd-source:recipes\u002Fprinter.ts":86,"mdc--8s90yx-key":87},{"id":4,"title":5,"body":6,"description":69,"extension":70,"keywords":71,"locale":77,"meta":78,"navigation":79,"order":80,"path":81,"section":82,"seo":83,"stem":84,"__hash__":85},"docs\u002Fguide\u002Fprinting.zh-CN.md","打印与批量打印",{"type":7,"value":8,"toc":63},"minimark",[9,13,22,25,28,43,47],[10,11,12],"h2",{"id":12},"在工作台打印",[14,15,16,17,21],"p",{},"打开「文件 → 打印与批量打印」。可以使用当前文件或添加其他 OFD，指定文件顺序、每份的页码范围、份数和单面或双面。在原生预览中核对页面外观，再选择可用的打印目的地。页码从 1 开始，例如 ",[18,19,20],"code",{},"1,3-5","，留空表示全部页面。",[14,23,24],{},"浏览器打印会打开系统或浏览器对话框。先核对实际纸盒和文档尺寸。A4 是 210 × 297 毫米，Letter 是 215.9 × 279.4 毫米。纸张不一致会触发缩放或留白。检查预览的边距和缩放设置，纸张边缘的可打印范围还取决于设备。",[10,26,27],{"id":27},"由服务器提交",[14,29,30,31,34,35,38,39,42],{},"页面预览直接来自 OFD。无浏览器打印可在宿主的 Node 服务上使用 IPP 队列。单个完整文件遇到声明支持 OFD 的队列可直接发送原字节；选页、拼批或其他设备可通过下方编码器生成队列支持的 PWG Raster 或 PDF 打印流。部署此编码器需要 ",[18,32,33],{},"sharp","、",[18,36,37],{},"happy-dom"," 和 ",[18,40,41],{},"pdf-lib","。",[44,45],"docs-recipe",{"name":46},"recipes\u002Fprinter",[14,48,49,50,53,54,57,58],{},"作业按文件顺序整理。双面打印时，前一份文件选中的页数为奇数，下一份文件会从新纸张开始。服务会检查打印权限、份数与设备能力。收到 ",[18,51,52],{},"jobId"," 表示队列已经接收，后续用 ",[18,55,56],{},"status(jobId, signal)"," 查询。若连接在提交后中断，应先核对队列，避免重复出纸。",[59,60,62],"a",{"href":61},"\u002Fapi","打印服务接口",{"title":64,"searchDepth":65,"depth":65,"links":66},"",2,[67,68],{"id":12,"depth":65,"text":12},{"id":27,"depth":65,"text":27},"先预览 OFD 原生页面，再向浏览器或宿主打印队列提交选定的文件和页码。","md",[72,73,74,75,76],"打印","批量打印","IPP","PWG Raster","A4","zh-CN",{},true,3,"\u002Fguide\u002Fprinting","工作台",{"title":5,"description":69},"guide\u002Fprinting.zh-CN","OSfnH8eLxcIGxH_mLeNOBYo7KmLNbDICtCHyaGHyXFA","import type { OFDPrintJob } from \"@quirekit\u002Fofd-editor\u002Fprint\";\nimport { createOFDIPPPrintService } from \"@quirekit\u002Fofd-editor\u002Fprint\u002Fipp\";\nimport { encodeNodeOFDPrintJob } from \"@quirekit\u002Fofd-editor\u002Fprint\u002Fnode\";\n\n\u002F**\n * Submits a validated batch to an operator-configured queue from Node.\n * @param printerUri - Printer URI from trusted server configuration.\n * @param job - Files, physical page selections, sides and copies approved by the user.\n * @param signal - Request lifetime.\n * @returns A receipt for querying queue status.\n *\u002F\nexport function submitToQueue(printerUri: string, job: OFDPrintJob, signal: AbortSignal) {\n  const queue = createOFDIPPPrintService({\n    label: \"Office\", printerUri, encode: encodeNodeOFDPrintJob,\n  });\n  return queue.submit(job, signal);\n}\n",{"data":88,"body":89},{},{"type":90,"children":91},"root",[92,490],{"type":93,"tag":94,"props":95,"children":99},"element","pre",{"className":96,"code":97,"language":98,"meta":64,"style":64},"language-ts shiki shiki-themes github-light github-light github-dark","import type { OFDPrintJob } from \"@quirekit\u002Fofd-editor\u002Fprint\";\nimport { createOFDIPPPrintService } from \"@quirekit\u002Fofd-editor\u002Fprint\u002Fipp\";\nimport { encodeNodeOFDPrintJob } from \"@quirekit\u002Fofd-editor\u002Fprint\u002Fnode\";\n\n\u002F**\n * Submits a validated batch to an operator-configured queue from Node.\n * @param printerUri - Printer URI from trusted server configuration.\n * @param job - Files, physical page selections, sides and copies approved by the user.\n * @param signal - Request lifetime.\n * @returns A receipt for querying queue status.\n *\u002F\nexport function submitToQueue(printerUri: string, job: OFDPrintJob, signal: AbortSignal) {\n  const queue = createOFDIPPPrintService({\n    label: \"Office\", printerUri, encode: encodeNodeOFDPrintJob,\n  });\n  return queue.submit(job, signal);\n}\n\n","ts",[100],{"type":93,"tag":18,"props":101,"children":102},{"__ignoreMap":64},[103,143,168,193,202,212,221,245,267,289,307,316,400,429,448,457,481],{"type":93,"tag":104,"props":105,"children":108},"span",{"class":106,"line":107},"line",1,[109,116,121,127,132,138],{"type":93,"tag":104,"props":110,"children":112},{"style":111},"--shiki-default:#D73A49;--shiki-light:#D73A49;--shiki-dark:#F97583",[113],{"type":114,"value":115},"text","import",{"type":93,"tag":104,"props":117,"children":118},{"style":111},[119],{"type":114,"value":120}," type",{"type":93,"tag":104,"props":122,"children":124},{"style":123},"--shiki-default:#24292E;--shiki-light:#24292E;--shiki-dark:#E1E4E8",[125],{"type":114,"value":126}," { OFDPrintJob } ",{"type":93,"tag":104,"props":128,"children":129},{"style":111},[130],{"type":114,"value":131},"from",{"type":93,"tag":104,"props":133,"children":135},{"style":134},"--shiki-default:#032F62;--shiki-light:#032F62;--shiki-dark:#9ECBFF",[136],{"type":114,"value":137}," \"@quirekit\u002Fofd-editor\u002Fprint\"",{"type":93,"tag":104,"props":139,"children":140},{"style":123},[141],{"type":114,"value":142},";\n",{"type":93,"tag":104,"props":144,"children":145},{"class":106,"line":65},[146,150,155,159,164],{"type":93,"tag":104,"props":147,"children":148},{"style":111},[149],{"type":114,"value":115},{"type":93,"tag":104,"props":151,"children":152},{"style":123},[153],{"type":114,"value":154}," { createOFDIPPPrintService } ",{"type":93,"tag":104,"props":156,"children":157},{"style":111},[158],{"type":114,"value":131},{"type":93,"tag":104,"props":160,"children":161},{"style":134},[162],{"type":114,"value":163}," \"@quirekit\u002Fofd-editor\u002Fprint\u002Fipp\"",{"type":93,"tag":104,"props":165,"children":166},{"style":123},[167],{"type":114,"value":142},{"type":93,"tag":104,"props":169,"children":170},{"class":106,"line":80},[171,175,180,184,189],{"type":93,"tag":104,"props":172,"children":173},{"style":111},[174],{"type":114,"value":115},{"type":93,"tag":104,"props":176,"children":177},{"style":123},[178],{"type":114,"value":179}," { encodeNodeOFDPrintJob } ",{"type":93,"tag":104,"props":181,"children":182},{"style":111},[183],{"type":114,"value":131},{"type":93,"tag":104,"props":185,"children":186},{"style":134},[187],{"type":114,"value":188}," \"@quirekit\u002Fofd-editor\u002Fprint\u002Fnode\"",{"type":93,"tag":104,"props":190,"children":191},{"style":123},[192],{"type":114,"value":142},{"type":93,"tag":104,"props":194,"children":196},{"class":106,"line":195},4,[197],{"type":93,"tag":104,"props":198,"children":199},{"emptyLinePlaceholder":79},[200],{"type":114,"value":201},"\n",{"type":93,"tag":104,"props":203,"children":205},{"class":106,"line":204},5,[206],{"type":93,"tag":104,"props":207,"children":209},{"style":208},"--shiki-default:#6A737D;--shiki-light:#6A737D;--shiki-dark:#6A737D",[210],{"type":114,"value":211},"\u002F**\n",{"type":93,"tag":104,"props":213,"children":215},{"class":106,"line":214},6,[216],{"type":93,"tag":104,"props":217,"children":218},{"style":208},[219],{"type":114,"value":220}," * Submits a validated batch to an operator-configured queue from Node.\n",{"type":93,"tag":104,"props":222,"children":224},{"class":106,"line":223},7,[225,230,235,240],{"type":93,"tag":104,"props":226,"children":227},{"style":208},[228],{"type":114,"value":229}," * ",{"type":93,"tag":104,"props":231,"children":232},{"style":111},[233],{"type":114,"value":234},"@param",{"type":93,"tag":104,"props":236,"children":237},{"style":123},[238],{"type":114,"value":239}," printerUri",{"type":93,"tag":104,"props":241,"children":242},{"style":208},[243],{"type":114,"value":244}," - Printer URI from trusted server configuration.\n",{"type":93,"tag":104,"props":246,"children":248},{"class":106,"line":247},8,[249,253,257,262],{"type":93,"tag":104,"props":250,"children":251},{"style":208},[252],{"type":114,"value":229},{"type":93,"tag":104,"props":254,"children":255},{"style":111},[256],{"type":114,"value":234},{"type":93,"tag":104,"props":258,"children":259},{"style":123},[260],{"type":114,"value":261}," job",{"type":93,"tag":104,"props":263,"children":264},{"style":208},[265],{"type":114,"value":266}," - Files, physical page selections, sides and copies approved by the user.\n",{"type":93,"tag":104,"props":268,"children":270},{"class":106,"line":269},9,[271,275,279,284],{"type":93,"tag":104,"props":272,"children":273},{"style":208},[274],{"type":114,"value":229},{"type":93,"tag":104,"props":276,"children":277},{"style":111},[278],{"type":114,"value":234},{"type":93,"tag":104,"props":280,"children":281},{"style":123},[282],{"type":114,"value":283}," signal",{"type":93,"tag":104,"props":285,"children":286},{"style":208},[287],{"type":114,"value":288}," - Request lifetime.\n",{"type":93,"tag":104,"props":290,"children":292},{"class":106,"line":291},10,[293,297,302],{"type":93,"tag":104,"props":294,"children":295},{"style":208},[296],{"type":114,"value":229},{"type":93,"tag":104,"props":298,"children":299},{"style":111},[300],{"type":114,"value":301},"@returns",{"type":93,"tag":104,"props":303,"children":304},{"style":208},[305],{"type":114,"value":306}," A receipt for querying queue status.\n",{"type":93,"tag":104,"props":308,"children":310},{"class":106,"line":309},11,[311],{"type":93,"tag":104,"props":312,"children":313},{"style":208},[314],{"type":114,"value":315}," *\u002F\n",{"type":93,"tag":104,"props":317,"children":319},{"class":106,"line":318},12,[320,325,330,336,341,347,352,358,363,368,372,377,381,386,390,395],{"type":93,"tag":104,"props":321,"children":322},{"style":111},[323],{"type":114,"value":324},"export",{"type":93,"tag":104,"props":326,"children":327},{"style":111},[328],{"type":114,"value":329}," function",{"type":93,"tag":104,"props":331,"children":333},{"style":332},"--shiki-default:#6F42C1;--shiki-light:#6F42C1;--shiki-dark:#B392F0",[334],{"type":114,"value":335}," submitToQueue",{"type":93,"tag":104,"props":337,"children":338},{"style":123},[339],{"type":114,"value":340},"(",{"type":93,"tag":104,"props":342,"children":344},{"style":343},"--shiki-default:#E36209;--shiki-light:#E36209;--shiki-dark:#FFAB70",[345],{"type":114,"value":346},"printerUri",{"type":93,"tag":104,"props":348,"children":349},{"style":111},[350],{"type":114,"value":351},":",{"type":93,"tag":104,"props":353,"children":355},{"style":354},"--shiki-default:#005CC5;--shiki-light:#005CC5;--shiki-dark:#79B8FF",[356],{"type":114,"value":357}," string",{"type":93,"tag":104,"props":359,"children":360},{"style":123},[361],{"type":114,"value":362},", ",{"type":93,"tag":104,"props":364,"children":365},{"style":343},[366],{"type":114,"value":367},"job",{"type":93,"tag":104,"props":369,"children":370},{"style":111},[371],{"type":114,"value":351},{"type":93,"tag":104,"props":373,"children":374},{"style":332},[375],{"type":114,"value":376}," OFDPrintJob",{"type":93,"tag":104,"props":378,"children":379},{"style":123},[380],{"type":114,"value":362},{"type":93,"tag":104,"props":382,"children":383},{"style":343},[384],{"type":114,"value":385},"signal",{"type":93,"tag":104,"props":387,"children":388},{"style":111},[389],{"type":114,"value":351},{"type":93,"tag":104,"props":391,"children":392},{"style":332},[393],{"type":114,"value":394}," AbortSignal",{"type":93,"tag":104,"props":396,"children":397},{"style":123},[398],{"type":114,"value":399},") {\n",{"type":93,"tag":104,"props":401,"children":403},{"class":106,"line":402},13,[404,409,414,419,424],{"type":93,"tag":104,"props":405,"children":406},{"style":111},[407],{"type":114,"value":408},"  const",{"type":93,"tag":104,"props":410,"children":411},{"style":354},[412],{"type":114,"value":413}," queue",{"type":93,"tag":104,"props":415,"children":416},{"style":111},[417],{"type":114,"value":418}," =",{"type":93,"tag":104,"props":420,"children":421},{"style":332},[422],{"type":114,"value":423}," createOFDIPPPrintService",{"type":93,"tag":104,"props":425,"children":426},{"style":123},[427],{"type":114,"value":428},"({\n",{"type":93,"tag":104,"props":430,"children":432},{"class":106,"line":431},14,[433,438,443],{"type":93,"tag":104,"props":434,"children":435},{"style":123},[436],{"type":114,"value":437},"    label: ",{"type":93,"tag":104,"props":439,"children":440},{"style":134},[441],{"type":114,"value":442},"\"Office\"",{"type":93,"tag":104,"props":444,"children":445},{"style":123},[446],{"type":114,"value":447},", printerUri, encode: encodeNodeOFDPrintJob,\n",{"type":93,"tag":104,"props":449,"children":451},{"class":106,"line":450},15,[452],{"type":93,"tag":104,"props":453,"children":454},{"style":123},[455],{"type":114,"value":456},"  });\n",{"type":93,"tag":104,"props":458,"children":460},{"class":106,"line":459},16,[461,466,471,476],{"type":93,"tag":104,"props":462,"children":463},{"style":111},[464],{"type":114,"value":465},"  return",{"type":93,"tag":104,"props":467,"children":468},{"style":123},[469],{"type":114,"value":470}," queue.",{"type":93,"tag":104,"props":472,"children":473},{"style":332},[474],{"type":114,"value":475},"submit",{"type":93,"tag":104,"props":477,"children":478},{"style":123},[479],{"type":114,"value":480},"(job, signal);\n",{"type":93,"tag":104,"props":482,"children":484},{"class":106,"line":483},17,[485],{"type":93,"tag":104,"props":486,"children":487},{"style":123},[488],{"type":114,"value":489},"}\n",{"type":93,"tag":491,"props":492,"children":493},"style",{},[494],{"type":114,"value":495},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",1795456058407]