View PdfSharp document in a WPF control - wpf

I'm using the companion MigraDoc and PdfSharp libraries to generate a report.
The PdfSharp documentation repeatedly 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 PdfDocument in a viewer. All of the examples just kick the rendering off to another program by opening the documents with 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 RichTextEditor viewer for FlowDocuments.
(I'm using the PdfSharp and MigraDoc libraries that are distributed through NuGet.)

You can use WPF PDF Viewer. It wraps the Adobe PDF Reader COM Component as a WPF control

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.
Here are few links which will help you how to host a PDF document on your WPF window :
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/
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
You have to either use one that is shipped by Adobe or you need to create it of your own just like Telerik did.

Related

How to annotate a PDF document in WPF

First I need to show a PDF File in an WPF application . It appears the only two ways are using a web control or some sort of WinForms/Com based solution using the Acrobat reader component.
Assuming I get it to show up in a UI my problem is I want to add annotations to the PDF itself. Is this even possible.

Custom window for CHM help project

We're developing in WPF and are using custom borderless windows like the new Office 2013 windows. Now we are creating CHM help using RoboHelp.
I'd like to know if there's a way to launch a CHM file, but somehow hook into it so that it loads in a custom window that I specify, rather than the default window. Even better would be some kind of CHM display control that could be embedded in a WPF window, analogous to the way you can embed an HTML browser control in a WPF window. That way I could compile the CHM content with RoboHelp, but display it in our own custom borderless window that's part of our application.
CHM is no longer supported by MS since Vista, so you might want to consider using RoboHelp to generate Webhelp instead, and display that in a browser control as you described. Webhelp also supports context sensitivity via the URL, if that is needed.

WPF - view and RDLC report file

I have an extensive WPF application and I now want to incorporate some reports. I understand how to create the reports with RDLC but what about viewing them? Ideally, I'd like to use the DocumentViewer but I don't think that's one of the supported file types. Some articles have suggested using the ReportViewer, but I do not have that as a control in my IDE (VS Pro 2008).
Is there a way to "convert" RDLC to XPS and then use the DocumentViewer or what is the best way for a WPF application to view an RDLC report?
The MicrosoftReportViewer control is a Windows Forms control. You can use the WindowsFormsHost control to "host" the report viewer control in WPF, as documented here.
Take a look at the Open-Source .NET WPF Reporting Engine on codeplex

Another way to display an XPS document using WPF

I would like to ask if there are any other alternatives, aside from DocumentViewer, for displaying an XPS document in a WPF application? A ready-to-use control or class in .NET if possible.
This is because DocumentViewer is a little slow when you are scrolling through the pages.
Thanks!
No, unless there are any third-party controls that I'm unaware of.
Use NiXPS to convert your XPS document to PDF and use any PDF viewer for WPF out there. This way you will get better performance than you do with DocumentViewer.

Convert WPF to PDF

I have a WPF application and I want to be able to save the output of the application to a PDF document, the item I want to save can be a Visual a Drawing or a FixedDocument (I can create it as any of those options, and it's easy to convert between them).
Is there any library that can convert directly from WPF to PDF (without writing code to walk the visual tree and recreate it using PDF primitives).
If you got your WPF visual tree rendered in to XPS then try this XPS to PDF converter NIXPS.
For this sceneario I recommend using XpsDocumentWriter class to get a XPS document, then converting it to PDF using Amyuni PDF Creator
Disclaimer: I work for Amyuni Technologies
We have just released a new library that facilitates this: NiPDF v1.0
Here is a link to an example on our site that converts WPF to PDF.
It is a 100% managed .NET assembly, and you don't need to learn an arcane API top be able to use it.

Resources