在asp.net应用程序中打印pdf [英] Printing a pdf in an asp.net app

查看:87
本文介绍了在asp.net应用程序中打印pdf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我正在尝试通过asp.net

应用程序以编程方式打印pdf文件。

I已经看到其他帖子提到使用下面的代码或

类似于它在vb.net应用程序中。


Process.Start(" C: \Program Files\Adobe\Acrobat

5.0 \Reader\AcroRd32.exe"," / p

/ h"" C:\\ \\ Program Files \Adobe \Acrobat 5.0 \ Help'\\ENU\ACROBAT.PDF""")


我的问题是我是否可以做同样的事情一个网络应用程序我将

能够在必要时给它打印机名称和确切路径,但是我没有上面的代码或其他示例流程代码可以工作。可以

我只在vb应用程序中打印一个文件吗?


谢谢

Hi,

I am trying to programmatically print a pdf file via an asp.net
application.
I have seen other postings that mention the following code used or
something similar to it in a vb.net app.

Process.Start("C:\Program Files\Adobe\Acrobat
5.0\Reader\AcroRd32.exe", "/p
/h ""C:\Program Files\Adobe\Acrobat 5.0\Help\ENU\ACROBAT.PDF""")

My question is if I can do this same thing in a web app. I will be
able to give it printer names and exact paths if necessary, but I
haven''t got the above code or other example process code to work. Can
I only print a file behind the scenes from within a vb app?

Thanks

推荐答案




感谢您的帖子。现在我想与您分享以下信息:




根据我的经验,我们能够在ASP .NET中执行一个程序通过

使用Diagnostics.Process.Start。另外,我建议您还可以自动化Acrobat,打开pdf文件,然后将其打印在ASP .NET Web

应用程序中。您可能必须安装完整的Acrobat产品才能使
自动化Acrobat。请参考以下代码片段:


// ------------- code snippet ------------- -

Dim acrApp As Object

Dim avDoc As Object

Dim pdDoc As Object

Dim nbrPages As Int16


acrApp = CreateObject(" AcroExch.App")

avDoc = CreateObject(" AcroExch.AVDoc")

avDoc .Open(" c:\t.pdf","")

pdDoc = avDoc.GetPDDoc()

nbrPages = pdDoc.GetNumPages()


''avDoc.PrintPages 0,1,2,False,True

avDoc.PrintPages(0,nbrPages - 1,2,False,True)

pdDoc =没什么

avDoc =没什么

// ------------------结束---------------------


希望这会有所帮助。


此致,


HuangTM

微软在线合作伙伴支持

MCSE / MCSD


安全! - www.microsoft.com/security

是否提供发布?°没有保修,也没有授予任何权利。

Hi,

Thanks for your post. Now I''d like to share the following information with
you:

Based on my experience, we are able to execute a program in ASP .NET by
using Diagnostics.Process.Start. In addition, I suggest that you can also
automate Acrobat, open the pdf file and then print it in your ASP .NET Web
application. You may have to install the full Acrobat produce in order to
automate the Acrobat. Please refer to the following code snippet:

//-------------code snippet--------------
Dim acrApp As Object
Dim avDoc As Object
Dim pdDoc As Object
Dim nbrPages As Int16

acrApp = CreateObject("AcroExch.App")
avDoc = CreateObject("AcroExch.AVDoc")
avDoc.Open("c:\t.pdf", "")
pdDoc = avDoc.GetPDDoc()
nbrPages = pdDoc.GetNumPages()

''avDoc.PrintPages 0, 1, 2, False, True
avDoc.PrintPages(0, nbrPages - 1, 2, False, True)
pdDoc = Nothing
avDoc = Nothing
//------------------end of---------------------

Hope this helps.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! ¨C www.microsoft.com/security
This posting is provided ?°as is?± with no warranties and confers no rights.


嗨Brian,


感谢您的回复。
Hi Brian,

Thanks for your response.
至于下面的AcroExch.App代码,我一直收到错误,而
试图创建一个activex对象即使软管条目在我的
注册表中。

您能告诉我详细的错误消息吗?你有完整的

安装Acrobat产品吗?

我很想让流程方法有效,你有什么建议吗?
As far as the AcroExch.App code below, I kept getting an error while
trying to create an activex object even though hose entries are in my registry.
Would you please tell me the detailed error message? Do you have full
Acrobat product installed?
I would love to get the process method working, do you have any advice?



我需要更多时间来调查这个问题。


祝你有愉快的一天!


问候,

HuangTM

微软在线合作伙伴支持

MCSE / MCSD


安全! - www.microsoft.com/security

发布是吗?°按原样?没有保证,也没有授予任何权利。


I will need more time to investigate this issue.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! ¨C www.microsoft.com/security
This posting is provided ?°as is?± with no warranties and confers no rights.


嗨Brian,


经过进一步研究,我注意到acrobat应用程序可以从

ASP .NET网页启动,但是,它不会打印文件。我会更新你

,结果还有。


祝你有愉快的一天!


问候,

HuangTM

微软在线合作伙伴支持

MCSE / MCSD


安全! - www.microsoft.com/security

发布是吗?°按原样?没有保证,也没有授予任何权利。
Hi Brian,

After further research, I noticed that the acrobat app can be started from
ASP .NET web page, however, it does not print the file. I will update you
with further result.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! ¨C www.microsoft.com/security
This posting is provided ?°as is?± with no warranties and confers no rights.


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

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