Show print progress

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF PrintManager for .NET (v4)  /  Re: Show print progress

DynamicPDF PrintManager for .NET (v4) Forum

 Apr 28 2023 9:51 AM

I want to show the progress of the printing operation to the user with a progress bar and a label, like many PDF reader programs.
For example, page 1 of 50 is being printed.
How can I get the number of the page that has just started to be printed?
 Apr 28 2023 4:18 PM
Posted by a ceTe Software moderator
Hi ,

You can achieve your requirement by using Updated event of PrintJob object.

Here is a code sample:

    private static void Job_Updated(object sender, PrintJobEventArgs e)
        PrintJobStatus jobStatus= e.PrintJob.Status;
        int printedPage = e.PrintJob.PagesPrinted;
        if (jobStatus.ToString() == "Printing")
            Console.WriteLine("Printing " + printedPage + " of " + e.PrintJob.Pages.Count);
        if (jobStatus.ToString()== "Printed")
            Console.WriteLine("Printed " + printedPage + " of " + e.PrintJob.Pages.Count);

ceTe Software Support Team
 Apr 29 2023 5:49 AM
<PagesPrinted>  always returns zero...
The result of this line of code:

 Txt1.Text = ("PrintJob Updated: JobId = " & e.PrintJob.JobId & "  PrintStatus = " & e.PrintJob.Status & "  PagesPrinted = " & e.PrintJob.PagesPrinted)

In the update event, it is like this:

PrintJob Updated: JobId = 77  PrintStatus = 256  PagesPrinted = 0

Please advise ...
thank you
 May 01 2023 11:35 AM
Posted by a ceTe Software moderator

The Status code 256 indicates that the print job page is deleted. Please refer to the PrintJobStatus Enum here.

Regarding the PrintJob Update event, firing of the Update event depends on the printer being used. The PrintManager sends the print job to the spooler and monitors the job within the spooler itself. The printer has to return the status of the print job to the spooler and then PrintManager reads this status and fires the Update event accordingly. Some printers return the status for every page printed in which case the PrintJob Update event will fire and notify that a certain page is printed, some printers do not return the status for every page in which case the PrintJob’s Update event will not fire. It is normal for the PrintJob to not fire the update event for every page printed depending on the printer used.

ceTe Software Support Team

All times are US Eastern Standard time. The time now is 6:56 PM.