先附上程序 qt打印的程序
void PrintImage::slotPrint ()
{
QPrinter printer;
QString str;
printer.setColorMode(QPrinter::GrayScale);
printer.setPrintProgram("lpr");
//这里我不知道对不对 str = printer.printProgram();
qDebug()<<"printer name is:"+str;
printer.setOutputFileName("/usr/local/qtwork/printimage/food.ps");
QPrintDialog printDialog(&printer, this);
if (printDialog.exec())
{
QPainter painter(&printer);
QRect rect = painter.viewport();
QSize size = image.size();
painter.setViewport(rect.x(), rect.y(),size.width(), size.height());
painter.setWindow(image.rect());
painter.drawImage(0, 0, image);
qDebug()<<"print done!";
}
}
我的内核我开启了USB Printer support
启动
开发板后,插入打印机的USB,
显示如下
usb 1-1: new full speed USB device using at91_ohci and address 4
usb 1-1: configuration #1 chosen from 1 choice
usblp0: USB Bidirectional printer dev 4 if 1 alt 0 proto 2 vid 0x03F0 pid 0x541
运行我的qt程序,能生成food.ps这个照片,原先的照片food.png是个彩色的,现在生成的food.ps是灰色的了
但是打印机一点反应都
没有。。。
我尝试这样来打印,不知道对不对,lpr food.ps 也是一点反应也没有。。。
请问还需要做些什么呀?????
[ 此帖被bikong7在2011-04-13 16:18重新编辑 ]