[Previous] [Contents] [Index] [Next]


Extract data from a print context


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


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.

The arguments are as follows:

The print context, created by PpPrintCreatePC().
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 PpPrintSetPC().
The member of the print context to query, as given in the table below. (For a description of the members, see the chapter on Printing in the Programmer's Guide.)
Member Data
Pp_PC_NAME address of a char * (string)
Pp_PC_LOCATION address of a char * (string)
Pp_PC_DEVICE address of a char * (string)
Pp_PC_DRIVER address of a char * (string)
Pp_PC_NONPRINT_MARGINS address of a PhRect_t *
Pp_PC_PROP_APP address of a char * (string)
Pp_PC_PREVIEW_APP address of a char * (string)
Pp_PC_FILENAME address of a char * (string)
Pp_PC_COMMENT address of a char * (string)
Pp_PC_DATE address of a char * (string)
Pp_PC_USER_ID address of a char * (string)
Pp_PC_PAGE_RANGE address of a char * (string)
Pp_PC_SOURCE_OFFSET address of a PhPoint_t *
Pp_PC_SOURCE_SIZE address of a PhDim_t *
Pp_PC_SOURCE_RESOLUTION address of a PhDim_t *
Pp_PC_SOURCE_COLORS address of a ulong_t *
Pp_PC_SCALE address of a PhPoint_t *
Pp_PC_MARGINS address of a PhRect_t *
Pp_PC_INTENSITY address of a ulong_t *
Pp_PC_PRINTER_RESOLUTION address of a PhDim_t *
Pp_PC_PAPER_SIZE address of a PhDim_t *
Pp_PC_COLLATING_MODE address of a char * ( value )
Pp_PC_DITHERING address of a char * ( value )
Pp_PC_COPIES address of a char * ( value )
Pp_PC_ORIENTATION address of a char * ( value )
Pp_PC_DUPLEX address of a char * ( value )
Pp_PC_PAPER_TYPE address of a char * ( value )
Pp_PC_PAPER_SOURCE address of a char * ( value )
Pp_PC_INKTYPE address of a char * ( value )
Pp_PC_COLOR_MODE address of a char * ( value )
Pp_PC_DO_PREVIEW address of a char * ( value )
Pp_PC_JOB_NAME address of a char * (string)
Pp_PC_CONTROL address of a PpPCControl_t *


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 = PpPrintCreatePC();

    // 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:
    PpPrintGetPC( pc, Pp_PC_NAME, &pc_data );
    printf( "printer: %s\n", (char *)pc_data );

    // A structure ( PhDim_t ):
    PpPrintGetPC( 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:
    PpPrintGetPC( pc, Pp_PC_INTENSITY, &pc_data );
    printf( "intensity: %ld\n", *(long *)pc_data );

    // A number stored in a char:
    PpPrintGetPC( 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:
    PpPrintGetPC( pc, Pp_PC_PAPER_SIZE, &dim );
    printf( "paper height: %d, width: %d\n", dim->h, dim->w );

    PpPrintReleasePC( pc );

    return Pt_CONTINUE;



Interrupt handler No
Signal handler No
Thread No

See also:

PpPrintClose(), PpPrintCreatePC(), PpPrintGetPC(), PpPrintNewPage(), PpPrintReleasePC(), PpPrintSetPC(), PpPrintStart(), PpPrintStop(), PpPrintWidget()

[Previous] [Contents] [Index] [Next]