This device represents a series of pages of printed output, and is used in almost exactly the same way as other paint devices such as QWidget and QPixmap. A set of additional functions are provided to manage device-specific features, such as orientation and resolution, and to step through the pages in a document as it is generated. As an alternative, the printProgram function can be used to specify the command or utility to use instead of the system default. Note that setting parameters like paper size and resolution on an invalid printer is undefined.
|Published (Last):||27 March 2009|
|PDF File Size:||11.31 Mb|
|ePub File Size:||11.9 Mb|
|Price:||Free* [*Free Regsitration Required]|
Generated on Aug from project qtbase revision v5. As an alternative, the printProgram function can be used to specify the command or utility to use instead of the system default.
You can use QPrinter::isValid to verify this before changing any parameters. This usually makes sense because, for example, it's not possible to change the number of copies when you are halfway through printing. There are also some settings that the user sets through the printer dialog and that applications are expected to obey.
See QAbstractPrintDialog's documentation for more details. Once the first page has been painted, newPage can be called to request a new blank page to paint on, or QPainter::end can be called to finish printing. The second page and all following pages are prepared using a call to newPage before they are painted. You only need to calling newPage after QPainter::begin if you need to insert a blank page at the beginning of a printed document.
It may cancel the entire job or just part of it. It basically presets a certain resolution and working mode. This has the big advantage that the results obtained when painting on the printer will match more or less exactly the visible output on the screen. It is the easiest to use, as font metrics on the screen and on the printer are the same. This is the default value. ScreenResolution will produce a lower quality output than HighResolution and should only be used for drafts.
Due to the difference between ScreenResolution and HighResolution, use of this value may lead to non-portable printer code. If the printer is destroyed while a print job is in progress this may or may not affect the print job. This mode is the default when printing directly to a printer. If there are no valid printers configured then no change will be made. This value is initially set to the name of the default printer.
By default, this is an empty string indicating that the printer shouldn't print to file. If the file name has a suffix other than ". On X11 only, you can set it to something different to use a specific print program. On the other platforms, this returns an empty string. On other platforms, it has no effect. Note that the document name does not affect the file name if the printer is printing to a file. If no creator name is specified, the creator will be set to "Qt" followed by some version number.
For example, if the page size is not supported by the printer, or if the margins fall outside the printable area. This is driver-dependent, but is usually QPrinter::Portrait. The default value is driver-dependent.
The application is responsible for reading the page order and printing accordingly. The default value is 1. This has been done since some printer drivers are not capable of buffering up the copies and in those cases the application must make an explicit call to the print code for each copy. That means the application has to handle the number of copies by printing the same document the required number of times.
With collating turned on all pages are printed before the next copy of those pages is started. The default value is false. This value will be changed by what the user presses in the print dialog.
In this case, the origin of the QPrinter's coordinate system coincides with the top-left corner of the printable area. It may not be possible to print on the entire physical page because of the printer's margins, so the application must account for the margins itself.
For example, all the data has gone to the printer but the printer cannot or will not cancel the job when asked to. This may not always be accurate for example if the printer doesn't have the capability of reporting its state to the operating system. This is useful only if the print command has been explicitly set. Pages in a document are numbered according to the convention that the first page is page 1.
After the print setup dialog has been opened, this function returns the value selected by the user. Various properties of a print engine are given with property and set with setProperty. A property may or may not be supported by a given print engine. An integer specifying the number of copies. An empty file name indicates that the printer should not print to a file. For further. QPrinter :: PaperSize paperSize ,.
QPrinter :: Unit unit ,. QSizeF sizef ;. QString printerName ;. QVariant prop ;. QPageLayout pageLayout const override. When QPainter::begin is called, the QPrinter it operates on is prepared for. You only need to calling newPage after QPainter::begin if you. Similarly, calling newPage after the last page in a document is painted will. It is. Due to historic reasons QPageSize::Executive is not the same as the standard.
Returns the PDF version for this printer. QString QPrinter :: printerName const. If the file name has the ". If the file name. QFileInfo fi fileName ;. The default is to return an empty string; meaning that QPrinter will try to.
On X11 only, you can set it to something. QString QPrinter :: printProgram const. QString QPrinter :: docName const. QString QPrinter :: creator const. For example, if the page size is not supported.
Note that you cannot use the setters on the returned object, you must either. QPrinter :: Orientation QPrinter :: orientation const. QString QPrinter :: paperName const. Returns the number of copies that will be printed. That means the. When collating is turned off the printing of each individual page will be repeated.
With collating turned on. It may not. Returns the printer's paper source. This enum is used to indicate whether printing will occur on one or both sides. The paper is turned over its longest edge before the second. The paper is turned over its shortest edge before the second. DuplexAuto : DuplexNone ;. QRect QPrinter :: pageRect const. QRect QPrinter :: paperRect const. The unit of the returned margins are specified. QMarginsF margins ;.
Aborts the current print run. The common case when creating your own print engine is to derive from both. An integer specifying the number of. Instructs the print engine to start a new page.
Subscribe to RSS
The PySide. QPrinter class is a paint device that paints on a printer. This device represents a series of pages of printed output, and is used in almost exactly the same way as other paint devices such as PySide. QWidget and PySide. A set of additional functions are provided to manage device-specific features, such as orientation and resolution, and to step through the pages in a document as it is generated.
On Windows it uses the built-in printer drivers. On X11 it generates postscript and sends that to lpr, lp, or another print command. The big difference is that you must keep track of the pages. QPrinter supports a number of settable parameters, most of which can be changed by the end user when the application calls QPrinter::setup. The most important parameters are: setOrientation tells QPrinter which page orientation to use virtual.
Generated on Aug from project qtbase revision v5. As an alternative, the printProgram function can be used to specify the command or utility to use instead of the system default. You can use QPrinter::isValid to verify this before changing any parameters. This usually makes sense because, for example, it's not possible to change the number of copies when you are halfway through printing.