如何批量的Windows打印PDF文档? [英] How does Windows bulk print PDF documents?

查看:280
本文介绍了如何批量的Windows打印PDF文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的机器上,选择多个PDF文档时,在Windows资源管理器,右击并选择的打印的,安装Adobe Acrobat Reader打开最小化,所有文件都悄悄地发送到打印机。

On my machine, when selecting multiple PDF documents in Windows Explorer, right clicking and choosing Print, Adobe Acrobat Reader is opened minimized and all documents are silently sent to the printer.

我想要做的一样的Windows做,但它是怎么做的?

I want to do the same as Windows does, but how is it done?

我使用的ProcessStartInfo PrintTo 动词,因为你可以在之前的问题。不幸的是,这一切,但沉默,我打印多个文档时有很大的问题。我怎么知道,当应用程序(通常是ADOBE READER)完成打印?如果启动连续几个printTo过程中,一个文档似乎以前完成打印前开业。

I am using ProcessStartInfo with the PrintTo verb, as you can see in a previous question. Unfortunately, this is everything but silent, and I am having big problems when printing more than one document. How do I know when the application (typically Adobe Reader) is done printing? If starting several printTo processes in a row, one document seems to open before the previous is finished printing.

我想避免硬编码了Adobe Reader,因为我的一些用户对福昕阅读器或其他人交换吧。

I would like to avoid hard coding Adobe Reader, because some of my users have exchanged it for Foxit Reader or others.

推荐答案

我不知道你是否能与其他PDF浏览器做这样,那些观众的Adobe Reader插件和播放的替代品。你可能有它裁缝要支持的每个程序。这不是那么很难有读者自己的系统上,真的,如果有必要进行的工作,随之而来大多数计算机预装。

I don't know if you can do it with other PDF viewers in such a way that those viewers are plug-and-play replacements for Adobe Reader. You'll probably have to tailor it to each program you want to support. It's not so difficult to have Reader on one's system, really, if it's necessary to perform a job and most computers come with it preinstalled.

您必须首先了解就是当你告诉它通过该动词打印,通过代码或资源管理器右键菜单,你在做这样的事情:

The first thing you have to know is that when you tell it to print via that verb, via either code or the Explorer context menu, you are doing something like this:

""C:\Program Files\Adobe\Reader 10.0\Reader\AcroRd32.exe"" /p /h "%1" 

请注意参数:/ p(告诉它打印)和/ H(启动最小化)

Note the arguments: /p (tells it to print) and /h (start minimized).

有另一种选择。 Adobe开发FAQ(的http://合作伙伴。 adobe.com/public/developer/en/acrobat/sdk/pdf/intro_to_sdk/DeveloperFAQ.pdf )指出,此命令行工作的每个文件:

There's another option. The Adobe Developer FAQ ( http://partners.adobe.com/public/developer/en/acrobat/sdk/pdf/intro_to_sdk/DeveloperFAQ.pdf ) states that this command line works per-file:

AcroRd32.exe /t path "printername" "drivername" "portname"

该文件指定该启动Adobe Reader和打印文件,其路径必须被完全指定,同时抑制打印对话框。 (从开发者FAQ复制粘贴。)

The document specifies that this initiates Adobe Reader and prints a file, whose path must be fully specified, while suppressing the Print dialog box. (Copy-pasted from Developer FAQ.)

此外,还有一个选项/ N其中启动Acrobat或Adobe Reader的一个单独的实例,即使一个当前已打开。 (。开发者FAQ再次)可用于并行运行多个打印作业,我想象

There is also an option /n which "launches a separate instance of Acrobat or Adobe Reader, even if one is currently open." (Developer FAQ again.) That could be used to run multiple print jobs in parallel, I imagine.

我发现又在另一个命令行参考:的Adobe读卡器命令行参考

I found yet another command line reference at: Adobe Reader Command Line Reference

所以基本上,你可以遍历您的PDF的列表,并为每一个启动一个新的印刷工艺具有的Process.Start呼叫并等待它通过Process.WaitForExit关闭。这将使你的程序似乎挂起,我讨厌当程序挂起,而他们执行操作,所以你应该真正做到这一点在报告进展撤销BackgroundWorker的,仍然让你的GUI有所互动。

So basically, you could iterate your list of PDFs, and for each one start a new print process with a Process.Start call and wait for it to close via a Process.WaitForExit. This will make your program appear to hang and I hate when programs hang while they perform operations, so you should really do this in a cancellable BackgroundWorker that reports progress and still leaves your GUI somewhat interactive.

这篇关于如何批量的Windows打印PDF文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆