我写了个linux下的打印机驱动程序。在gedit 中可以正常打印,但在openoffice word processor 中就不能正常打印。最后找到了问题所在, 是ppd 文件中的resolution小节的问题。
写成下面这样,在gedit 和oenoffice中都可以
*OpenUI *Resolution: PickOne
*OrderDependency: 10.0 AnySetup *Resolution
*DefaultResolution: 160x72dpi
*Resolution 160x144dpi/160x144 DPI: "<</HWResolution[160 144]/cupsBitsPerColor 1/cupsRowCount 8/cupsRowFeed 0/cupsRowStep 0/cupsColorSpace 3>>setpagedevice"
*Resolution 160x72dpi/160x72 DPI: "<</HWResolution[160 72]/cupsBitsPerColor 1/cupsRowCount 8/cupsRowFeed 0/cupsRowStep 0/cupsColorSpace 3>>setpagedevice"
*Resolution 80x72dpi/80x72 DPI: "<</HWResolution[80 72]/cupsBitsPerColor 1/cupsRowCount 8/cupsRowFeed 0/cupsRowStep 0/cupsColorSpace 3>>setpagedevice"
*CloseUI: *Resolution
写成下面这样,在gedit中可以正常打印,在oenoffice中就不行。
*OpenUI *Resolution: PickOne
*OrderDependency: 10.0 AnySetup *Resolution
*DefaultResolution: 1dpi
*Resolution 0dpi/160x144 DPI: "<</HWResolution[160 144]/cupsBitsPerColor 1/cupsRowCount 8/cupsRowFeed 0/cupsRowStep 0/cupsColorSpace 3>>setpagedevice"
*Resolution 1dpi/160x72 DPI: "<</HWResolution[160 72]/cupsBitsPerColor 1/cupsRowCount 8/cupsRowFeed 0/cupsRowStep 0/cupsColorSpace 3>>setpagedevice"
*Resolution 2dpi/80x72 DPI: "<</HWResolution[80 72]/cupsBitsPerColor 1/cupsRowCount 8/cupsRowFeed 0/cupsRowStep 0/cupsColorSpace 3>>setpagedevice"
*CloseUI: *Resolution
我猜想原因应该是openoffice是根据名字来解析resolution的,而gedit应该是根据选项/HWResolution[xxx yyy]来解析的。