Class
RadPrintDocument

Defines a reusable object that sends output to a printer and manages the whole printing process, when printing from an application. Can be associated with any object that implements the IPrintable interface.

Definition

Namespace:Telerik.WinControls.UI

Assembly:Telerik.WinControls.UI.dll

Syntax:

cs-api-definition
public class RadPrintDocument : PrintDocument, IComponent, IDisposable

Inheritance: objectMarshalByRefObjectComponentPrintDocumentRadPrintDocument

Implements: IComponentIDisposable

Inherited Members PrintDocument.OnQueryPageSettings(QueryPageSettingsEventArgs)PrintDocument.Print()PrintDocument.ToString()PrintDocument.DefaultPageSettingsPrintDocument.DocumentNamePrintDocument.OriginAtMarginsPrintDocument.PrintControllerPrintDocument.PrinterSettingsPrintDocument.BeginPrintPrintDocument.EndPrintPrintDocument.PrintPagePrintDocument.QueryPageSettingsComponent.Dispose()Component.Dispose(bool)Component.GetService(Type)Component.CanRaiseEventsComponent.EventsComponent.SiteComponent.ContainerComponent.DesignModeComponent.DisposedMarshalByRefObject.MemberwiseClone(bool)MarshalByRefObject.GetLifetimeService()MarshalByRefObject.InitializeLifetimeService()MarshalByRefObject.CreateObjRef(Type)

Constructors

RadPrintDocument()

Initializes a new instance of the RadPrintDocument class.

Declaration

cs-api-definition
public RadPrintDocument()

Fields

DatePrintedString

Declaration

cs-api-definition
public const string DatePrintedString = "[Date Printed]"

Field Value

string

LogoString

Declaration

cs-api-definition
public const string LogoString = "[Logo]"

Field Value

string

PageNumberString

Declaration

cs-api-definition
public const string PageNumberString = "[Page #]"

Field Value

string

TimePrintedString

Declaration

cs-api-definition
public const string TimePrintedString = "[Time Printed]"

Field Value

string

TotalPagesString

Declaration

cs-api-definition
public const string TotalPagesString = "[Total Pages]"

Field Value

string

UserNamePrintedString

Declaration

cs-api-definition
public const string UserNamePrintedString = "[User Name]"

Field Value

string

Properties

AssociatedObject

Gets or sets the IPrintable object associated with this document for printing.

Declaration

cs-api-definition
[Browsable(true)]
public IPrintable AssociatedObject { get; set; }

Property Value

IPrintable

An object that implements IPrintable, or null if no object is associated.

AutoPortraitLandscape

Gets or sets a value indicating whether the orientation should be automatically determined based on the content.

Declaration

cs-api-definition
[Browsable(true)]
public bool AutoPortraitLandscape { get; set; }

Property Value

bool

true to automatically choose between portrait and landscape; otherwise, false.

CurrentPage

Gets or sets the currently selected page. This page will be the first to be printed when the PrintRange is set to Current or Selection.

Declaration

cs-api-definition
[Browsable(false)]
public int CurrentPage { get; set; }

Property Value

int

FooterFont

Gets or sets the font of the page footer.

Declaration

cs-api-definition
[Browsable(true)]
public Font FooterFont { get; set; }

Property Value

Font

FooterHeight

Gets or sets the height of the footer area in hundredths of an inch.

Declaration

cs-api-definition
[Browsable(true)]
public int FooterHeight { get; set; }

Property Value

int

An integer representing the footer height.

HeaderFont

Gets or sets the font of the page header.

Declaration

cs-api-definition
[Browsable(true)]
public Font HeaderFont { get; set; }

Property Value

Font

HeaderHeight

Gets or sets the height of the header area.

Declaration

cs-api-definition
[Browsable(true)]
public int HeaderHeight { get; set; }

Property Value

int

IsPrinting

Indicates whether the printing process is running.

Declaration

cs-api-definition
[Browsable(false)]
public bool IsPrinting { get; }

Property Value

bool

Landscape

Gets or sets a value indicating whether the document should be printed in landscape orientation.

Declaration

cs-api-definition
[Browsable(true)]
public bool Landscape { get; set; }

Property Value

bool

true to print in landscape orientation; otherwise, false for portrait orientation.

LeftFooter

Gets or sets the text that will be printed near the bottom left corner of the page.

Declaration

cs-api-definition
[Browsable(true)]
public string LeftFooter { get; set; }

Property Value

string

LeftHeader

Gets or sets the text that will be printed near the upper left corner of the page.

Declaration

cs-api-definition
[Browsable(true)]
public string LeftHeader { get; set; }

Property Value

string

Gets or sets the logo image that will be printed when the [Logo] placeholder is used in headers or footers.

Declaration

cs-api-definition
[Browsable(true)]
public Image Logo { get; set; }

Property Value

Image

An Image representing the logo, or null if no logo is set.

Margins

Gets or sets the margins for the printed page.

Declaration

cs-api-definition
[Browsable(true)]
public Margins Margins { get; set; }

Property Value

Margins

A Margins object that represents the page margins, or null to use the default.

MiddleFooter

Gets or sets the text that will be printed at the bottom center of the page.

Declaration

cs-api-definition
[Browsable(true)]
public string MiddleFooter { get; set; }

Property Value

string

MiddleHeader

Gets or sets the text that will be printed at the top center of the page.

Declaration

cs-api-definition
[Browsable(true)]
public string MiddleHeader { get; set; }

Property Value

string

PageCount

Gets the total page count. The value is populated when the printing process begins.

Declaration

cs-api-definition
[Browsable(false)]
public int PageCount { get; }

Property Value

int

PaperSize

Gets or sets the paper size for printing.

Declaration

cs-api-definition
[Browsable(true)]
public PaperSize PaperSize { get; set; }

Property Value

PaperSize

A PaperSize object that represents the size of the paper, or null to use the default.

PaperSource

Gets or sets the paper source (tray) from which to get the paper.

Declaration

cs-api-definition
[Browsable(true)]
public PaperSource PaperSource { get; set; }

Property Value

PaperSource

A PaperSource object that represents the paper source, or null to use the default.

PrintedPage

Gets the number of the page being printed. The value of this property changes during the printing process.

Declaration

cs-api-definition
[Browsable(false)]
public int PrintedPage { get; }

Property Value

int

ReverseFooterOnEvenPages

Gets or sets a value indicating whether the left and right footer positions should be reversed on even pages.

Declaration

cs-api-definition
[Browsable(true)]
public bool ReverseFooterOnEvenPages { get; set; }

Property Value

bool

true to reverse the footer positions on even pages; otherwise, false.

ReverseHeaderOnEvenPages

Gets or sets a value indicating whether the left and right header positions should be reversed on even pages.

Declaration

cs-api-definition
[Browsable(true)]
public bool ReverseHeaderOnEvenPages { get; set; }

Property Value

bool

true to reverse the header positions on even pages; otherwise, false.

RightFooter

Gets or sets the text that will be printed near the bottom right corner of the page.

Declaration

cs-api-definition
[Browsable(true)]
public string RightFooter { get; set; }

Property Value

string

RightHeader

Gets or sets the text that will be printed near the upper right corner of the page.

Declaration

cs-api-definition
[Browsable(true)]
public string RightHeader { get; set; }

Property Value

string

SelectionLength

Gets or sets the count of the selected pages. This indicates how many pages will be printed when the PrintRange is set to Selection.

Declaration

cs-api-definition
[Browsable(false)]
public int SelectionLength { get; set; }

Property Value

int

Watermark

Gets or sets the watermark settings for the printed pages.

Declaration

cs-api-definition
[Browsable(true)]
public RadPrintWatermark Watermark { get; set; }

Property Value

RadPrintWatermark

A RadPrintWatermark object that defines the watermark properties, or null if no watermark is used.

Methods

HasLogoInHeaderFooterString(string)

Determines whether the specified string contains the logo placeholder token.

Declaration

cs-api-definition
protected bool HasLogoInHeaderFooterString(string s)

Parameters

s

string

The string to check for the logo placeholder.

Returns

bool

true if the string contains the logo placeholder; otherwise, false.

OnAssociatedObjectChanged()

Called when the associated printable object has changed.

Declaration

cs-api-definition
protected virtual void OnAssociatedObjectChanged()

OnBeginPrint(PrintEventArgs)

Handles the beginning of the print job by initializing the page count and setting up print parameters.

Declaration

cs-api-definition
protected override void OnBeginPrint(PrintEventArgs e)

Parameters

e

PrintEventArgs

A PrintEventArgs that contains the event data.

Overrides PrintDocument.OnBeginPrint(PrintEventArgs)

OnEndPrint(PrintEventArgs)

Handles the end of the print job by finalizing the printing process and cleaning up resources.

Declaration

cs-api-definition
protected override void OnEndPrint(PrintEventArgs e)

Parameters

e

PrintEventArgs

A PrintEventArgs that contains the event data.

Overrides PrintDocument.OnEndPrint(PrintEventArgs)

OnPrintPage(PrintPageEventArgs)

Handles the printing of each page by coordinating the watermark, content, header, and footer rendering.

Declaration

cs-api-definition
protected override void OnPrintPage(PrintPageEventArgs e)

Parameters

e

PrintPageEventArgs

A PrintPageEventArgs that contains the event data.

Overrides PrintDocument.OnPrintPage(PrintPageEventArgs)

ParseHeaderFooterString(string)

Parses a header or footer string by replacing placeholder tokens with their actual values.

Declaration

cs-api-definition
protected string ParseHeaderFooterString(string s)

Parameters

s

string

The string containing placeholder tokens to be replaced.

Returns

string

The parsed string with placeholders replaced by actual values.

PrintFooter(PrintPageEventArgs)

Prints the footer part of the page.

Declaration

cs-api-definition
protected virtual void PrintFooter(PrintPageEventArgs args)

Parameters

args

PrintPageEventArgs

The printing arguments.

PrintHeader(PrintPageEventArgs)

Prints the header part of the page.

Declaration

cs-api-definition
protected virtual void PrintHeader(PrintPageEventArgs args)

Parameters

args

PrintPageEventArgs

The printing arguments.

PrintLogo(Graphics, Rectangle)

Renders the logo image within the specified rectangle.

Declaration

cs-api-definition
protected virtual void PrintLogo(Graphics g, Rectangle rect)

Parameters

g

Graphics

The Graphics object to draw on.

rect

Rectangle

The Rectangle area where the logo should be drawn.

PrintWatermark(PrintPageEventArgs)

Prints the watermark of the page.

Declaration

cs-api-definition
protected virtual void PrintWatermark(PrintPageEventArgs args)

Parameters

args

PrintPageEventArgs

The printing arguments.