尝试打印PDF文档时,Adobe Reader和FoxIt Reader都出现问题。这两个问题是不同的,但解决任何一个问题将允许我解决我的问题。VB.Net使用FoxIt Reader或Adobe Reader打印PDF
尝试使用以下代码进行打印时,Adobe Reader遇到的问题是它不会将其打印到我指定的网络打印机,而只是默认的打印机。
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文件位于服务器上,所以我试图用通过网络路径的共享打印机和PDF(\\ SERVER \文件。 PDF)。