TX Text Control .NET for WPF

Print Method

Method|Introduced in 12.0
Namespace
TXTextControl
Package
TXTextControl.TextControl.WPF.SDK as TXTextControl.Server.dll from the private NuGet feed or Text Control Offline Packages

Description

Prints a Text Control document or a part of a document.

Syntax

Print(PrintDocument)

Prints the document using the printer settings of the specified PrintDocument.

public void Print(PrintDocument printDocument);
ParameterDescription
printDocument

Specifies an instance of the PrintDocument class. The following settings of the PrintDocument object are used:

SettingMeaning
DocumentNameSpecifies the document's name.
PrintControllerSpecifies the document's print controller.
PrinterSettings.FromPageThe first page to print.
PrinterSettings.ToPageThe last page to print.
PrinterSettings.CopiesThe number of copies to print.
PrinterSettings.CollateSpecifies how the printed pages are sorted.
PrinterSettings.PrinterNameSpecifies the name of the printer.
PrinterSettings.PrintToFileSpecifies whether the printed pages are saved in a file.
PrinterSettings.PrintRangeSpecifies the range of pages to print.
DefaultPageSettings.ColorSpecifies whether the printed pages are printed colored.

Print(int, PrintPageEventArgs)

Prints a single page. This method can be called from the PrintPage event handler.

public void Print(int page, PrintPageEventArgs ppe);
ParameterDescription
page

Specifies a page number to print.

ppe

Specifies the event arguments of the print document's PrintPage event.

Examples

The following example prints the current document. The created object is then available to the surrounding document workflow.

textControl.Print(new System.Drawing.Printing.PrintDocument());
Console.WriteLine("Server Text Control is ready for use.");