通过 CUPS 打印收据 - 保持方向

问题描述 投票:0回答:2

我正在构建一个简单的 POS 系统,并有一台收据打印机。我已经基本完成了系统,但是 CUPS 打印的所有内容都是纵向的。这意味着,如果收据短于宽度,CUPS 会将其横向发送到打印机,这看起来完全错误(并且会从收据左侧剪掉约 60 毫米)。

我的系统创建一个 PDF,然后将其发送到打印机。 PDF 生成正确,如何让 CUPS 停止旋转打印?

我已经看到了诸如确保文档完全符合预期输入之类的答案,但这对于可变长度收据不起作用。

我还尝试在打印时手动设置方向并作为默认选项,但 CUPS 似乎忽略任何旋转指令。

有问题的打印机是 Seiko Instruments RP-D10。

打印机.conf

# Written by cupsd
# DO NOT EDIT THIS FILE WHEN CUPSD IS RUNNING
NextPrinterId 2
<Printer RP-D10>
PrinterId 1
UUID urn:uuid:ec55ffd0-01c2-36cf-545c-84174ebae871
Info RP-D10
MakeModel SII RP-D10 (80mm)
DeviceURI usb://SII/RP-D10
State Idle
StateTime 1636338040
ConfigTime 1636338040
Type 53252
Accepting Yes
Shared Yes
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0
OpPolicy default
ErrorPolicy stop-printer
</Printer>

RP-D10.ppd

*FormatVersion:         "4.3"
*FileVersion:           "1.0"
*LanguageVersion:       English
*LanguageEncoding:      ISOLatin1
*PCFileName:            "sii_rpd10_80.ppd"
*Manufacturer:          "SII"
*Product:               "(RP-D10 (80mm))"
*1284DeviceID:          "MFG:SII;CMD:SII;MDL:RP-D10;CLS:PRINTER;"
*cupsVersion:           1.2
*cupsManualCopies:      True
*cupsModelNumber:       4
*cupsFilter:            "application/vnd.cups-raster 0 rastertosii"
*ModelName:             "RP-D10 (80mm)"
*ShortNickName:         "RP-D10 (80mm)"
*NickName:              "SII RP-D10 (80mm)"
*PSVersion:             "(3010.000) 550"
*LanguageLevel:         "3"
*ColorDevice:           False
*DefaultColorSpace:     Gray
*FileSystem:            False
*Throughput:            "1"
*LandscapeOrientation:  Plus90
*VariablePaperSize:     True
*TTRasterizer:          Type42


*% Print Quality
*OpenUI *PrintQuality/Print Quality: PickOne
*OrderDependency: 5 AnySetup *PrintQuality
*DefaultPrintQuality: Normal
*PrintQuality Normal/Normal mode: "<</cupsBitsPerColor 8/HWResolution [203 203]>>setpagedevice"
*PrintQuality Draft/Draft mode: "<</cupsBitsPerColor 8/HWResolution [101 101]>>setpagedevice"
*CloseUI: *PrintQuality


*OpenUI *PageSize/Media Size: PickOne
*OrderDependency: 10 AnySetup *PageSize
*DefaultPageSize: X72MMY200MM
*PageSize X72MMY200MM/72mm * 200mm: "
      <</PageSize[204 567]/ImagingBBox null>>
      setpagedevice"
*PageSize X72MMY1000MM/72mm * 1000mm:   "
      <</PageSize[204 2835]/ImagingBBox null>>
      setpagedevice"
*PageSize A4/A4 reduced to 72mm:    "
      <</HWResolution [69 69]/PageSize[595 842]/ImagingBBox null>>
      setpagedevice"
*PageSize Letter/Letter reduced to 72mm:    "
      <</HWResolution [67 67]/PageSize[612 792]/ImagingBBox null>>
      setpagedevice"
*PageSize SELECTPAPERXXMM/Custom Paper Size(72mm * 297mm):  "
      <</PageSize[204 842]/ImagingBBox null>>
      setpagedevice"
*CloseUI: *PageSize


*OpenUI *PageRegion: PickOne
*OrderDependency: 10 AnySetup *PageRegion
*DefaultPageRegion: X72MMY200MM
*PageRegion X72MMY200MM/72mm * 200mm:   "
      <</PageSize[204 567]/ImagingBBox null>>
      setpagedevice"
*PageRegion X72MMY1000MM/72mm * 1000mm: "
      <</PageSize[204 2835]/ImagingBBox null>>
      setpagedevice"
*PageRegion A4/A4 reduced to 72mm:  "
      <</HWResolution [69 69]/PageSize[595 842]/ImagingBBox null>>
      setpagedevice"
*PageRegion Letter/Letter reduced to 72mm:  "
      <</HWResolution [67 67]/PageSize[612 792]/ImagingBBox null>>
      setpagedevice"
*PageRegion SELECTPAPERXXMM/Custom Paper Size(72m * 297mm): "
      <</PageSize[204 842]/ImagingBBox null>>
      setpagedevice"
*CloseUI: *PageRegion



*DefaultImageableArea:  X72MMY200MM
*ImageableArea X72MMY200MM:         "0.0 0.0 204.0 567.0"
*ImageableArea X72MMY1000MM:        "0.0 0.0 204.0 2835.0"
*ImageableArea A4:                  "0.0 0.0 595.0 842.0"
*ImageableArea Letter:              "0.0 0.0 612.0 792.0"
*ImageableArea SELECTPAPERXXMM: "0.0 0.0 204.0 842.0"


*DefaultPaperDimension: X72MMY200MM
*PaperDimension X72MMY200MM:        "204 567"
*PaperDimension X72MMY1000MM:       "204 2835"
*PaperDimension A4:                 "595 842"
*PaperDimension Letter:             "612 792"
*PaperDimension SELECTPAPERXXMM:    "204 842"


*MaxMediaWidth:  "204"
*MaxMediaHeight: "23219"
*HWMargins:  0 0 0 0
*CustomPageSize True: "pop pop pop <</PageSize[5 -2 roll]/ImagingBBox null>>setpagedevice"
*ParamCustomPageSize Width:        1 points 72 204
*ParamCustomPageSize Height:       2 points 72 23219
*ParamCustomPageSize WidthOffset:  3 points 0 0
*ParamCustomPageSize HeightOffset: 4 points 0 0
*ParamCustomPageSize Orientation:  5 int 0 0

*% Cut Mode
*OpenUI *PageCutMode/Cut Mode: PickOne
*DefaultPageCutMode: FullCutPage
*PageCutMode FullCutPage/Full Cut: ""
*PageCutMode PartialCutPage/Partial Cut: ""
*PageCutMode NoCutPage/No Cut: ""
*CloseUI: *PageCutMode

*% Print Density: PickOne
*OpenUI *PrintDensity/Print Density: PickOne
*DefaultPrintDensity: 100Percent
*PrintDensity 70Percent/70%: ""
*PrintDensity 80Percent/80%: ""
*PrintDensity 90Percent/90%: ""
*PrintDensity 100Percent/100%: ""
*PrintDensity 110Percent/110%: ""
*PrintDensity 120Percent/120%: ""
*PrintDensity 130Percent/130%: ""
*CloseUI: *PrintDensity

*% Cut Timing
*OpenUI *CutTiming/Cut Timing: PickOne
*DefaultCutTiming: Page
*CutTiming Page/Each Page: ""
*CutTiming Document/Each Document: ""
*CloseUI: *CutTiming

*% Blank Image
*OpenUI *BlankImage/Blank Image: PickOne
*OrderDependency: 10 AnySetup *BlankImage
*DefaultBlankImage: feed
*BlankImage feed/Feed: ""
*BlankImage nonfeed/Non feed: ""
*CloseUI: *BlankImage

*% Dither
*OpenUI *Dither/Dither Type: PickOne
*OrderDependency: 10 AnySetup *Dither
*DefaultDither: ditherScreen
*Dither ditherNone/None: ""
*Dither ditherScreen/Screen: ""
*Dither ditherErrDiff/Error Diffusion: ""
*CloseUI: *Dither

*% End
pdf printing cups
2个回答
0
投票

我也遇到了完全相同的问题。看来cups通过它的pdftopdf过滤器发送你的工作。然后,该过滤器会在认为有必要时自动旋转页面。 我找到了两种方法来解决这个问题:

  1. 使用
    -o nopdfAutoRotate
    打印选项,或者,
  2. 用一个简单的 shell 脚本替换
    pdftopdf
    过滤器(在
    /usr/lib/cups/filter
    中),该脚本仅将 stdin 传递到 stdout:
#!/bin/sh
cat -

0
投票

我面临同样的问题并正在寻找解决方案 你能帮忙吗 我认为给定的解决方案反映了服务器中配置的所有打印机,这并不总是适用

© www.soinside.com 2019 - 2024. All rights reserved.