Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt is unable to detect printers on Windows

Tags:

c++

printing

qt

I'm using Qt for a project (Qt 5.0.2, precompiled and downloaded from qt-project.org) on Windows 7 (32-bit) and I'm having trouble trying to print a document.

qDebug() << QPrinterInfo::availablePrinters().size(); // 0

I'm able to print as PDF and I tested the same executable in other computers, it works just well. I do have printers installed and I can print normally from any other program such as notepad or Word. Any clue on why is it returning an empty list? I can't find this behavior documented anywhere, is this a Qt bug?

like image 769
Guilherme Bernal Avatar asked Oct 04 '22 01:10

Guilherme Bernal


1 Answers

When you deploy your Qt application, you should put

[your Qt application]\printsupport\windowsprintersupport.dll

The library windowsprintersupport.dll should be taken from

[Qt path]\[platform]\plugins\printsupport

P.S. The first answer is almost correct, except path's names.

like image 175
Eugene Malashkin Avatar answered Oct 13 '22 12:10

Eugene Malashkin