将FlowDocument转换为PDF的最佳方法是什么 [英] What's the best way to convert a FlowDocument into PDF

查看:427
本文介绍了将FlowDocument转换为PDF的最佳方法是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您将如何建议我将FlowDocument转换为PDF以附加到电子邮件?

How would ya'll recommend that I convert a FlowDocument to PDF to be attached to an EMail?

FlowDocument是动态的,而不是静态的.

The FlowDocument is dynamic, not static.

我希望能够将PDF作为字节[]存储在内存中,而不是存储在磁盘上,但这是可以商量的.

I would prefer to be able to store the PDF in memory as a byte[], rather than on disk, but that is negotiable.

感谢您的帮助!

推荐答案

您知道我有两个选择.

第一种方法是使用称为 NiPDF 的专有库,也可以使用Word Interop.

The first is to use a proprietary library called NiPDF, alternatively you can use Word Interop.

  1. 使用打开XML SDK 将FlowDocument保存到DOCX文件
  2. 使用Word Interop从某个临时存储区加载保存的文档
  3. WdSaveFormat 设置为wdFormatPDF
  4. 再次保存文档(记住将文件重命名为PDF)
  1. Save the FlowDocument to a DOCX file using Open XML SDK
  2. Use Word Interop to load the saved document from some temporary store
  3. Set the WdSaveFormat to wdFormatPDF
  4. Save the document again (remember to rename the file to PDF)

您可以找到更多信息 查看全文

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