在C#中自动打开pdf文件 [英] Open pdf file automatically in C#

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

问题描述

亲爱的朋友们,



我期待在不选择anay文件的情况下自动在单独的窗口中打开pdf文件。该文件与bin\debug保存在同一目录中。



我的代码是:



Dear friends,

I am looking forward to open a pdf file in a separate window automatically without selecting anay file. The file is saved in the same directory as bin\debug.

My code is:

namespace Info
{
    public partial class documentationForm : Form
    {
        public documentationForm()
        {
            InitializeComponent();
        }

        private void documentationForm_Load(object sender, EventArgs e)
        {
            axAcroPDF1.src = openFileDialog.FileName; //("info.pdf");
        }
    }
}





有没有办法手动添加文件名?



问候

AM



is there any way to add the file name manually?

regards
AM

推荐答案

亲爱的会员......你应该看一下链接。你会得到解决方案。



http://www.c-sharpcorner.com/UploadFile/hirendra_singh/how-to-show-pdf-file-in- C-Sharp
Dear member ... u should look once below link. you will get the solution.

http://www.c-sharpcorner.com/UploadFile/hirendra_singh/how-to-show-pdf-file-in-C-Sharp


试试这种方式...



Response.Write();

Response.Write(window.open('../ Inventory / pages / printableads.pdf','_ newtab'););

Response.Write();
try this way...

Response.Write("");
Response.Write("window.open('../Inventory/pages/printableads.pdf', '_newtab');");
Response.Write("");


您可以使用WebBrowser控件通过将文件路径传递给Navigate来加载PDF()



You can use WebBrowser control to load PDF by passing file path to Navigate()

private void OpenPdfInWebBrowser(string filePath)
{
    if (!string.IsNullOrWhiteSpace(filePath))
    {
        yourwebBrowser1.Navigate(@filePath);
    }
}





来源:在Windows应用程序中用C#打开Pdf文档 - Stack Overflow [ ^ ]



祝你好运



Source : open Pdf document in C# in Window application - Stack Overflow[^]

Good luck


这篇关于在C#中自动打开pdf文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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