Package: gtk
Function gtk-print-operation-run
Lambda Listgtk-print-operation-run (operation action parent) ArgumentsReturn Value The result of the print operation. A return value of :apply
indicates that the printing was completed successfully. In this case, it
is a good idea to obtain the used print settings with the function gtk-print-operation-print-settings and store them for reuse with the next print operation. A value of :in-progress means the operation
is running asynchronously, and will emit the "done" signal when done. Details
Runs the print operation, by first letting the user modify print settings
in the print dialog, and then print the document. Normally that this function does not return until the rendering of all pages is complete. You can connect to the "status-changed" signal on the print operation to obtain some information about the progress of the print operation. Furthermore, it may use a recursive main loop to show the print dialog. If you call the function gtk-print-operation-allow-async the operation will run asynchronously if this is supported on the platform. The "done" signal will be emitted with the result of the operation when the it is done, i.e. when the dialog is canceled, or when the print succeeds or fails. Note that the function gtk-print-operation-run can only be called once on a given gtk-print-operation. Example(defun do-print-operation (window) (let ((response nil) (print (gtk-print-operation-new))) ;; Connect signal handlers for the print operation (g-signal-connect print "draw-page" #'draw-page) (g-signal-connect print "begin-print" #'begin-print) ;; Restore the print settings (when *print-settings* (setf (gtk-print-operation-print-settings print) *print-settings*)) ;; Restore the page setup (when *page-setup* (setf (gtk-print-operation-page-setup print) *page-setup*)) ;; Perform the print operation (setf response (gtk-print-operation-run print :print-dialog window)) ;; Check the response and save the print settings (when (eq :apply response) (setf *print-settings* (gtk-print-operation-print-settings print))))) | See also |
2020-4-9