简体   繁体   English

在ActiveX对象.NET中查看PDF文件

[英]View PDF files in ActiveX object .NET

I'm using PDFCreator 2.1 COM object to display PDF files inside my Window Form. 我正在使用PDFCreator 2.1 COM对象在Window Form中显示PDF文件。 So far I added the control to Form. 到目前为止,我已将控件添加到Form。 But I can't find a way (method or property) of this object ( AxCPDFActiveDoc ) to open the file. 但是我找不到此对象(AxCPDFActiveDoc)打开文件的方法(方法或属性)。 I know, some time ago, acrobat reader had once in their SDK a object that did that for us. 我知道,不久前,acrobat阅读器在其SDK中曾经有一个对象可以为我们做到这一点。 The property called "src". 该属性称为“ src”。 But in this I cannot find anything related. 但是在此我找不到任何相关的东西。

pdfViewer = new AxCPDFActiveDoc();
pdfViewer.Height = this.Height - this.ficheiroBindingNavigator.Height - this.ficheiroBindingNavigator.Top - 25;
pdfViewer.Top = this.ficheiroBindingNavigator.Height - this.ficheiroBindingNavigator.Top;
pdfViewer.Left = Convert.ToInt32(this.Width * 0.2) - 50;
pdfViewer.Width = Convert.ToInt32(this.Width * 0.5);
this.Controls.Add(pdfViewer);

I have searched here http://docs.pdfforge.org/pdfcreator/latest/en/com-interface/ but nothing really related to ActiveX on Windows Forms. 我在这里http://docs.pdfforge.org/pdfcreator/latest/en/com-interface/搜索过,但没有真正与Windows Forms上的ActiveX相关的内容。

Try another library: pdfium.net sdk for example 尝试其他库:例如pdfium.net sdk

You can install it through nuget Install-package pdfium.net.sdk 您可以通过nuget Install-package pdfium.net.sdk进行安装

Next place the control on form and use somthing like folow: 接下来将控件放在表单上,​​并使用以下类似的东西:

//Open and load a PDF document from a file.
pdfViewer1.LoadDocument(@"c:\test001.pdf");

to show PDF document 显示PDF文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM