PrintJob status

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF PrintManager for .NET (v1)  /  PrintJob status

DynamicPDF PrintManager for .NET (v1) Forum

 Dec 15 2011 1:55 PM
When I submitt a PDF file for printing, I check for the printjob status to verify if the file printed OK and then move the file to a either a success or fail backup folder. For some reason the status always says "spooling" and does not change even if I wait a long period of time and the file has completed printing. The issue is that trying to move the PDF file while the status is in "spooling" throw and Access Deny exception. Has anybody experienced this issue and what is causing it? any solution? I must add that the print application, printer and print server are located on remote sites in a network.
 Dec 15 2011 5:01 PM
Posted by a ceTe Software moderator
Hello,

When you say the that the status is always “spooling” are you talking about the status of the print job that is displayed in the print queue when the job is printing or the PrintJob.Status property returned by the PrintManager?

In either case do you still see the print job spooling in the print queue even after the jobs has completed printing?

Thanks,
ceTe Software Support Team.
 Dec 15 2011 6:24 PM
Thanks for your reply.

I am talking about the PrintJob.Status propertie returned by the PrintManager.
I have actually tested with a local printer using PDFCreator as the printer and the code snipet below and I was able this time to see
the PrintJob.Status change to "Printing" and then "Complete", but the input PDF file is still not released
by the print manager and it cannot be renamed or moved after it is printed. The only way to release it is to stop the print service (the application).
I even tried to force the print job to release its resources by calling the Dispose() method, but with no luck.
By the way, I tested with the latest Build of the PrintManager that I downloaded today, but the results are the same.

Any assistance to resolve this issue is much appreciated


C# Test code:

public bool PrintPdf(string strFile)
        {
            bool blnReturn = true;
            PrintJob prntJob = null;

            try
            {
                InputPdf inPdf = new InputPdf(strFile);
                prntJob = new PrintJob(PrinterQueue, inPdf);

                SetPrintJobOptions(prntJob, strFile);

                prntJob.Print();

                // Wait for job to complete
                int intTimeOut = 0;
                while (intTimeOut < ConfigTimeOut * 1000)
                {
                    if (prntJob.Status == ceTe.DynamicPDF.Printing.PrintJobStatus.Complete || prntJob.Status == ceTe.DynamicPDF.Printing.PrintJobStatus.Printed)
                    {
                        blnReturn = true;
                        break;
                    }

                    intTimeOut += 100;
                    Thread.Sleep(100);
                }

            }

            catch (Exception ex)
            {
                // Handle exception
                ....
            }

            // Release Printjob resources
            // Try to explicitly free the job resources (No change)
            prntJob.Dispose();

            return blnReturn;
        }
 Dec 16 2011 6:02 AM
Posted by a ceTe Software moderator
Hello,

You can release the PDF file once you send the document for printing using Print method PrintJob class. You will need to use the Dispose method of InputPdf class to do this. Please use the below line of code and this will work for you.

//Dispose the InputPdf object and this will release the input PDF file.
inPdf.Dispose();

Thanks,
ceTe Software Support Team.
 Dec 17 2011 1:54 PM
Hi,
using the code as you suggested has the problem. Thanks for your assistance.
 Dec 17 2011 1:57 PM
Hi,
Sorry I meant the Dispose method of the InputPdf object has solved the problem.

Thanks again

All times are US Eastern Standard time. The time now is 11:48 PM.