使用vb在asp.net中打印PDF文件

使用vb在asp.net中打印PDF文件

问题描述:

Hye ..

我正在使用此代码在按钮上启用打印功能.

Hye..

I am using this code to enable print function on a button.

Protected Sub PrintBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles PrintBtn.Click
       Dim psiPrint As New System.Diagnostics.ProcessStartInfo()
       psiPrint.Verb = "print"
       psiPrint.WindowStyle = ProcessWindowStyle.Hidden
       psiPrint.FileName = "Form.pdf"
       psiPrint.UseShellExecute = True
       System.Diagnostics.Process.Start(psiPrint)
   End Sub



出现错误,指出



Error occurred stating that

The system cannot find the file specified


System.Diagnostics.Process.Start(psiPrint)



我该如何解决?
我的Form.pdf位于文件夹Form



How can I solve this?
My Form.pdf is located in a folder Form

中,指定要处理的文件的相对或绝对路径.
例如:
Specify the relative or absolute path of the file to be processed.
For example:
psiPrint.FileName = "C:\\Form\\Form.pdf"


我已经解决了.无论如何,谢谢您的时间.

I have solved it. Thanks for your time anyway.

Protected Sub PrintBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles PrintBtn.Click
       Dim psiPrint As New System.Diagnostics.ProcessStartInfo()
       psiPrint.Verb = "print"
       psiPrint.WindowStyle = ProcessWindowStyle.Hidden
       psiPrint.FileName = Server.MapPath("~\Form\Form.pdf")
       psiPrint.UseShellExecute = True
       System.Diagnostics.Process.Start(psiPrint)
   End Sub