如何控制打印机传纸
纸是用来打票据的,票据纸全连在一起(用手撕虚线撕开的那种),每张纸大小固定为7.5cmx15cm,但打印机每次打印完出纸都传出A4纸高(29.5cm)的纸,现在要只打印后出纸到指定的7.5cm处就停止出纸.
(一定要用TPrinter)
TPrinter *Print = Printer();
int iLength = 170;
int iWidth = 1500;
char *ADevice, *ADriver, *APort;
THandle DeviceMode;
PDeviceMode DevMode;
ADevice = new char[100];
ADriver = new char[100];
APort = new char[100];
Printer()->GetPrinter(ADevice, ADriver, APort, DeviceMode);
DevMode =(_devicemodeA*)GlobalLock((void*)DeviceMode);
DevMode->dmFields = DevMode->dmFields|DM_PAPERSIZE;
DevMode->dmFields = DevMode->dmFields|DM_PAPERLENGTH;
DevMode->dmFields = DevMode->dmFields|DM_PAPERWIDTH;
DevMode->dmPaperSize = DMPAPER_USER;
DevMode->dmPaperLength = iLength;
DevMode->dmPaperWidth = iWidth;
Print->BeginDoc();
/*
...
*/
Print->EndDoc();