PpContinueJob()

Continue a suspended print job

Synopsis:

PhDrawContext_t *PpContinueJob( 
                     PpPrintContext_t *pc );

Arguments:

pc
The pointer to a PpPrintContext_t structure that was returned by PpCreatePC().

Library:

ph

Description:

This function makes the provided print context pc active (i.e. from this point until the print context is deactivated, everything drawn is part of the printed output). The print context is initialized if this hasn't already been done by a call to PpStartJob().

All subsequent Photon draw commands are routed through this print context until:

Returns:

A pointer to the previously active draw context, or NULL if the print context couldn't be made active—see errno for the specific error.

Errors:

ESRCH
No output target is specified in the print context and no printer definition could be found

Examples:

To print the contents of a scroll area:

int print_it( PtWidget_t *widget, void *data, 
              PtCallbackInfo_t *cbinfo )
{
PhDim_t dim;

...

pc = PpCreatePC();

// Set the default printer for this app only.
// This overrides the default printer set via 
// the "prsetup" utility
PpSetPC( pc, Pp_PC_NAME, "R&D", 0 );

// Pop up the standard print dialog and respond accordingly.
switch( PtPrintSelection( ABW_base, &pos, "Select Printer", 
                          pc, 0 ) )
    {

    // The user has selected print or preview -- PpEndJob() 
    // handles the difference. 

    case Pt_PRINTSEL_PRINT:
    case Pt_PRINTSEL_PREVIEW:
        PtFlush(); // Ensure no draws are pending.

        // Set the source size to be the size of the scroll
        // area's canvas. The contents of the canvas will
        // be scaled to fit the page.
        PtWidgetDim( PtValidParent( ABW_my_scrollarea ), 
                     &dim );
        PpSetPC( pc, Pp_PC_SOURCE_SIZE, &dim, 0 );
        PpStartJob( pc );
        if( PpContinueJob( pc ) )
        {
            // Force the canvas of the ScrollArea widget
            // to draw.
            PtDamageWidget( 
                PtValidParent( ABW_my_scrollarea ) );
            PtFlush();
        }

        // Deactivate the pc and produce the printed output.
        PpEndJob( pc );

    case Pt_PRINTSEL_CANCEL:
        break;
}

// Release the pc and its resources.
PpReleasePC( pc );

return Pt_CONTINUE;
}

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PpCreatePC(), PpEndJob(), PpGetPC(), PpPrintContext_t, PpPrintNewPage(), PpReleasePC(), PpPrintWidget(), PpSetPC(), PpStartJob(), PpSuspendJob()

Printing in the Photon Programmer's Guide