打印PDF文件 [英] Printing a PDF File

查看:402
本文介绍了打印PDF文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我想在我的应用程序中打印一个pdf文件。我怎么能用C#.Net做到这一点。如果有人知道,请帮助我

I want to a print a pdf file in my application. how can I do that  using C#.Net. If anybody knows it please help me

Bijaya

推荐答案

1。在VS.Net中,您可以添加"Adobe PDF Reader"。 com组件
转到工具箱,右键单击并选择"添加/远程项目..."。然后从"自定义"工具箱中选择"Com Components"选项卡,然后选择"Adobe PDF Reader"。然后按OK。现在您可以将该控件拖放到Windows窗体中。
在内部,它会将AcroPDFLib添加到您的解决方案中。然后你可以使用下面的代码,

1. in VS.Net you can add "Adobe PDF Reader" com Component
Go to Tool box, right click and select "Add/Remote items..." and then from the Customize toolbox select Com Components tab and then select "Adobe PDF Reader" and then press OK. Now you can drag/drop that control to your windows form.
Internally it will add AcroPDFLib to your solution. and then you can use the following code,

.axAcroPDF1.src = @"您的pdf文件路径" ;;

                  this.axAcroPDF1.src = @"your pdf file path";

.axAcroPDF1.LoadFile(@"您的pdf文件路径");

                  this.axAcroPDF1.LoadFile(@"your pdf file path");

然后y您可以根据需要使用以下任何一种方法,

< span style ="font-size:10pt; font-family:'Courier New'"> .axAcroPDF1.Print ();

                  this.axAcroPDF1.Print();

.axAcroPDF1.printWithDialog();

                  this.axAcroPDF1.printWithDialog();

this .axAcroPDF1.printAll();

                  this.axAcroPDF1.printAll();

.axAcroPDF1.printAllFit();

                  this.axAcroPDF1.printAllFit();

.axAcroPDF1.printPages(from,to);

                  this.axAcroPDF1.printPages(from, to);

this .axAcroPDF1.printPagesFit(from,to,shrinktofit);

                  this.axAcroPDF1.printPagesFit(from, to, shrinktofit);

.axAcroPDF1.printWithDialog();

                  this.axAcroPDF1.printWithDialog();


2。您可以使用acrobat reader本身在.Net应用程序中执行此操作
http:// aspalliance .com / 514

HTH,


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

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