IPrintOemPS::Command method

The IPrintOemPS::Command method is used by rendering plug-ins for the Microsoft PostScript printer driver, in order to insert PostScript commands into the print job's data stream.

Syntax

HRESULT Command(
  PDEVOBJ   pdevobj,
  DWORD     dwIndex,
  PVOID     pData,
  DWORD     cbSize,
  OUT DWORD *pdwResult
);

Parameters

pdevobj

Caller-supplied pointer to a DEVOBJ structure.

dwIndex

Caller-supplied value representing the current injection point within the print job's data stream. For more information, see the following Remarks section.

pData

Not used.

cbSize

Not used.

pdwResult

Receives a method-supplied value indicating the result of the insertion operation. If the insertion succeeds, this value should be ERROR_SUCCESS. If the insertion fails, the value should be one of the error codes defined in winerror.h. If the method does not attempt to insert data for a specified dwIndex value, the value should be ERROR_NOT_SUPPORTED.

Return Value

The method must return one of the following values.

Return code Description
S_OK
The operation succeeded.
E_FAIL
The operation failed
E_NOTIMPL
The method is not implemented.

Remarks

The IPrintOemPS::Command method is used to insert PostScript commands into the data stream that is generated by the Microsoft PostScript Printer Driver. If you want to provide this method, you must define it in a rendering plug-in.

When the IPrintOemPS::Command method is called, its dwIndex parameter specifies the current injection point within the print job's data stream. The method should use this value to determine what operation, if any, to perform. Index values, which are defined in wingdi.h, are listed in the following table.

Index value When received
PSINJECT_BEGINDEFAULTS After the printer driver sends %%BeginDefaults to the data stream.
PSINJECT_BEGINPAGESETUP After the printer driver sends %%BeginPageSetup to the data stream.
PSINJECT_BEGINPROLOG After the printer driver sends %%BeginProlog to the data stream.
PSINJECT_BEGINSETUP After the printer driver sends %%BeginSetup to the data stream.
PSINJECT_BEGINSTREAM Before the printer driver sends the first byte of the data stream.
PSINJECT_BOUNDINGBOX When the printer driver is ready to insert %%BoundingBox: into the data stream. Data supplied by IPrintOemPS::Command replaces the driver's %%BoundingBox: comment.
PSINJECT_COMMENTS Before the printer driver sends %%EndComments to the data stream.
PSINJECT_DLFONT Before the print driver downloads a soft font.
PSINJECT_DOCNEEDEDRES After the printer driver sends %%DocumentNeededResources: to the data stream, along with resource information. If the IPrintOemPS::Command method sends resource information, it is appended to the stream after the driver's resource information. Entry format is as follows:

%%+ResourceTypeResourceNames

The printer driver sends %%DocumentNeededResources: after sending %%Trailer section.

PSINJECT_DOCSUPPLIEDRES After the printer driver sends %%DocumentSuppliedResources: to the data stream, along with resource information. If the IPrintOemPS::Command method sends resource information, it is appended to the stream after the driver's resource information. Entry format is as follows:

%%+ResourceTypeResourceNames

The printer driver sends %%DocumentSuppliedResources: after sending %%Trailer section.

PSINJECT_DOCUMENTPROCESSCOLORS
When the printer driver is ready to insert %%DocumentProcessColors:color into the data stream. Data supplied by IPrintOemPS::Command replaces the driver's %%DocumentProcessColors:color comment.
PSINJECT_DOCUMENTPROCESSCOLORSATEND
When the printer driver is ready to insert %%DocumentProcessColors:(atend) into the data stream. Data supplied by IPrintOemPS::Command replaces the driver's %%DocumentProcessColors:(atend) comment.
PSINJECT_ENDDEFAULTS Before the printer driver sends %%EndDefaults to the data stream.
PSINJECT_ENDPAGECOMMENTS Before the printer driver sends %%EndPageComments to the data stream.
PSINJECT_ENDPAGESETUP Before the printer driver sends %%EndPageSetup to the data stream.
PSINJECT_ENDPROLOG Before the printer driver sends %%EndProlog to the data stream.
PSINJECT_ENDSETUP Before the printer driver sends %%EndSetup to the data stream.
PSINJECT_ENDSTREAM After the printer driver sends the last byte of the data stream.
PSINJECT_EOF After the printer driver sends %%EOF to the data stream.
PSINJECT_ORIENTATION When the printer driver is ready to insert %%Orientation: into the data stream. Data supplied by IPrintOemPS::Command replaces the driver's %%Orientation: comment.
PSINJECT_PAGEBBOX When the printer driver is ready to insert %%PageBoundingBox: into the data stream. Data supplied by IPrintOemPS::Command replaces the driver's %%PageBoundingBox: comment.
PSINJECT_PAGENUMBER When the printer driver is ready to insert %%Page: into the data stream. Data supplied by IPrintOemPS::Command replaces the driver's %%Page: comment.
PSINJECT_PAGEORDER When the printer driver is ready to insert %%PageOrder: into the data stream. Data supplied by IPrintOemPS::Command replaces the driver's %%PageOrder: comment.
PSINJECT_PAGES When the printer driver is ready to insert %%Pages:nnn into the data stream. Data supplied by IPrintOemPS::Command replaces the driver's %%Pages:nnn comment.
PSINJECT_PAGESATEND When the printer driver is ready to insert %%Pages:(atend) into the data stream. Data supplied by IPrintOemPS::Command replaces the driver's %%Pages:(atend) comment.
PSINJECT_PAGETRAILER After the printer driver sends %%PageTrailer to the data stream.
PSINJECT_PLATECOLOR When the printer driver is ready to insert %%PlateColor:color into the data stream. Data supplied by IPrintOemPS::Command replaces the driver's %%PlateColor:color comment.
PSINJECT_PSADOBE Before the printer driver sends %!PS-Adobe to the data stream.
PSINJECT_SHOWPAGE Before the printer driver sends a showpage command.
PSINJECT_TRAILER After the printer driver sends %%Trailer to the data stream.
PSINJECT_VMRESTORE After the printer driver sends a restore command. (The IPrintOemPS::Command method must resend all resources it sent after the last PSINJECT_VMSAVE, if the resources are going to be reused.)
PSINJECT_VMSAVE Before the printer driver sends a save command. (See PSINJECT_VMRESTORE.)

The IPrintOemPS::Command method must call IPrintOemDriverPS::DrvWriteSpoolBuf to insert the PostScript commands.

If IPrintOemPS::Command methods are exported by multiple rendering plug-ins, the methods are called in the order that the plug-ins are specified for installation, every time that the printer driver reaches an injection point. The following rules apply:

  • If the injection point is one for which supplied data is appended to the data that the printer driver provides, each plug-in is called and each plug-in is allowed to append PostScript commands.

  • If the injection point is one for which supplied data replaces the data that the printer driver provides, the plug-ins are called until one IPrintOemPS::Command method supplies ERROR_SUCCESS for dwResult. No other plug-ins are called. If all plug-ins supply ERROR_NOT_SUPPORTED, the driver-supplied data is not replaced.

  • If the injection point is one for which supplied data replaces the data that the printer driver provides, and if an application has already replaced the driver-supplied data by using the POSTSCRIPT_INJECTION printer escape function, no plug-ins are called.

Requirements

   
Target Platform Desktop
Header prcomoem.h (include Prcomoem.h)