c++builder中如何控制打印机
大家好:
在cb中我用QReport进行报表打印,因为数据量不多,我想在打印完后,继续进行打印,这样可以节约纸张。如何控制呀?
比如调用QReport.print后,打印机进行工作,可是只打了2条数据,打印机就吐纸了,这样纸张的大部分都浪费了,想在上次打印完毕后不图纸,接着往下打印,如何控制呀?
[解决办法]
#include <Printers.hpp>
CB中封装了打印机, 不过不可视, 麻烦些
TPrinter *printer = Printer();
printer->Orientation = poPortrait;
printer->Title = "TEST";
int dipx = GetDeviceCaps(printer->Handle, LOGPIXELSX);
int dipy = GetDeviceCaps(printer->Handle, LOGPIXELSY);
float scalex = dipx / 25.4, scaley = dipy / 25.4;// 1 英寸=25.4 mm
printer->BeginDoc();
printer->Canvas->Font->Size = 8;
printer->Canvas->Font->Color = clBlack;
printer->Canvas->TextOutA(5 * x + x0, 5 * y + y0, L"测试打印");
//printer->NewPage(); 新页
printer->EndDoc(); //开始打印