Compartir a través de


POSTSCRIPT_INJECTION Printer Escape function

The POSTSCRIPT_INJECTION printer escape function inserts a block of raw data at a specified point in a PostScript job stream.

A PostScript driver supports this escape function in GDI-centric mode or PostScript-centric mode support, but not in compatibility mode.

To set the PostScript driver's mode, call the POSTSCRIPT_IDENTIFY escape function.

To perform this operation, call the ExtEscape function with the following parameters.

Syntax

int ExtEscape(
  _In_  HDC    hdc,
  _In_  int    nEscape,
  _In_  int    cbInput,
  _In_  LPCSTR lpszInData,
  _In_  int    cbOutput,
  _Out_ LPSTR  lpszOutData
);

Parameters

  • hdc [in]
    A handle to the printer device context.

  • nEscape [in]
    The escape function to be performed.

    Value Meaning
    POSTSCRIPT_INJECTION

    Inserts a block of raw data in a PostScript job stream.

     

  • cbInput [in]
    The number of bytes of data pointed to by the lpszInData parameter.

    Set this parameter to sizeof ( PSINJECTDATA ) plus the size of the raw data to inject.

  • lpszInData [in]
    A pointer to the buffer that contains a PSINJECTDATA structure followed by the raw data to inject.

  • cbOutput [in]
    The number of bytes of data pointed to by the lpszOutData parameter.

    For this printer escape function, the value of this parameter is 0.

  • lpszOutData [out]
    A pointer to the structure that receives output from this escape.

    For this printer escape function, the value of the parameter is NULL.

Return value

The return value is greater than zero if the function is successful and less than zero if not. A return value of zero indicates that the printer does not support this escape.

Remarks

The injection data for a specified injection point is cumulative. In other words, POSTSCRIPT_INJECTION adds the new injection data to any injection data previously specified for the same injection point.

If the job is in EMF data type, you must provide all injection data before StartDoc by using the POSTSCRIPT_INJECTION printer escape function.

If the job is in RAW data type, you must provide the following injection data before the driver needs it, according to the following rules:

Injection data When to provide

Data for header sections (before first %%Page:)

Before calling the first StartPage function

Data for page setup sections when injecting data for one particular page

Before calling the StartPage function for that particular page

Data for page setup sections when injecting data for all pages after a specified page

Before calling StartPage for the specified page

Data for page trailer sections

Before calling the EndPage function

Data for document trailer sections

Before calling the EndDoc function

 

The driver internally caches the injection data and emits it at appropriate points in the output. The cached information is flushed when it is no longer needed. At the latest, it is flushed after the EndDoc call.

In GDI-centric mode, the application can only inject valid DSC block data by using the POSTSCRIPT_INJECTION printer escape function. A valid DSC block must satisfy all of the following conditions:

  • It consists of an integral sequence of "lines."
  • Each "line" must begin with "%%".
  • Each "line" except the last line must end with <CR>, <LF>, or <CR><LF> except for the last line. If the last line does not end with <CR>, <LF>, or <CR><LF>, the driver appends <CR><LF> after the last byte of the injection data.
  • Each "line" must be 255 bytes or less including the "%%" but not counting the <CR>/<LF> line termination.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Wingdi.h (include Windows.h)

See also

Printing

GDI Printer Escape Functions

ExtEscape

PSINJECTDATA