TX Text Control Blog

Printing without the status dialog

Blogged by Björn Meyer on February 7, 2007 and tagged with printing, samples, .net, suppress printing now.

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, you will need to use the StandardPrintController instead of the default PrintControllerWithStatusDialog. The StandardPrintController is part of the System.Drawing.Printing namespace. The following code prints the content of TX Text Control without such print status dialog:

PrintDocument printDoc = new PrintDocument(); PrintController printCtl = new StandardPrintController(); printDoc.PrintController = printCtl; textControl1.Print(printDoc);

Feel free to contact me, if you have any questions or would like to discuss further printing possibilities of TX Text Control.

 
 
User Contributed Note

User Contributed Note by Justinon October 12, 2007 at 9:09:55 AM CEST

Can this be achieved in vb.net?? Can you provide the code.
User Contributed Note

User Contributed Note by Davidon January 3, 2008 at 3:56:36 PM CET

I have problem with printing WITHOUT showing the txtextcontrol (tables in document are "broken"). If I show control (and content) before printing, document print just fine. Sample: private void Print() { TxTextControl ctrl = new TxTextControl(); ctrl.Load(@"c:\test.rtf", StreamType.RichTextFormat); ctrl.Print("test"); //or with PrintDocument() } I also tray to set control page margin with LoadSettings.Margins and also don't work. (Tables has fixed size.) Can anyone help. David
User Contributed Note

User Contributed Note by Björn Meyer on January 3, 2008 at 5:09:45 PM CET

Hello David It is not possible to use the TextControl class without being visible on a form. In this case, you need to use the ServerTextControl class that can be initialized invisible without a form.
User Contributed Note

User Contributed Note by Kevon Ward on December 16, 2008 at 5:19:42 PM CET

is it possible to override the printcontroller in such a way that a progressbar could be displayed to the user regarding running print progress? thanks