[PyQt] Page setup for printer defaults
Robert Norman
tfcrobert at gmail.com
Thu Jun 18 17:14:52 BST 2009
Hello PyQt group,
My application uses a Brother label printer to spit out labels. I'd like
to do a "Page Setup", say in my preferences dialog and then save the
printer information in a settings so that we don't have to go through a
print dialog.
Currently I go through the print dialog once then use the resulting
QPrinter for subsequent print operations and that works fine. I can
assign the printer name to QPrinter so that it at least defaults to the
correct printer, but I'm having trouble figuring out how to set the
appropriate variables to match the printer to the specific label size.
Specifically, in the print dialog, I use the properties dialog to select
the label size. On return I can examine things like pageSize, pageRect,
paperSize, paperRect but I can't seem to set pageSize and can't find
methods for setting the page or paper Rect.
For example, after the print dialog, pageSize returns 30 but
setPageSize(30) causes an invalid type error since it expects a
QPrinter.PageSize enum value.
1) How would you go about doing a PageSetup dialog, not Print Dialog, to
both select a printer and it's default properties.
2) What needs to be saved and how can I restore the relevant properties.
I'm used to working through these issues myself, an often find that once
the question is asked, the answer seems to come on it's own, but this
time I'm stuck.
Thanks
More information about the PyQt
mailing list