开发者

PDF Printing happens in random order

I am using Foxit Reader (a PDF Reader) and passing command line arguments to print a pdf pro-grammatically. I understand that we cannot specify the number of copies through command line as from this discussion.

I am developing a win-forms desktop application and for printing multiple copies of PDF document I am using the below code

string foxitReaderInstalledPath = GetFoxitReaderInstalledPath();
while (noOfCopies > 0)
{
Process process = new System.Diagnostics.Process();
process.EnableRaisingEvents = false;
process.StartInfo.CreateNoWindow = true;
process.StartInfo.FileName = foxitReaderInstalledPath;
string arguments = String.Format(@"-t ""{0}"" ""{1}""", this.Path, printerName);
process.StartInfo.Arguments = arguments;
process.Start();
process.WaitForExit();
noOfCopies = noOfCopies - 1;
}

Issue happens when multiple users are giving muliple copies of print to the same printer. The issue is the printed documents gets mixed up in the order in which they get printed. Anyone please let me know how I can a开发者_JAVA百科void this issue?

Many thanks.


You can't avoid this client-side...

IF you really want to avoid it the "client" app which is used by the users has to just send the file to some "centralized server process" with all relevant params... this "centralized process" can then "serialize" the printing so it occurs in correct order...

BUT if the printer you are printing to is accessible from the users systems then it could still happen that a user sends something to the printer (like an image or word document...) which will be printed and disturbing the order a bit...

I think it would make much more sense if you described what your goal is... perhaps there is some better way to solve all this... are you implementing a print server ?

EDIT - as per comment:

Put the location for the PDF files on a network share... and run your printing code on the same machine which provides the share... ideally the printer is directly connected to that machine... this should provide enough performance and since it is only one central application accessing the printer it should work fine...

I would strongly recommend the use of a PDF library or Acrobat reader so that the printing can use a parameter for NumberOfCopies !

EDIT 2 - as per comment:

Some PDF Libraries:

  • .NET library to print PDF files
  • http://www.gnostice.com/PDFOne_dot_NET.asp
  • http://www.gdpicture.com/products/dotnet/plugins/pdf-plugin.php
  • http://itextpdf.com/
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜