Caution: This version of this document is no longer maintained. For the latest documentation, see


Extract data from a print context


void * PpGetPC( PpPrintContext_t *pc,
                     int member,
                     const void ** const data);


The pointer to a PpPrintContext_t structure that was returned by PpCreatePC().
the address of a pointer to the data type of the member being queried. This pointer will be set to point to the member within the print context structure. Don't use it to modify the print context; use only PpSetPC().
The member of the print context to query, as given in the table below. For a description of the members, see PpPrintContext_t.




Use this function to query the attributes of a print context.

Note: Don't extract values directly from the data structure. Your application might not work if the structure changes in the future.

Use the following data types when getting the value of the members of the print context:

Member Data
Pp_PC_COLLATING_MODE Address of a char * ( value )
Pp_PC_COLOR_MODE Address of a char * ( value )
Pp_PC_CONTROL Address of a PpPCControl_t *
Pp_PC_COPIES Address of a char * ( value )
Pp_PC_DATE Address of a char * (string)
Pp_PC_DEVICE Address of a char * (string)
Pp_PC_DITHERING Address of a char * ( value )
Pp_PC_DO_PREVIEW Address of a char * ( value )
Pp_PC_DRIVER Address of a char * (string)
Pp_PC_DUPLEX Address of a char * ( value )
Pp_PC_FILENAME Address of a char * (string)
Pp_PC_INKTYPE Address of a char * ( value )
Pp_PC_INTENSITY Address of a unsigned long *
Pp_PC_JOB_NAME Address of a char * (string)
Pp_PC_MARGINS Address of a PhRect_t *
Pp_PC_MAX_DEST_SIZE Address of a unsigned long
Pp_PC_NAME Address of a char * (string)
Pp_PC_NONPRINT_MARGINS Address of a PhRect_t *
Pp_PC_ORIENTATION Address of a char * ( value )
Pp_PC_PAGE_NUM Address of a unsigned long
Pp_PC_PAGE_RANGE Address of a PpPageRange_t *
Pp_PC_PAPER_SIZE Address of a PhDim_t *
Pp_PC_PAPER_SOURCE Address of a char * ( value )
Pp_PC_PAPER_TYPE Address of a char * ( value )
Pp_PC_PREVIEW_APP Address of a char * (string)
Pp_PC_PRINTER_RESOLUTION Address of a PhDim_t *
Pp_PC_PROP_APP Address of a char * (string)
Pp_PC_REVERSED Address of a char ( value )
Pp_PC_SCALE Address of a PhPoint_t *
Pp_PC_SOURCE_COLORS Address of a unsigned long *
Pp_PC_SOURCE_OFFSET Address of a PhPoint_t *
Pp_PC_SOURCE_RESOLUTION Address of a PhDim_t *
Pp_PC_SOURCE_SIZE Address of a PhDim_t *
Pp_PC_USER_ID Address of a char * (string)


A pointer to the requested data, or NULL if an unrecognized member was specified.


int get_it( PtWidget_t *widget, ApInfo_t *apinfo,
            PtCallbackInfo_t *cbinfo )


    PhDim_t *dim;
    void    *pc_data;
    PpPrintContext_t *pc;

    /* Eliminate 'unreferenced' warnings */
    widget = widget, apinfo = apinfo, cbinfo = cbinfo;

    pc = PpCreatePC();

    // Pop up the standard print dialog to fill in the PC
    PtPrintSelection( NULL, NULL,
                      "Select Printer", pc, 0 );

    // Get some stuff from the pc

    // A string:
    PpGetPC( pc, Pp_PC_NAME, &pc_data );
    printf( "printer: %s\n", (char *)pc_data );

    // A structure ( PhDim_t ):
    PpGetPC( pc, Pp_PC_PAPER_SIZE, &pc_data );
    printf( "paper height: %d, width: %d\n",
        ((PhDim_t *)pc_data)->h, ((PhDim_t *)pc_data)->w );

    // A long value:
    PpGetPC( pc, Pp_PC_INTENSITY, &pc_data );
    printf( "intensity: %ld\n", *(long *)pc_data );

    // A number stored in a char:
    PpGetPC( pc, Pp_PC_COPIES, &pc_data );
    printf( "copies : %d\n", *(char *)pc_data );

    // Of course, the correct type can be used to
    // get the member:
    PpGetPC( pc, Pp_PC_PAPER_SIZE, &dim );
    printf( "paper height: %d, width: %d\n", dim->h, dim->w );

    PpReleasePC( pc );

    return Pt_CONTINUE;



Interrupt handler No
Signal handler No
Thread No

See also:

PhDim_t, PhPoint_t, PhRect_t, PpContinueJob(), PpCreatePC(), PpEndJob(), PpGetCanvas(), PpLoadDefaultPrinter(), PpLoadPrinter(), PpPrintContext_t, PpPrintNewPage(), PpReleasePC(), PpPrintWidget(), PpSetCanvas(), PpSetPC(), PpSuspendJob()

Printing in the Photon Programmer's Guide