2010-02-01 57 views
2

我无法设置PosPritnter类的属性。例如PageModeStation,PageModeVerticalPosition,PageModePrintArea等POS for .NET:无法设置PosPrinter的属性属性

PosPrinter posPrinter = (PosPrinter)posExplorer.CreateInstance(posPrinterInfo); 
posPrinter.Open(); 
posPrinter.Claim(1000); 
posPrinter.DeviceEnabled = true; 
posPrinter.PageModeVerticalPosition = 10; //<--- Exception thrown: Failed to set property PageModeVerticalPosition 

异常详细信息:

Microsoft.PointOfService.PosControlException was unhandled 
    Message="Failed to set property PageModeVerticalPosition." 
    Source="Microsoft.PointOfService" 
    ErrorCodeExtended=0 
    StackTrace: 
      at Microsoft.PointOfService.Legacy.LegacyProxy.SetProperty(String propertyName, Object propertyValue) 
      at Microsoft.PointOfService.Legacy.LegacyPosPrinter.set_PageModeVerticalPosition(Int32 value) 
     .... 

有什么建议?

回答

0

假设打印机支持的话,你可能需要: 1 - 启用页面模式

posPrinter.PageModePrint(PageModePrintControl.PageMode); 

2 - 定义打印区域。

posPrinter.PageModePrintArea = new Rectangle(0, 0, posPrinter.PageModeArea.X, posPrinter.PageModeArea.Y); 

尝试设置该属性之前。

+0

你可以请检查我的问题在这里http://stackoverflow.com/questions/12408057/pos-for-net-print-formatting-cant-use-escape-character-char27#comment16677149_12408057我似乎无法得到Microsoft POSPrinter Simulator具有任何形式的格式(粗体,文本对齐等)。不适用于我的实际POS打印机。 – 2012-09-13 15:14:50