[SOLVED] Why QPrinter need QtGUI
-
You can't print without GUI using any of known printing library... GhostScript also needs X libraries... You can use framebuffers to do it in console mode, but you will need GUI libs in any way....
P.S.: Only Dot Printers do not need GUI to print ;)
-
[quote author="AcerExtensa" date="1370616218"]You can't print without GUI using any of known printing library... GhostScript also needs X libraries... You can use framebuffers to do it in console mode, but you will need GUI libs in any way....
P.S.: Only Dot Printers do not need GUI to print ;)[/quote]
U can print in Linux in every kind of printer without gui! U just need to have proper driver on kernel if not paralel or serial printer, is nothing to do about if is a dot printer or laser ... it's the port and driver issues.
-
@
[quote author="bjanuario" date="1370619483"]
U can print in Linux in every kind of printer without gui! U just need to have proper driver on kernel if not paralel or serial printer, is nothing to do about if is a dot printer or laser ... it's the port and driver issues.[/quote]
@No, you can't :) all console printers uses framebuffers.... sure you can send to printer some kind of scratch and let print it, but we a talking not just physical printing... you can't generate print-page without X!
-
If u use graphics, for sure this will be kind tricky, but some printers support decode chars that then print graphics even without X, for text is straight on. I can assure u because we use this on linux ;) On windows i dunno if is possible ...
[quote author="AcerExtensa" date="1370639879"]@
[quote author="bjanuario" date="1370619483"]
U can print in Linux in every kind of printer without gui! U just need to have proper driver on kernel if not paralel or serial printer, is nothing to do about if is a dot printer or laser ... it's the port and driver issues.[/quote]
@No, you can't :) all console printers uses framebuffers.... sure you can send to printer some kind of scratch and let print it, but we a talking not just physical printing... you can't generate print-page without X! [/quote]
-
Tell us what do you use and how do you do it! Maybe you have something what peoples with PostScript printers all other the world are looking for...
-
So, if I undestand what you said... Before Qt4.4, it was possible to use QPrinter to generate a PDF file but now, with Qt I can't print a PDF file with QPrinter if my Linux doesn't have a GUI ? ...
Do you know another way to print a QImage in a PDF file, without using GUI ?
-
QImage and QPrinter inherits QPaintDevice, and QPaintDevice is an GUI Class. So you need QtGUI library if you would like to use this two classes.
-
I have QtGUI library installed on the OS which is OpenSuse 11. But it's a server OS and it doesn't have server X connexion ...
So, I'm happy :/ My app can't work on the server.
Thanks for your answer.
-
you can still use virtual framebuffer like Xvfb
-
Thanks AcerExtensa ! XVFB was a good idea and now, the app works well ! :D
This thread can be closed -
Please add prefix "[SOLVED]" to the left of the topic subject. Thanks!
-
Hi Pitchou.
How did you use XVFB to create the QPrinter?I need to make a PDF printer in a console application and I get the same error you got.
-
Hi Fernando, I changed my way. I do not use XVFB anymore because I found a solution to use QPriner without serverX.
My error was to use QApplication, which require a serverX. I found a trick !
When you use QApplication, I think you use it like this :
@QApplication a(argc, argv,);@Change it to have something like this : @QApplication a(argc, argv, false);@
The false attribute will force the program to work without a serverX and you can use QPrinter without any problem
-
Thank you Pitchou!
It is working now! :D