December 10, 2010

thiagoalencar22 thiagoalenca..
Lab Rat
1 posts

QPageSetupDialog behaviour on a label printer

 

Hello,

I’ve been having a little problem with the Qt printing system. Though it “seems” driver-related, maybe one could give me some light here (?).

This is the Hardware & Software: QL Brother 570 Label Printer, Windows 7, Qt 4.7

Whenever I send a document to this printer, no matter if “setPaperSize” is used, the printer always use the sizes defined on Windows Printing Preferences. Btw, trying to retrieve the paper sizes from this printer, gives a negative number (I suppose the driver does not support this feature since with some other printers it works perfectly).

BUT, if I use the QPageSetupDialog, somehow it actually changes the paperSize printed ! ! !
I need the paper size to be correct, so that the printer will cut the paper in the correct feed position.

So my question is, how does that happen from the QPageSetupDialog (since setPaperSize doesnt work)? If one knows how, then I would be able to set it to my own custom size, and all problems are solved :D

I know the manufacturer has an SDK and setting custom page size is possible there, but I wanted this to work from Qt so that the code is actually portable..

I really appreciate your attention,

Best Regards,
Thiago F Alencar

2 replies

December 10, 2010

Raul Raul
Lab Rat
120 posts

I think you should use the manufacturer’s SDK, because if it uses some special settings and access to the printer, it’s just better to use the original SDK.

If you worry about code portability, you really shouldn’t, because if the portability you are talking about is to abstract from OS, well, you could run your app on linux or Mac OS X, but if there aren’t any drivers for the specific OS, then still you won’t be able to write to the printer even if your printer code is portable; but if there are drivers for that printer for other OS, then still the SDK code is usually pretty much the same on all platforms.

Also, by the way, when specialized printers like the one you mention come with an SDK, it’s because it’s meant to be accessed from there, it’s not build for generic printer access, and that happens for most of specialized printers, like some thermal printers, card printers, stamp printers and such, so I wouldn’t recommend generic printing on those, if you want to support multiple specialized printers, you’ll have to design your code for that, maybe even extend the Qt printing class if you want.

 Signature 

Raul Guerrero
http://jimi.mx

December 10, 2010

thiagoalencar22 thiagoalenca..
Lab Rat
1 posts

Thanks for your answer Raul. I had actually already downloaded the SDKs, but I didn’t give up doing it from Qt yet, it seems so simple, and QPageSetupDialog does it!

The mistery still remains: How QPageSetupDialog manages to change the paper size?

 
  ‹‹ Showing widgets on Tab and/or button      QSharedPointer Usage ››

You must log in to post a reply. Not a member yet? Register here!