question

SushilAgarwal-8271 avatar image
0 Votes"
SushilAgarwal-8271 asked SushilAgarwal-8271 answered

Printspooler

In an application we sign n print pdf files. At times when number of PDFs sent for print are above 100 or more the printing sequence changes and prints are not in the order it was sent for print how this can be solved

windows-forms
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@SushilAgarwal-8271, how do you print the pdf files? Could you provide the related code?

0 Votes 0 ·

1 Answer

SushilAgarwal-8271 avatar image
0 Votes"
SushilAgarwal-8271 answered
 ProcessStartInfo info = new ProcessStartInfo();
                 info.Verb = "print";
                 info.FileName = pdf2print;
                 //info.CreateNoWindow = false;
                 info.WindowStyle = ProcessWindowStyle.Hidden;
                 //info.UseShellExecute = true;
    
                 Process p = new Process();
                 p.StartInfo = info;
                 //MessageBox.Show("Print Will Start Now");
                 try
                 {
                     p.Start();
                 }
                 catch (Exception ex)
                 {
                     MessageBox.Show(ex.ToString());
                 }
· 7
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.


Does it work if you add p.WaitForExit( ) after p.Start( )?


0 Votes 0 ·

After adding
P.WaitForExit()
It did Not generate any error but the issue of print sequence change for large volume will be observed in coming 2-3 days. Big lot goes for printing in a day once.
Let us watch user feed back
After above mod
But can u explain how do you think this is going to help, I am not getting really how this will help?

0 Votes 0 ·

today evening users reported that due to adding
p.WaitForExit( )
after p.Start()
there priting has become drstically slow for large volume priting of more then 150 pages, for less then 24-40 pages they did not notice any problem but were telling it to be a better option.

one notable thing was there priting sequence was not distubed, but the time it took to complete the printing is not acceptable, so i iwas forrced to re-install the old build with out
p.WaitForExit( )

one more cavet, it was reported 1 hour later that with the old setup also user was complainign slow printing.

i am totally out of any thought what to do to such issues.

can you really guess or advice on such experiances ?


0 Votes 0 ·
Show more comments

@SushilAgarwal-8271, based on your code, I didn't see that the problem about printing sequence changes. The code you provided only print one file. How do you print many files? What is your desired printing sequence? Can you give an example?

0 Votes 0 ·

sir,
its not full code, actually outheside the code there is a loop runnig`

 foreach (string file in oFD.FileNames)
                 {}

`

0 Votes 0 ·

@SushilAgarwal-8271, based on my test, I find that the Viorel-1's suggestion is correct. Please try to use WaitForExit to ensure that keep the correct sequence. Also, I suggest that you could sort your files first, like the following code:

  string[] filename = Directory.GetFiles("D:\\Test").OrderBy(i=>Path.GetFileName(i)).ToArray();// Sort by the file name

 string[] filename = Directory.GetFiles("D:\\Test").OrderBy(i=>File.GetCreationTime(i)).ToArray(); //Sort by the creationtime




0 Votes 0 ·