在 WPF 控件中查看 PdfSharp 文档
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12851183/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
View PdfSharp document in a WPF control
提问by Hank
I'm using the companion MigraDoc and PdfSharp librariesto generate a report.
我正在使用配套的MigraDoc 和 PdfSharp 库来生成报告。
The PdfSharp documentationrepeatedly refers to WPF and talks about you can "draw on a PDF page as well as in a window", but I can't figure out how to view my PdfDocumentin a viewer. All of the examples just kick the rendering off to another program by opening the documents with Process.Start().
该PdfSharp文档多次提到WPF和你谈判可以“绘制在一个窗口一个PDF页面上还有”,但我无法弄清楚如何查看我PdfDocument的观众。所有的例子都只是通过打开文件来启动另一个程序的渲染Process.Start()。
Do either of these libraries include WPF controls for viewing the documents? Ideally I'm looking for a basic document viewer control, similar to the built-in RichTextEditorviewer for FlowDocuments.
这些库中的任何一个都包含用于查看文档的 WPF 控件吗?理想的情况是我在寻找一个基本的文档查看器控制,类似于内置的RichTextEditor浏览器进行FlowDocuments。
(I'm using the PdfSharp and MigraDoc libraries that are distributed through NuGet.)
(我正在使用通过 NuGet 分发的 PdfSharp 和 MigraDoc 库。)
回答by Dester
You can use WPF PDF Viewer. It wraps the Adobe PDF Reader COM Component as a WPF control
您可以使用WPF PDF 查看器。它将 Adobe PDF Reader COM 组件包装为 WPF 控件
回答by abhishek
PDF Viewer is an ActiveX control which needed to be hosted using WindowsFormHost. If you need a WPF renderer for PDR, Adobe didnt introduced it yet. You need to create it yourself and parse the PDF document.
PDF 查看器是一个需要使用 WindowsFormHost 托管的 ActiveX 控件。如果您需要 PDR 的 WPF 渲染器,Adobe 尚未推出。您需要自己创建并解析PDF文档。
Here are few links which will help you how to host a PDF document on your WPF window :
这里有几个链接可以帮助您如何在 WPF 窗口上托管 PDF 文档:
http://www.codeproject.com/Articles/380019/Using-Adobe-Reader-in-a-WPF-app
http://www.codeproject.com/Articles/380019/Using-Adobe-Reader-in-a-WPF-app
http://hugeonion.com/2009/04/06/displaying-a-pdf-file-within-a-wpf-application/
http://hugeonion.com/2009/04/06/displaying-a-pdf-file-within-a-wpf-application/
Telerik has a PDF Viewer created using WPF which does the rendering of a PDF document using WPF. Its called RADPDFViewer http://blogs.telerik.com/blogs/posts/12-02-29/introducing-pdf-viewer-for-silverlight-wpf.aspx
Telerik 有一个使用 WPF 创建的 PDF 查看器,它使用 WPF 渲染 PDF 文档。它称为 RADPDFViewer http://blogs.telerik.com/blogs/posts/12-02-29/introducing-pdf-viewer-for-silverlight-wpf.aspx
You have to either use one that is shipped by Adobe or you need to create it of your own just like Telerik did.
您必须使用 Adobe 提供的一个,或者您需要像 Telerik 一样自行创建它。

