使用C#的WinForms中的PDF组件 [英] PDF component in WinForms using C#

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

问题描述

我们如何使用WinForms以C#语言显示PDF文件.
谢谢

How can we display a PDF file using WinForms in C# language.
Thanks

推荐答案

如果您只想在表单上显示pdf文件,则可以使用Acrobat-Reader ActiveX控件.

1.如果安装了acrobat Reader,只需通过VS工具箱添加对Pdf控件的引用(选择elements/COM/Adob​​e PDF Reader).
2.将控件放在窗体上(对AcroPDFLibAxAcroPDFLib的引用已添加到您的项目中)
3.将src属性设置为pdf文件路径:
If you just want to display a pdf-file on a form you can use the Acrobat-Reader ActiveX Control.

1. If you have acrobat reader installed just add a reference to the Pdf control via the VS toolbox (choose elements/COM/Adobe PDF Reader).
2. Place the Control on a Form (references to AcroPDFLib and AxAcroPDFLib are added to you project)
3. Set the src property to a pdf-file path:
axAcroPDF1.src = @"C:\mypdf.pdf";



但是请考虑对acrobat阅读器(目标系统)的依赖性.而且这仅在您不必编辑pdf(afaik)的情况下有效.



But think about the dependency to acrobat reader (target system). And this only works if you dont have to edit the pdf (afaik)


感谢您的帮助,但我正是出于自己的意愿得到了解决方案.


私有void Form1_Load(对象发送者,EventArgs e)
{
axAcroPDF1.LoadFile(@"C:\ Users \ ATOMIC \ Documents \ code_chap_1.pdf");

}
Thanks for your help,but i got the solution myself for exactly what I want.


private void Form1_Load(object sender, EventArgs e)
{
axAcroPDF1.LoadFile(@"C:\Users\ATOMIC\Documents\code_chap_1.pdf");

}


感谢您的帮助,但我正是出于自己的意愿得到了解决方案.

私有void Form1_Load(对象发送者,EventArgs e)
{
axAcroPDF1.LoadFile(@"C:\ Users \ ATOMIC \ Documents \ code_chap_1.pdf");

}
不要忘记在我首先忘记的事件选项卡属性中检查加载表单事件.
再次感谢.
Thanks for your help,but I got the solution myself for exactly what I want.

private void Form1_Load(object sender, EventArgs e)
{
axAcroPDF1.LoadFile(@"C:\Users\ATOMIC\Documents\code_chap_1.pdf");

}
Don''t forget to chek the load form event in the event tab properties which I forgot in the first place.
Thanks again.


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

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