当我试图打印一个PDF文档时,Adobe和FoxIt阅读器都有问题。这两个问题是不同的,但解决任何一个将允许我解决我的问题。
当我尝试使用以下代码打印时,Adobe的问题是它不会将它打印到我指定的网络打印机,而只是默认的打印机。
Dim AdobeReader As New Process
AdobeReader.StartInfo.CreateNoWindow = False
AdobeReader.StartInfo.Verb = "print"
AdobeReader.StartInfo.FileName = SQLdr("DocumentName") & ".pdf"
Select Case SQLdr("Priority")
Case 1
AdobeReader.StartInfo.Arguments = String.Format("/t {0} {1}", SQLdr("DocumentName") & ".pdf", printPriority1)
Case 2
AdobeReader.StartInfo.Arguments = String.Format("/t {0} {1}", SQLdr("DocumentName") & ".pdf", printPriority2)
Case 3
AdobeReader.StartInfo.Arguments = String.Format("/t {0} {1}", SQLdr("DocumentName") & ".pdf", printPriority3)
Case 4
AdobeReader.StartInfo.Arguments = String.Format("/t {0} {1}", SQLdr("DocumentName") & ".pdf", printPriority4)
Case 5
AdobeReader.StartInfo.Arguments = String.Format("/t {0} {1}", SQLdr("DocumentName") & ".pdf", printPriority5)
End Select
AdobeReader.Start()
AdobeReader.WaitForExit(10000)
AdobeReader.Close()我也尝试了上面的代码与双引号围绕文件名称和打印机名称。
FoxIt的问题是,当我尝试用下面的代码打印时,它将在FoxItReader.Start上抛出“没有应用程序与此操作的指定文件相关联”这个错误。
Dim FoxItReader As New Process
FoxItReader.StartInfo.CreateNoWindow = False
FoxItReader.StartInfo.Verb = "print"
FoxItReader.StartInfo.FileName = "C:\Program Files\Foxit Software\Foxit Reader\Foxit Reader.exe"
Select Case SQLdr("Priority")
Case 1
FoxItReader.StartInfo.Arguments = String.Format("/t {0} {1}", SQLdr("DocumentName") & ".pdf", printPriority1)
Case 2
FoxItReader.StartInfo.Arguments = String.Format("/t {0} {1}", SQLdr("DocumentName") & ".pdf", printPriority2)
Case 3
FoxItReader.StartInfo.Arguments = String.Format("/t {0} {1}", SQLdr("DocumentName") & ".pdf", printPriority3)
Case 4
FoxItReader.StartInfo.Arguments = String.Format("/t {0} {1}", SQLdr("DocumentName") & ".pdf", printPriority4)
Case 5
FoxItReader.StartInfo.Arguments = String.Format("/t {0} {1}", SQLdr("DocumentName") & ".pdf", printPriority5)
End Select
FoxItReader.Start()
FoxItReader.WaitForExit(10000)
FoxItReader.Close()在上面的代码中,我也尝试过在变量周围使用双引号,但这也不起作用。
如果能在这个问题上提供任何帮助,我们将不胜感激。
编辑
另外,我忘了说打印机和PDF文件都位于服务器上,所以我尝试通过网络路径(\SERVER\FILE.PDF)使用共享打印机和PDF。
发布于 2012-02-28 02:00:57
我建议看看他们在PDFsharp中使用Adobe / Acrobat打印:http://pdfsharp.codeplex.com/SourceControl/changeset/view/51421#707803做什么
我相信他们在评论中找到了解决默认打印机问题的方法:
// AcroRd32.exe /t path printername drivername portname Executes the reader and prints a file
// while suppressing the Acrobat print
// dialog box, then terminating the Reader.
//
// The four parameters of the /t option evaluate to strings.
// printername The name of the Printer.
// drivername Your printer drivers name i.e. whatever apperars in the Driver Used box when viewing printer properties.
// portname The printers port. portname cannot contain any "/" characters; if it does, output is routed to
// the default port for that printer.https://stackoverflow.com/questions/9475212
复制相似问题