在winforms中查看PDF [英] Viewing PDF in winforms

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

问题描述

亲爱的,



我正在构建一个Windows窗体应用程序,人们可以在其中查看PDF(预览)。

我成功地在本地计算机上找到了一个文件,并在PDF查看器控件中进行预览。



我想做什么是:



我的文件位于互联网位置,您可以指向:

http:// localhost: 2323 / Documents / Document.pdf



我知道我可以下载文件,然后将其预览到查看器控件。由于随机文件和要在本地计算机上下载的文件数量以及隐私原因,我想要这样做。



可以有人提出一个想法,如果我能 将文件引用到PDF查看器控件作为上述路径



另外我的另一个问题是:



此PDF查看器控件仅在我将 x86 放入此Windows窗体应用程序的构建选项时才有效。我想要任何CPU。



请帮忙。



谢谢。

$ / b
$ N $ $ $ div $ N $ $ $ div请参阅:

http://www.pdfsharp.com/PDFsharp/ [ ^ ],

http://pdfsharp.codeplex.com/ [ ^ ]。



一些代码示例演示使用此库的PDF查看器和 System.Windows.Forms 可以在Google代码中找到:

http://reactivity.googlecode.com/svn/trunk/1.0/tools/PDF-2-JPEG/PDFsharp/PdfViewer/PdfViewer.Demo/PdfViewer.cs [ ^ ]。



-SA


嗯,一个必须下载以供查看的方式。一个程序不能处理它没有的数据。您在Web浏览器中查看的每个文件(例如图像,视频,文档)都必须首先下载到您的计算机上,唯一的区别是它会暂时存在,当它不再需要时会被删除。



也就是说,你可以做的是让用户安装一个带有IE兼容插件的PDF查看器(他们还没有一个机会),并通过Web浏览器控件显示它,然后将其转发到PDF查看器插件。它对我来说似乎并不优雅,但确实有效。另一种选择是将其下载到一个临时文件中,像往常一样使用它,然后在完成后将其删除。


Dear all,

I am building a windows forms application where people can view PDF (preview).
I am successfully able to locate a file on the local computer and preview this in the PDF viewer control.

What I want to do is:

My file is located on an internet location which you can point to as:
http://localhost:2323/Documents/Document.pdf

I am aware that I can download the file and then preview it to the viewer control. I do not want to do this due to random files and number of files to be downloaded on local computer and for privacy reasons.

Can anyone suggest an idea that if I can reference the document to the PDF viewer control as the above path?

Also my other other question is:

This PDF viewer control works only if I put x86 in the build options for this windows forms application. I want it for any CPU.

Please help.

Thanks.

Regards,
Nayan

解决方案

I found that this is possible with PdfSharp. Please see:
http://www.pdfsharp.com/PDFsharp/[^],
http://pdfsharp.codeplex.com/[^].

Some code sample demonstrating a PDF viewer using this library and System.Windows.Forms can be found in Google Code:
http://reactivity.googlecode.com/svn/trunk/1.0/tools/PDF-2-JPEG/PDFsharp/PdfViewer/PdfViewer.Demo/PdfViewer.cs[^].

—SA


Well, one way or another it has to be downloaded to be viewed. A program can''t work with data it doesn''t have. Every file you view in your web browser (e.g. images, video, documents) has to be downloaded to your machine first, the only difference is it goes somewhere temporary where it will be deleted when it''s no longer needed.

That said, what you could do is have the user install a PDF viewer with an IE compatible plug-in (in the off chance they don''t already have one), and display it via a Web Browser control instead, which should forward it to the PDF viewer plug-in. It doesn''t seem very elegant to me, but it does work. The other option is to download it to a temporary file, use it as you normally would, then delete it when you''re done.


这篇关于在winforms中查看PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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