WPF to PDF

穿精又带淫゛_ 提交于 2019-11-27 13:11:08

问题


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).


回答1:


If you got your WPF visual tree rendered in to XPS then try this XPS to PDF converter NIXPS.




回答2:


To get WPF content into XPS follow the directions found on Feng Yuan's blog:

http://blogs.msdn.com/fyuan/archive/2007/03/10/convert-xaml-flow-document-to-xps-with-style-multiple-page-page-size-header-margin.aspx




回答3:


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




回答4:


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.



来源:https://stackoverflow.com/questions/123947/wpf-to-pdf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!