使用vb在asp.net中打印PDF文件 [英] Printing PDF Files in asp.net using vb

查看:94
本文介绍了使用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


这篇关于使用vb在asp.net中打印PDF文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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