怎么设置一台打印机打印不同尺寸的纸张
想通过程序设置在一台打印机上打印不同尺寸的纸张,現在的做法是在QuickReport中设定好报表的尺寸后还要在本机的“打印机和传真->打印首选项->布局->高级”中将纸张规格改成报表设计时相应的尺寸,这样做比较麻烦,不知该怎么直接在程序中设定打印机的纸张规格,请大家帮助给个方法~
[解决办法]
首先你要知道你用哪个打印机,一般的是首选打印机,然后参考下面文章
http://wenku.baidu.com/view/e608321d59eef8c75fbfb369.html
[解决办法]
varPrtInfo2: PPrinterInfo2;//具体的内容 查查MSDNDeviceMode: PDeviceMode;//具体的内容 查查MSDNstrPrintName:string;//打印机名称............. Printer.SetPrinter(pchar(Printer.Printers[Printer.PrinterIndex]), PrtInfo2.pDriverName, PrtInfo2.pPortName, 0);//不修改系统默认打印机,仅修改当前程序所使用的打印机....... DeviceMode^.dmPaperSize := 256; //要设为其它可查API中的DevMode,自定义纸张 DeviceMode^.dmPaperLength := Trunc(StrToFloat(XMLPrintM.DocumentElement.AttributeNodes[3].text) * 100); DeviceMode^.dmPaperWidth := Trunc(StrToFloat(XMLPrintM.DocumentElement.AttributeNodes[2].text) * 100); DeviceMode^.dmFields := DeviceMode^.dmFields or DM_ORIENTATION; DeviceMode^.dmFields := DeviceMode^.dmFields or DM_PAPERSIZE; DeviceMode^.dmFields := DeviceMode^.dmFields or DM_PAPERLENGTH; DeviceMode^.dmFields := DeviceMode^.dmFields or DM_PAPERWIDTH; StrPCopy(DeviceMode^.dmDeviceName, strPrintName); ResetDC(Printer.Handle, DeviceMode^);