How can I abort a print job?

  • I am printing using QPrinter, in a thread. The main UI thread has a progress dialog with a cancel button.
    If the user cancels before the printing is complete, I want to abort the job. Is there hope? Thank you.

  • I am calling this, but it's not helping. My pseudo-code is like this:

    get a QPrinter
    make a QPainter, begin
    for each page
    if user canceled
    call QPrinter abort
    render page to printer

    It does stop rendering new pages (break), but the
    abor seems to have no effect.

  • Well, the docs say:
    It is not always possible to abort a print job. For example, all the data has gone to the printer but the printer cannot or will not cancel the job when asked to.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.