Version

PagePrintingEventArgs Class

Event arguments class for the UltraPrintDocument.PagePrinting event.
Syntax
'Declaration
 
Public Class PagePrintingEventArgs 
   Inherits PageSectionPrintEventArgs
public class PagePrintingEventArgs : PageSectionPrintEventArgs 
Example
The following example demonstrates the 'PagePrinting' event of the UltraPrintDocument.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.Printing

    Private Sub UltraPrintDocument1_PagePrinting(ByVal sender As System.Object, ByVal e As Infragistics.Win.Printing.PagePrintingEventArgs) Handles UltraPrintDocument1.PagePrinting
        ' the page printing event can be used to cancel the print 
        ' operation completely or used to adjust some settings of 
        ' the various page sections. for example, if you were 
        ' inserting a title page, you probably wouldn't want
        ' the header or footer to render, so you can explicitly
        ' set their height to 0
        If e.Document.PageNumber = 1 Then
            e.Document.Header.Height = 0
            e.Document.Footer.Height = 0
        Else e.Document.PageNumber = 1 Then
            ' then for all subsequent pages, the header and
            ' footer height should be automatically calculated
            ' based on the contents (text, padding, border, margins,etc).
            e.Document.Header.Height = -1
            e.Document.Footer.Height = -1
        End If
    End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.Printing;

		private void ultraPrintDocument1_PagePrinting(object sender, Infragistics.Win.Printing.PagePrintingEventArgs e)
		{
			// the page printing event can be used to cancel the print 
			// operation completely or used to adjust some settings of 
			// the various page sections. for example, if you were 
			// inserting a title page, you probably wouldn't want
			// the header or footer to render, so you can explicitly
			// set their height to 0
			if (e.Document.PageNumber == 1)
			{
				e.Document.Header.Height = 0;
				e.Document.Footer.Height = 0;
			}
			else (e.Document.PageNumber == 1)
			{
				// then for all subsequent pages, the header and
				// footer height should be automatically calculated
				// based on the contents (text, padding, border, margins,etc).
				e.Document.Header.Height = -1;
				e.Document.Footer.Height = -1;
			}
		}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also