Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/313.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# ect解决方案_C#_Winforms_Pdf - Fatal编程技术网

C# ect解决方案

C# ect解决方案,c#,winforms,pdf,C#,Winforms,Pdf,用VB编写,依赖大量(部分商业化,如果您的解决方案是商业化的)库 PdfiumViewer 非常好,也可以通过NuGet获得 The PdfiumViewer library primarily consists out of three components: •The PdfViewer control. This control provides a host for the PdfRenderer control and has a default toolbar with l

用VB编写,依赖大量(部分商业化,如果您的解决方案是商业化的)库

PdfiumViewer

非常好,也可以通过NuGet获得

The PdfiumViewer library primarily consists out of three components:
•The  PdfViewer  control. This control provides a host for the  PdfRenderer  control and has a default toolbar with limited functionality;
•The  PdfRenderer  control. This control implements the raw PDF renderer. This control displays a PDF document, provides zooming and scrolling functionality and exposes methods to perform more advanced actions;
•The  PdfDocument  class provides access to the PDF document and wraps the Pdfium library.
它是一个用于显示的一体化解决方案,并附带了更友好的Apache 2.0许可证

编辑,添加示例代码,为方便起见:)我包括以下内容

data = File.ReadAllBytes(@"C:\temp\abc.pdf");
PdfiumViewer.PdfDocument doc;
using (Stream stream = new MemoryStream(data))
{
    doc = PdfiumViewer.PdfDocument.Load(stream);
    var viewer = new PdfiumViewer.PdfViewer();
    viewer.Document = doc;
    var form = new System.Windows.Forms.Form();
    form.Size = new Size(600, 800);
    viewer.Dock = System.Windows.Forms.DockStyle.Fill;
    form.Controls.Add(viewer);
    form.ShowDialog();
}


这会动态生成一个表单,当然您也可以使用设计器。

hmmmmm。。。。我同意你的观点,我不能期望用户安装pdf阅读器,但我只是一个学习者,所以这个简单的“计算器实用程序”预计不会被广泛应用。我只是在学习编码。。。。我也刚刚安装了Microsoft help file creator,但我无法轻松使用它。它要求html文件(输入)。我想我需要仔细查看这个帮助文件创建者中的所有内容。为什么不将pdf作为一个单独的文件呢?Bcoz如果你将“分发”作为联合文件,那么开发一个实用程序就不应该是零碎的。只是exe文件(无需安装)就可以完美地作为一个简单的“计算器”工作,我认为提供文件片段并不是一个好的做法。如果我错了,你可以纠正我。我同意过程方法工作得很好。Process.Start(“C:\\Documents and Settings\\gsv\\Desktop\\manual.pdf”);但正如我所说。。。在这种情况下,我将需要提供一个单独的pdf文件与这个计算器。exe是否有可能嵌入到exe本身的文件???即使没有安装Adobe reader,我认为我们可以处理这个案件与尝试{}捕捉{}的事情,弹出一条消息,以防读者不在那里。别担心。我唯一想知道的是“嵌入”的用法将一个文件导入exe并显示,但不将其作为单独的文件提供给用户的硬盘。如果用户选择使用第三方控件读取pdf文档,这不是很好。@Ian您是否建议WinForms Calculator应用程序从同一台计算机上的IE继承配置?我希望不是。如果Adobe Reader ActiveX控件与“注册免费com”一起工作,或者用户需要安装它吗?@Winsten,不,但它不应该更改IE/Firefox设置要使用的PDF阅读器,安装应用程序时安装Adober Reader可能会更改各种设置(了解Adobe!)@温斯顿史密斯我在哪里可以找到这两个DLL??我没有在COM选项卡中找到它们,也没有在Adobe文件夹中找到它们?!有什么建议吗?如果你的用户喜欢Firefox,那就不太好;-)@温斯顿,由于WebBroser控件没有IE工具栏,如果你禁用右键菜单,大多数用户将无法分辨它是IE。这听起来很简单。。。。。。那你是怎么做到的?我认为要实现这一点,我需要将文件与应用程序捆绑在一起。然后在“按钮单击”事件中,应用程序(.exe)应检查>>>是否(File.Exists(“user manual.pdf”)//然后显示else//将pdf提取到同一目录//然后将其显示在浏览器中。我知道“添加现有项目作为参考,但如何通过C#code将其复制到输出目录?我同意Process方法工作正常。Process.Start(“C:\\Documents and Settings\\gsv\\Desktop\\manual.pdf”);但正如我所说的…在这种情况下,我需要提供一个单独的pdf文件与此calculator.exe!!!!是否可以将该文件嵌入exe本身???然后单击“按钮”“事件应用程序可以将pdf提取到同一文件夹中,然后显示它吗?”?如何将文件解压缩到同一用户的目录中?啊,是的,这是可能的。但由于我不能让它正常工作,我不推荐它;您缺少了使其正常工作的几个关键步骤。您好,虽然这可能很好地回答了这个问题,但请注意,其他用户可能没有您的知识渊博。你为什么不加一点解释,解释一下这段代码的工作原理呢?谢谢谢谢你的回复。
AxAcroPDF1.LoadFile("C:ShippingForm.pdf")
AxAcroPDF1.src = "C:ShippingForm.pdf"
AxAcroPDF1.setShowToolbar(False)
AxAcroPDF1.setView("fitH")
AxAcroPDF1.setLayoutMode("SinglePage")
AxAcroPDF1.setShowScrollbars(False)
AxAcroPDF1.Show()
WebBrowser1.Navigate("SomePDF.pdf");
using System.IO;
    private void pictureBox2_Click(object sender, EventArgs e)
    {
        //get current folderpath of the .exe
        string ProgramPath = AppDomain.CurrentDomain.BaseDirectory;
        //jump back relative to the .exe-Path to the Resources Path
        string FileName = string.Format("{0}Resources\\Master_Thesis_Expose.pdf", Path.GetFullPath(Path.Combine(ProgramPath, @"..\..\")));

        //Open PDF
        System.Diagnostics.Process.Start(@"" + FileName + "");

    }
The PdfiumViewer library primarily consists out of three components:
•The  PdfViewer  control. This control provides a host for the  PdfRenderer  control and has a default toolbar with limited functionality;
•The  PdfRenderer  control. This control implements the raw PDF renderer. This control displays a PDF document, provides zooming and scrolling functionality and exposes methods to perform more advanced actions;
•The  PdfDocument  class provides access to the PDF document and wraps the Pdfium library.
data = File.ReadAllBytes(@"C:\temp\abc.pdf");
PdfiumViewer.PdfDocument doc;
using (Stream stream = new MemoryStream(data))
{
    doc = PdfiumViewer.PdfDocument.Load(stream);
    var viewer = new PdfiumViewer.PdfViewer();
    viewer.Document = doc;
    var form = new System.Windows.Forms.Form();
    form.Size = new Size(600, 800);
    viewer.Dock = System.Windows.Forms.DockStyle.Fill;
    form.Controls.Add(viewer);
    form.ShowDialog();
}