如何以编程方式在adobereader中打开PDF [英] How to open PDF in adobereader programmatically

查看:67
本文介绍了如何以编程方式在adobereader中打开PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试过如下,并在本地机器上正常工作。但是,当我主持应用程序时,它不起作用..



..谢谢



我尝试过:



I've tried as below and is working fine in local machine. But when i host the application then it's not working..

..thanks

What I have tried:

private void ReadPdfFile(string FilePath)
   {
       WebClient client = new WebClient();
       Byte[] buffer = client.DownloadData(FilePath);
       Process.Start(FilePath);
   }

ReadPdfFile(DirPath + @"\" + PDFFileName.Trim()); /*Method Call*/

推荐答案

您的代码在服务器上运行,因此pdf在服务器上打开,但是没有人可以看到它,而且很可能你的线程挂起或者抛出错误。它在本地开发时似乎有效,因为客户端和服务器是同一台机器。



要在客户端上显示PDF,只需将其作为PDF文件返回即可。 Googleasp.net将PDF下载到客户端,您将找到示例代码。
Your code is running on the server so the pdf is opening on the server, but no-one is there to see it and more than likely your threads are hanging or are throwing errors. It appeared to work when developing locally because the client and server were the same machine.

To show a PDF on the client you just return it as a PDF file. Google "asp.net download PDF to client" and you'll find sample code.


这篇关于如何以编程方式在adobereader中打开PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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