Products Technologies Demo Docs Blog Support Company

Printing into a PrintPreview Control II

In this sample, I explained how to print into a .NET Framework PrintPreviewDialog control. https://github.com/TextControl/ A customized PrintController has been derived from the PrintController class. But I forgot to tell you to reset the PrintController after initializing the dialog. This is important, because the dialog provides a button to print the content to the specified printer directly. If the PrintController is the inherited one, its content will not be printed. Therefore, we have…

Printing into a PrintPreview Control II

In this sample, I explained how to print into a .NET Framework PrintPreviewDialog control.

https://github.com/TextControl/

A customized PrintController has been derived from the PrintController class. But I forgot to tell you to reset the PrintController after initializing the dialog. This is important, because the dialog provides a button to print the content to the specified printer directly. If the PrintController is the inherited one, its content will not be printed.

Therefore, we have to pass a new PrintController, after the dialog has been initialized. We can attach an Actived event where the dialog will be opened:

pp.Activated += new EventHandler(pp_Activated);

In the event, we will create a new PrintController:

void pp_Activated(object sender, EventArgs e)
{
    pp.Document.PrintController = new StandardPrintController();
}

The PrintPreviewDialog must be accessible in this sample:

private PrintPreviewDialog pp = new PrintPreviewDialog();

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

Related Posts

.NETPrintingSample

Batch Printing: How to Print Documents in One Print Job

A typical requirement when printing loads of documents is managing the print jobs. A group of separate documents might be subsumed in a single print job. We just published a new sample in our…


.NETPrintingSample

New Sample: Printing to Different Paper Trays

We just released a new sample for TX Text Control .NET for Windows Forms. This sample shows how to print specific pages of a document to different paper sources of the current printer. The sample…


PrintingSample

New Sample: Printing Watermarks

Thanks to a new feature of TX Text Control 14.0, it is now possible to print watermarks with TX Text Control. It is possible to trap the OnPrintPage event of the PrintDocument to add graphics to…


.NETPrintingSample

Printing into a PrintPreview Control

TX Text Control .NET for Windows Forms implements a print preview dialog that can be easily opened using the PrintPreview method. Sometimes, it is necessary to customize the print preview dialog…


.NETPrintingSample

Printing Without the Status Dialog

The default print controller of .NET displays a status dialog that shows the status of the printing process like this: 'Page 5 of document' If you want to print without such a print status dialog,…