BeforePrintNewPage Event - .NET

<< Click to Display Table of Contents >>

Navigation:  Events Generated by the .NET Control >

BeforePrintNewPage Event - .NET

Previous pageReturn to chapter overviewNext page

Is fired only while printing exactly before printing a new page. The event is useful to change the Device Control Properties on-the-fly during printing. You may change all properties, except the device itself.

PrintEventHandler VPE.BeforePrintNewPage(

object sender,

PrintEventArgs e

)

object sender

the VPE document object that fired the event

PrintEventArgs e

event data, derived from EventArgs, two additional members:

public class PrintEventArgs : EventArgs

{

public int Page;

public PrintResultingAction PrintResultingAction;

}

 

int Page

current page number that will be printed

 

PrintResultingAction enumeration:

is a return-parameter, i.e. you can assign it one of the following values to control the resulting action of VPE:

public enum PrintResultingAction

{

Ok,

Change,

}

Remarks:

Your applications’s event handler can return a value in the ResultingAction member of the PrintEventArgs parameter.

 

Your application should return Ok, if it processes this message without changing a printing device's properties.

 

If a Device Control Property was changed, your application must return Change.

If you change the Device Control Properties during the print job, you must reset them to the original values, when the print job has finished (see RequestPrint Event – .NET: with PrintAction = PrintAction.Abort or PrintAction = PrintAction.End).

Changing the properties (like DevPaperBin, DevOrientation, DevPaperFormat, etc.) during the print job doesn’t work with some (buggy) printer drivers, for example some fax drivers and the HP4 M Plus driver (the HP4 PS driver should work with the HP4 M Plus printer!).

Some properties and methods don’t work with some printer drivers. For example "DevTTOption" doesn’t work with our HP4 and HP5 printer drivers on WfW 3.11 and NT 3.51, but it works with both drivers on Win95. This is a driver problem.

Printer drivers are manufactured by vendors independent of IDEAL Software; we make no warranty, implied or otherwise, regarding these product’s performance or reliability.

 

Known Problems:

Changing any Device Control Properties during the print job disables Duplex Printing on PCL Printers

SYMPTOMS

When you change a Device Control Property during the print job, it appears to disable Duplex (double-sided) printing when the target printer is a (Hewlett Packard) PCL printer.

CAUSE

PCL printers treat a change in paper size as a new print job that requires the printer to be initialized. This causes the printer to eject any page that is currently in the printer. The PCL printer drivers for Windows assume that the page size has been changed when a Device Control Property is changed during the print job, unless the orientation of the page has changed.

RESOLUTION

To prevent having a page ejected when changing a Device Control Property during the print job, make sure that the function is called only between individual sheets of paper. Changing a Device Control Property before printing odd-numbered pages is sufficient for most applications that use duplex printing. However, some applications require that you change the page orientation on a page-by-page basis. In this case, you can change Device Control Properties between individual sheets of paper if the orientation has changed.

STATUS

This behavior is by design.

MORE INFORMATION

Note that when this problem occurs the print job continues and the sheets of paper are passed through the printer's duplexer, but the sheets are only printed on one side.

Because of the page size initialization requirement for PCL printers, Windows PCL drivers treat the change of Device Control Properties differently. These drivers allow only the orientation to change between the front and back pages of a sheet of paper. This means that the change of a Device Control Property will eject the page unless the orientation (and only the orientation) has changed from the previous page. Returning PrintResultingAction.Change although no Device Control Property has been changed causes the printer to eject the page.

Returning PrintResultingAction.Change although no Device Control Property has been changed is unnecessary. By doing so, you risk having a page ejected from the printer, which has a high probability of occurring.

 

See also:

PrintDevData Event - .NET