PrintDialog.Manager is responsible for creating and managing PrintDialog objects for multiple applications.
CreatePrintDialog(out 'o' dialog)
Creates a new print dialog for the calling application.
A PrintDialog object represents one instance of a printing dialog. Applications can create PrintDialogs with Manager.CreatePrintDialog.
Typically, an application will first add some custom options with AddOption, and maybe even add some option presets with AddPreset. It might also set the name of the document, which will be included in the print job's name. Afterwards, the dialog can be shown to the user.
Depending on the size and complexity of the document, an application might want to send the whole document as a preview or only parts of it, maybe of lower quality. The PrintDialog interface supports both approaches: To send the whole document, it suffices to call RequestDocumentDataSocket and to transmit the document data on the returned socket. To transmit a lower quality version or only parts of the document, RequestPreviewDataSocket can be used. The dialog will emit ReadyForDocumentData if the user starts the print job. This way, the full document data does not need to be transferred if the user cancels the dialog.
Shows the dialog. This should be called after all configuration (e.g. adding of options or presets) has been done.
Set the name of the document that will be printed.
The job title will have the document name in it. Furthermore, it might appear in the window title of the printing dialog.
Set the number of pages of the final document.
This method needs to be called only if the provided preview does not contain all pages of the final document.
Set the size of the final document in bytes.
RequestDocumentDataSocket(out 's' socketname)
Returns the address of a local domain socket on which document data can be send to the dialog.
An application may send document data before the user initiates the actual print action. In this case, the data will be used by the dialog to show a preview of the document. If the document is too large, RequestPreviewDataSocket can be used to send a preview which may be of lower quality and does not include all pages of the final document.
In any case, the dialog emits ReadyForDocumentData when the document data is ultimately needed. At the latest, an application should send the document after receiving this signal.
The socket will be closed by the dialog after the whole document has been transmitted. To transmit a different version of the document, for example in response to a OptionChanged signal, a new socket must be requested.
RequestPreviewDataSocket(out 's' socktname, 'u' firstpage, 'b' canrequestmore)
Returns the address of a local domain socket on which preview data can be send to the dialog.
This method allows applications to send a lower quality of the document, which need not include all pages of the final document. The dialog sends NeedPreviewPage if the user wants to see pages in the preview which are not yet transmitted.
If the whole document shall be used as a preview, use RequestDocumentDataSocket instead. This avoids transmitting the whole document twice.
AddOption('(sssa(ss)vvvsasas)' option, out 'b' success)
Adds an application specific option.
An option structure consists of:
SetOptionIcon('s' option, 'ay' icon)
Sets an icon for an option.
SetChoiceIcon('s' option, 's' choice, 'ay' icon)
Sets an icon for predefined choice of an option.
GetOptionValue('s' name, out 'v' value)
Returns the current value of an option.
SetOptionValue('s' name, 'v' value, out 'b' success)
Set an option to a new value.
AddPreset('s' name, 's' options)
Add a preset to the dialog. Presets are a quick and easy way for users to set multiple options at the same time.
OptionChanged('s' name, 'v' value)
This signal is emitted whenever an option changed. This might be application specific options added with AddOption, or printer specific options, such as "PageSize"
This signal is emitted if a user cancels the dialog. The "PrintDialog" object will not be accessible anymore.
This signal is emitted after the user initiates the print process (i.e. clicks "Print"). If an application has not yet send its document data it should do so now, by requesting a socket connection with RequestDocumentDataSocket. The dialog object will be deleted after the document is transmitted.
This signal is emitted if the user browses through the document preview and the hits a page with has not yet been send by the application (see RequestPreviewDataSocket). In this case, the application should send a preview containing "page".