[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnumed-devel] printing on Windows
From: |
Sebastian Hilbert |
Subject: |
[Gnumed-devel] printing on Windows |
Date: |
Fri, 29 Apr 2011 11:11:48 +0200 |
User-agent: |
KMail/1.13.6 (Linux/2.6.38.2-19-default; KDE/4.6.0; i686; ; ) |
More bits on printing on Windows.
Most documents in GNUmed seem to be avaiable as pdf before they are being
printed.
I believe we cannot rely on Adobe Reader being installed so we need to find
another way.
Here is a bit of code we might want to look at.
#!/usr/bin/env python
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
Appli=QApplication(sys.argv)
printer=QPrinter()
doc=QTextDocument("Hello" )
dialog = QPrintDialog(printer)
dialog.setModal(True)
dialog.setWindowTitle("Print Document" )
# dialog.addEnabledOption(QAbstractPrintDialog.PrintSelection)
if dialog.exec_() == True:
doc.print_(printer)
What does it currently do ? It opens the printing dialog (tested on Linux) and
prints out the text "Hello" on paper. I still have to test it on Windows.
Comments:
1.) It is done in PyQT. That is because I am not aware wxpython is capable of
handling it the same way (yet). Let me know if that is not true.
http://wiki.wxpython.org/Printing
2.) The PyQT program could be converted to a standalone binary executable
which means there needs to be no QT installation on the Windows PC
3.) I might need to be extended to accept command line arguments for e.g.
printing to the default printer , printing to a pre-defined printer
4.) It could be used to return sane error codes so GNUmed will have useful
feedback.
5.) It will be called from gm-print_doc.bat so there is no need to change the
workflow.
6.) it needs code to support other input then text. This essentially means I
need to look at how to pipe the pdf to it instead of text.
Sebastian