This is a migrated thread and some comments may be shown as answers.

How to check that the printing job is completed?

1 Answer 64 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Nisarg
Top achievements
Rank 1
Nisarg asked on 02 Dec 2015, 10:09 AM

Hello,

 We are using  RichTextBox control for Mail merge functionality to implement in our system. Our requirement is to complete the mail merge and print the entire document.

When the print is completed, we would like to know that the printing job is completed successfully for all pages to perform some insert/update operations in the database. We are using the following code to check the printing job is success, but we are not getting the PrintJobInfoCollection results.

 RadDocument _MergedDocument = this.radRichTextBox.MailMerge();
                if (_MergedDocument != null)
                {
                    this.radRichTextBox.Document = _MergedDocument;

                    PrintSettings _PrintSettings = new PrintSettings()
                    {
                        DocumentName = "My document",
                        PrintMode = PrintMode.Native,
                        PrintScaling = PrintScaling.None                        
                    };

                    PrintDialog _PrintDialog = new PrintDialog();
                    _PrintDialog.PageRangeSelection = PageRangeSelection.AllPages;
                    _PrintDialog.UserPageRangeEnabled = true;
                    Nullable<Boolean> print = _PrintDialog.ShowDialog();
                    if (print == true)
                    {                        
                        this.radRichTextBox.Print(_PrintDialog, _PrintSettings);                        
                        PrintJobInfoCollection jobs = _PrintDialog.PrintQueue.GetPrintJobInfoCollection();
                        foreach (PrintSystemJobInfo theJob in jobs)
                        {
                            if (((theJob.JobStatus & PrintJobStatus.Completed) == PrintJobStatus.Completed) || ((theJob.JobStatus & PrintJobStatus.Printed) == PrintJobStatus.Printed))
                            {
                                MessageBox.Show("completed");
                            }
                        }
                    }                    
                }

 

Thanks

 

 

1 Answer, 1 is accepted

Sort by
0
Tanya
Telerik team
answered on 04 Dec 2015, 03:13 PM
Hello Nisarg,

I could suggest you to subscribe to the PrintCompleted event of RadRichTextBox, which is executed when a document is printed. With this you could easily notify the user that the printing has completed and they could continue working with the document.

Hope this helps.

Regards,
Tanya
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
RichTextBox
Asked by
Nisarg
Top achievements
Rank 1
Answers by
Tanya
Telerik team
Share this question
or