如何使用 C# 或更好的方式通过 VS.NET Automation 将文件打印到 XpsDocumentWriter?

发布于 2024-10-22 11:37:43 字数 579 浏览 7 评论 0原文

我想要完成的任务(手动方式)

在 VS 2010 中,我的项目项是sequencediagrams,它们实际上只是 .xml 并具有 .sequencediagrams 后缀。所以我在 VS 中打开图表并转到 File->Print 。现在,我不在下拉列表中选择物理打印机,而是将其更改为 Microsoft XPS Document Writer,因为我想要输出 .XPS 文件。

代码中怎么做?

我正在尝试在 C# 代码中执行此操作,特别是在 VS 加载项(自动化)中。所以我拥有的是一个projectinfo的句柄,它给了我文件的完整路径,但我有点迷失在它的打印部分中。我想我可以使用 http://msdn.microsoft。 com/en-us/library/system.windows.xps.xpsdocumentwriter.aspx ,但方法签名似乎没有采用简单的文档路径。

有人有这方面的经验吗?建议?谢谢。

What I am trying to accomplish (the manual way)

In VS 2010, I have project items that are sequencediagrams, they are really just .xml and have a suffix of .sequencediagrams . So I open the diagram in VS and go to File->Print . Now I do not select a physical printer in the dropdown, I change that to Microsoft XPS Document Writer, because I want an outputed .XPS file.

How to do in code ?

I am trying to do this in C# code, specifically in a VS add-in (automation). So what I have is a handle to a projectinfo, which gives me the full path of the file, but I am kind lost in the print part of it. I thought I could use http://msdn.microsoft.com/en-us/library/system.windows.xps.xpsdocumentwriter.aspx , but the method signatures don't seem to take a simple document path.

Anyone have experience in this? suggestions? Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文