PpPrintContext_t

Data structure describing a print context

Synopsis:

See below.

Description:

The PpPrintContext_t structure describes a print context. Its members control how printing is to be done.


Note: PpPrintContext_t is an opaque datatype. Use PpGetPC() to extract members, and PpSetPC() to change them.

The possible values and meanings for the members of a print context are defined in /usr/photon/print/printers.

A print context includes the data described in the sections that follow. Each section indicates the type of data, but see PpGetPC() and PpSetPC() for details.

PpPrintContext_t includes the following members:

Pp_PC_COLLATING_MODE

Data type: char

The order of pages that are printed in print jobs that are printing more than one copy. The modes may include:

Pp_PC_COLOR_MODE

Data type: char

The color mode to use — you might want to print in black and white on a color printer. Possible meanings:

Pp_PC_CONTROL (read-only)

Data type: PpPCControl_t

This member is the control structure for the print context.


Note: You can't use PpSetPC() to set Pp_PC_CONTROL.

The control structure has at least the following members:

char changed_prop[Pp_PC_FLAGSIZE]
This array is treated as a large bit field that indicates which portions of the context have been modified. There's a bit for each of the modifiable attributes of a print context.

This bit field can be manipulated with the following macros, which are defined in <photon/PpT.h>:

For example:

if( Pp_testbit( control-gt;changed_prop, Pp_PC_NAME) )
    printf( "Print name has been changed\n");
  
char emitted_prop[Pp_PC_FLAGSIZE]
A large bit field that indicates which of the changed print context attributes have already been written to the destination or temporary file. For example:
if( Pp_testbit( control-gt;emitted_prop, Pp_PC_NAME) )
    printf( "source offset has been emitted\n");
  
unsigned long locked_prop[Pp_PC_FLAGSIZE]
A large bitfield that indicates which context attributes are locked. The printer properties application displays locked attributes as ghosted controls, and PpSetPC() won't let you change them.
int fd
The file descriptor for the current print job's working file. The working file isn't opened until PpStartJob() opens the print job. This member is -1 if no files are currently open.
char *tmp_target
The temporary working file that's used if do_preview is set.
char do_preview
If this is nonzero, the application specified in the print context's Pp_PC_PREVIEW_APP member is launched when the print job is finished (that is, when PpEndJob() is called).

Pp_PC_COPIES

Data type: char

The number of copies to produce.

Pp_PC_DATE

Data type: char[]

The date the print job was started. It's filled in when the print job is initialized. See PpStartJob() and PpContinueJob().

Pp_PC_DEVICE

Data type: char[]

Usually the spooler to use (e.g. /dev/spool/Ph.main_deskjet).

If you're sending the print job directly to a printer (such as /dev/par1), set Pp_PC_FILENAME to be the name of the printer (e.g. /dev/par1) and Pp_PC_DRIVER to be the name of the Photon print driver that produces output that the printer recognizes.


Note: If both the device and filename members are set, the output goes to the destination identified by the filename.

Pp_PC_DITHERING

Data type: char

The type of dithering. Possible meanings are defined in the printer configuration file, and include:

Pp_PC_DO_PREVIEW

Data type: char

If nonzero, the preview application is launched rather submitting the job to a spooler.

Pp_PC_DRIVER

Data type: char[]

The print filter, such as phs-to-pcl, to launch if printing to a file (if a filename is specified). For information about the available print drivers, see the entries for the phs-to-* Photon print drivers in the Utilities Reference.

Pp_PC_DUPLEX

Data type: char

Specifies whether (1) or not (0) to do double-sided printing.

Pp_PC_FILENAME

Data type: char[]

If this member is specified, the final output of the print job is placed in this file instead of being sent to a device.

For raw phs output, you need to pass the file through a spooler device. There's a simple phs-to-phs filter (similar to cat) for this purpose.

Pp_PC_INKTYPE

Data type: char

The type of ink. Possible meanings:

Pp_PC_INTENSITY

Data type: unsigned long

The printing intensity, expressed as a value between 0% and 100%. A printer's default intensity is 50%.

Pp_PC_JOB_NAME

Data type: char[]

The name of the print job, for identification purposes.

Pp_PC_MARGINS

Data type: PhRect_t

A rectangle that specifies the margins to apply to the pages, in 1/1000ths of an inch:

The orientation of the page doesn't affect the margins.

Pp_PC_MAX_DEST_SIZE

Data type: unsigned long

The maximum size of the temporary phs file, in bytes.

Pp_PC_NAME

Data type: char[]

The name of the printer (e.g. R&D main printer).

Pp_PC_NONPRINT_MARGINS

Data type: PhRect_t

A rectangle that specifies (in 1/1000ths of an inch) the nonprintable margins of the printer.

Pp_PC_ORIENTATION

Data type: char

Possible meanings include portrait and landscape, as defined in the printer-configuration file.

Pp_PC_PAGE_NUM

Data type: unsigned long

The number of the current page being printed.

Pp_PC_PAGE_RANGE

Data type: PpPageRange_t

The range of pages to be printed. The application should use this information when producing the printed output; only the requested pages need to be printed.

The page range is a PpPageRange_t structure with two int members, from and to. Special meanings for the range are:

from to Print:
0 0 All
-1 -1 Selected region
n 0 From page n to the end of the document

The library assumes that the first page printed is the first requested page. If this isn't the case, use Pp_PC_PAGE_NUM to set the page number manually.

Pp_PC_PAPER_SIZE

Data type: PhDim_t

The dimensions of the paper, including margins and the nonprintable area, in 1/1000ths of an inch. This size is used for clipping and for any scaling that may be applied.

Pp_PC_PAPER_SOURCE

Data type: char

The paper source, for printers that support more than one paper tray. The possible meanings are:

Pp_PC_PAPER_TYPE

Data type: char

The type of paper. This is in the range 0 through 100. Possible meanings include:

Pp_PC_PREVIEW_APP

Data type: char[]

The application to launch to preview the print job, usually /usr/photon/bin/preview.

Pp_PC_PRINTER_RESOLUTION

Data type: PhDim_t

The printing mode, specified in x and y dots per inch. The printer tries to print at this resolution.

Pp_PC_PROP_APP

Data type: char[]

The application to launch to adjust the printer properties portion of the print context.

Pp_PC_REVERSED

Data type: char

If this is nonzero, the pages are printed in reverse order. The default is forward.

Pp_PC_SCALE

Data type: PhPoint_t

The scale to use in x and y:


Note: If the x and y scales are both 0, the source is scaled to be as large as possible to fit on the page and still maintain its x and y aspect ratio.

Pp_PC_SOURCE_COLORS

Data type: unsigned long

The number of bitplanes per source pixel. If this is n, you'll have 2n colors. For example, a value of 8 means 256 colors. This is a hint that helps the print drivers improve the dithering model. The default is 24bpp (True Color).

Pp_PC_SOURCE_OFFSET

Data type: PhPoint_t

The origin for the print job. For example, if a widget you want to print is at (50,50) but you want it to appear in the upper left corner of the page, set the source offset to (50,50).

This offset affects the entire page; to affect an individual widget, use the trans argument to PpPrintWidget().

Pp_PC_SOURCE_RESOLUTION

Data type: PhDim_t

The resolution, in pixels per inch, of the original source image. This is a hint that helps the print drivers do the best scaling possible. The default is 100 pixels per inch.

Pp_PC_SOURCE_SIZE

Data type: PhDim_t

The dimension of the source image, in pixels. This size is used for clipping and for any scaling that may be applied.

Pp_PC_USER_ID (read-only)

Data type: char[]

The user creating the print job. This member is filled in when the print job is initialized. See PpStartJob() and PpContinueJob().

Classification:

Photon

See also:

PpContinueJob(), PpGetPC(), PpPrintWidget(), PpSetPC(), PpStartJob()

For information about the available print drivers, see the entries for the phs-to-* Photon print drivers in the Utilities Reference.