# Printing Using TX Text Control .NET for WPF

> WPF printing differs from Windows Forms by using PrintTicket for printer configuration and PrintQueue for job management. TX Text Control .NET for WPF supports both simple default printing and advanced dialog-based options including page range, copy count, and collation settings.

- **Author:** Bjoern Meyer
- **Published:** 2014-07-21
- **Modified:** 2026-07-17
- **Description:** WPF printing differs from Windows Forms by using PrintTicket for printer configuration and PrintQueue for job management. TX Text Control .NET for WPF supports both simple default printing and advanced dialog-based options including page range, copy count, and collation settings.
- **3 min read** (511 words)
- **Tags:**
  - Tutorial
- **Web URL:** https://www.textcontrol.com/blog/2014/07/21/printing-using-tx-text-control-net-for-wpf/
- **LLMs URL:** https://www.textcontrol.com/blog/2014/07/21/printing-using-tx-text-control-net-for-wpf/llms.txt
- **LLMs-Full URL:** https://www.textcontrol.com/blog/2014/07/21/printing-using-tx-text-control-net-for-wpf/llms-full.txt

---

The printing approach in WPF is fundamentally different from printing in Windows Forms. In Windows Forms, you have a PrintDocument and events for each page that can be used for interaction.

In WPF, the [PrintTicket](http://msdn.microsoft.com/en-us/library/system.printing.printticket%28v=vs.110%29.aspx) class enables you to configure the printer's features such as *Collation*, *CopyCount* and *PageOrder*. The [PrintQueue](http://msdn.microsoft.com/en-us/library/system.printing.printqueue%28v=vs.110%29.aspx) class manages the printers and the print job itself.

Important: Even though the classes *PrintQueue* and *PrintTicket* are embedded in the same namespace *System.Printing*, the *PrintQueue* class is part of the assembly *System.Printing.dll* and the *PrintTicket* class is available through the *ReachFramework.dll* assembly. Make sure that you are adding both dependencies to your references.

TX Text Control .NET for WPF implements a very easy way to print without any settings to the default printer. This method is easy and works without additional settings:

```
textControl1.Print(string docName, true);
```

In order to adjust all printer and print job settings such as the collation, the number of copies and the various page selection options of the printer dialog, these settings must be handled separately. The following code opens a new [PrintDialog](http://msdn.microsoft.com/en-us/library/system.windows.controls.printdialog%28v=vs.110%29.aspx) with all page selection options enabled. The *MinPage* and *MaxPage* must be defined based on the existing pages in TextControl.

The user settings are available through the *PrintTicket* and *PrintQueue* properties of the *PrintDialog* class. The *PageRangeSelection* returns the selected page selection options. Based on these settings, a new *PageRange* object (**customRange**) is created and passed to the [Print](https://docs.textcontrol.com/textcontrol/wpf/ref.txtextcontrol.wpf.textcontrol.print.method.htm) method of TextControl.

```
PrintDialog dlg = new PrintDialog();
dlg.MinPage = 1;
dlg.MaxPage = (uint)textControl1.Pages;
dlg.CurrentPageEnabled = true;
dlg.SelectedPagesEnabled = true;
dlg.UserPageRangeEnabled = true;

PageRange customRange = new PageRange();

if (dlg.ShowDialog() == true)
{
switch (dlg.PageRangeSelection)
{
    case PageRangeSelection.AllPages:
        // print all pages
        customRange = new PageRange((int)dlg.MinPage, (int)dlg.MaxPage);
        break;
    case PageRangeSelection.CurrentPage:
        // use the page at the current input position
        customRange = new PageRange(textControl1.InputPosition.Page);
        break;
    case PageRangeSelection.UserPages:
        // user selection
        customRange = dlg.PageRange;
        break;
    case PageRangeSelection.SelectedPages:
        // get the start and end page of the current selection
        int iEndPage = textControl1.InputPosition.Page;
        textControl1.Selection.Length = 0;
        int iStartPage = textControl1.InputPosition.Page;
        customRange = new PageRange(iStartPage, iEndPage);
        break;
}

textControl1.Print(
    "Doc",
    dlg.PrintQueue.FullName,
    customRange,
    (int)dlg.PrintTicket.CopyCount,
    (Collation)dlg.PrintTicket.Collation);
```

The following screenshot shows the print dialog and the various available settings:

![Printing using TX Text Control .NET for WPF](https://s1-www.textcontrol.com/assets/dist/blog/2014/07/21/a/assets/print_dialog.webp "Printing using TX Text Control .NET for WPF")The following table shows the printer dialog options and the appropriate properties:

| **Print dialog setting** | **Property** |
|---|---|
| Page Range: All | PageRangeSelection.AllPages |
| Page Range: Selection | PageRangeSelection.SelectedPages |
| Page Range: Current Page | PageRangeSelection.CurrentPage |
| Page Range: Pages | PageRangeSelection.UserPages, PageRange |
| Number of copies | PrintTicket.CopyCount |
| Collate | PrintTicket.Collation |
| Select(ed) Printer | PrintQueue.FullName |

---

## About Bjoern Meyer

As CEO, Bjoern is the visionary behind our strategic direction and business development, bridging the gap between our customers and engineering teams. His deep passion for coding and web technologies drives the creation of innovative products. If you're at a tech conference, be sure to stop by our booth - you'll most likely meet Bjoern in person. With an advanced graduate degree (Dipl. Inf.) in Computer Science, specializing in AI, from the University of Bremen, Bjoern brings significant expertise to his role. In his spare time, Bjoern enjoys running, paragliding, mountain biking, and playing the piano.

- [LinkedIn](https://www.linkedin.com/in/bjoernmeyer/)
- [X](https://x.com/txbjoern)
- [GitHub](https://github.com/bjoerntx)

---

## Related Posts

- [Windows Forms Tutorial: Create Your First Windows Forms C# Application](https://www.textcontrol.com/blog/2024/08/26/windows-forms-tutorial-create-your-first-windows-forms-csharp-application/llms.txt)
- [How to Mail Merge MS Word DOCX Documents in ASP.NET Core C#](https://www.textcontrol.com/blog/2023/10/16/how-to-mail-merge-ms-word-docx-documents-in-aspnet-core-csharp/llms.txt)
- [Creating an Angular Document Editor Application with a Node.js WebSocket Server](https://www.textcontrol.com/blog/2023/08/24/creating-an-angular-document-editor-application-with-a-nodejs-websocket-server/llms.txt)
- [Adding SVG Watermarks to Documents](https://www.textcontrol.com/blog/2022/01/28/adding-svg-watermarks-to-documents/llms.txt)
- [Using MailMerge in ASP.NET Core 6 Web Applications](https://www.textcontrol.com/blog/2022/01/27/using-mailmerge-in-aspnet-core-6-web-applications/llms.txt)
- [DocumentViewer for React Prerelease](https://www.textcontrol.com/blog/2020/10/27/document-viewer-for-react-prerelease/llms.txt)
- [New DocumentViewer Signature Tutorial Sample](https://www.textcontrol.com/blog/2020/08/18/new-documentviewer-signature-tutorial-sample/llms.txt)
- [Creating an ASP.NET MVC DocumentViewer Application With Razor](https://www.textcontrol.com/blog/2020/01/01/creating-an-aspnet-mvc-documentviewer-application-with-razor/llms.txt)
- [Creating Your First Windows Forms Application with C#](https://www.textcontrol.com/blog/2020/01/01/creating-your-first-windows-forms-application-with-csharp/llms.txt)
- [Creating Your First WPF Application](https://www.textcontrol.com/blog/2020/01/01/creating-your-first-wpf-application/llms.txt)
- [Creating a WPF Ribbon Application](https://www.textcontrol.com/blog/2020/01/01/creating-a-wpf-ribbon-application/llms.txt)
- [Integrate Document Editing into any HTML Client using the HTML Widget](https://www.textcontrol.com/blog/2020/01/01/integrate-document-editing/llms.txt)
- [Creating an ASP.NET MVC Application With Razor](https://www.textcontrol.com/blog/2020/01/01/creating-an-aspnet-mvc-application-with-razor/llms.txt)
- [Creating A Windows Forms Ribbon Application](https://www.textcontrol.com/blog/2020/01/01/creating-a-windows-forms-ribbon-application/llms.txt)
- [Creating Your First ASP.NET Reporting Application](https://www.textcontrol.com/blog/2020/01/01/creating-your-first-aspnet-reporting-application/llms.txt)
- [Creating an ASP.NET Web Forms AJAX Application](https://www.textcontrol.com/blog/2020/01/01/creating-an-aspnet-web-forms-ajax-application/llms.txt)
- [Creating a WebSocket Server Project with Node.js](https://www.textcontrol.com/blog/2020/01/01/creating-a-websocket-server-project-with-nodejs/llms.txt)
- [Creating an Angular Document Editor Application](https://www.textcontrol.com/blog/2020/01/01/creating-an-angular-document-editor-application/llms.txt)
- [ReportingCloud .NET Core Quickstart Tutorial](https://www.textcontrol.com/blog/2019/07/24/reportingcloud-dotnet-core-quickstart-tutorial/llms.txt)
- [Document Permissions and Password Encryption](https://www.textcontrol.com/blog/2019/07/05/document-permissions-and-password-encryption/llms.txt)
- [New Online Sample: Build your First Report](https://www.textcontrol.com/blog/2019/07/03/build-your-first-report/llms.txt)
- [Create your First Document with ReportingCloud](https://www.textcontrol.com/blog/2019/02/19/create-your-first-document-with-reportingcloud/llms.txt)
- [MailMerge: Starting Each Merge Block on a New Page](https://www.textcontrol.com/blog/2016/09/09/mailmerge-starting-each-merge-block-on-a-new-page/llms.txt)
- [Windows Forms and WPF: End a List on Return when Line is Empty](https://www.textcontrol.com/blog/2016/08/26/windows-forms-and-wpf-end-a-list-on-return-when-line-is-empty/llms.txt)
- [Using IFormattedText Objects to Access Elements Across All TextParts in a Document](https://www.textcontrol.com/blog/2016/08/25/using-iformattedtext-objects-to-access-elements-across-all-textparts-in-a-document/llms.txt)
