将FlowDocument转换为PDF的最佳方法是什么 [英] What's the best way to convert a FlowDocument into PDF
本文介绍了将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.
- 使用打开XML SDK 将FlowDocument保存到DOCX文件
- 使用Word Interop从某个临时存储区加载保存的文档
- 将 WdSaveFormat 设置为wdFormatPDF
- 再次保存文档(记住将文件重命名为PDF)
- Save the FlowDocument to a DOCX file using Open XML SDK
- Use Word Interop to load the saved document from some temporary store
- Set the WdSaveFormat to wdFormatPDF
- Save the document again (remember to rename the file to PDF)
您可以找到更多信息 查看全文