【问题标题】:Print multiple copies of pdf打印多份pdf
【发布时间】:2011-11-15 01:11:28
【问题描述】:

我目前正在使用以下代码使用 Foxit Reader 软件打印 pdf。现在我的问题是我想打印一个文件的多个副本。谁能让我知道如何在下面的代码中打印 pdf 时指定份数。

[编辑] 我不想使用循环打印多个 pdf 副本。我只想将其指定为命令行参数。

非常感谢任何帮助:)

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();

【问题讨论】:

  • 您查看过 Foxit 命令行参数的文档吗?
  • 好的,谢谢,我现在正在这样做。

标签: c# .net pdf printing


【解决方案1】:

根据 Foxit 手册,除了使用循环(您不想使用)之外,没有其他选项可以执行您想要的操作。

您要么使用一些用于 .NET 的 PDF 库 - 那里有很多免费和商业的库(例如,请参阅 .NET library to print PDF files ) - 或者您使用例如 Acrobat 阅读器进行打印(IIRC 它有一个命令行开关来实现什么你想要)...

【讨论】:

  • 谢谢!!可能我需要寻找替代方案。
【解决方案2】:

把它放在一个循环中。您以后可以随时操纵进程的终止。 将它放在 Arguments 中会很好,但我认为 FoxIt 不支持我所知道的。

int numberOfCopies = 2;
Process process = new System.Diagnostics.Process();

for (int i = 1; i <= numberOfCopies; i++)
    {
            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();
    }

【讨论】:

  • 不,我不想循环运行。因为这将创建多个线轴。如果有多个用户正在打印,这将是一个问题。我想在命令行参数中指定它。
  • 我不确定它是否支持它。 FoxIt 的参数并不太广泛。现在 Adob​​e Reader,你也许可以用它做点什么。您可以在 C# 应用程序中使用嵌入的 PDF 视图,并以这种方式对其进行操作。如果它不在您的应用程序外部,则打印会更容易。
  • 还有一个很好的框架叫做PDFSharp。链接是pdfsharp.com/PDFsharp
  • 福昕阅读器似乎不支持 :( 伤心。
  • 对不起兄弟!如果您喜欢冒险,请查看 PDFsharp
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-09-23
  • 1970-01-01
  • 1970-01-01
  • 2016-05-15
  • 2010-10-20
  • 2013-05-25
  • 1970-01-01
相关资源
最近更新 更多