MS Visio打印示例!使用Aspose在 C# 中打印 Visio 图表文档 VSDX、DWGX、VSTX

我们可以使用 C#以编程方式打印VSDX、DWG、VDW、VSTX等图表文档。Aspose.Diagram for .NET API 可以集成到基于 .NET 的应用程序中,以处理 Microsoft Visio 文件。

我们可以使用 C#以编程方式打印VSDX、DWG、VDW、VSTX等图表文档。Aspose.Diagram for .NET API 可以集成到基于 .NET 的应用程序中,以处理 Microsoft Visio 文件。请参考以下用例打印图表文档:

  • 使用 C# 以编程方式使用 XpsPrint 打印 Visio 文档
  • 在 C# 中以编程方式将 Visio 图表打印到默认打印机
  • 使用 C# 以编程方式将 Visio 图表打印到特定打印机

我们可以使用

MS Visio转换示例!使用Aspose在C#中将 Visio VSD/VSDX 文件转换为图像

使用 C# 以编程方式使用 XpsPrint 打印 Visio 文档

XpsPrint 类对于在服务器端应用程序上打印图表文件非常有用,因为服务不支持使用 .NET Framework 打印类。以下步骤解释了如何使用 C# 以编程方式使用 XpsPrint 打印 Visio 文档:

  • 使用 Aspose.Diagram 将文档转换为 XPS 并将其存储在内存流中。
  • 使用 XpsPrint API 将图表文档发送到打印机。

以下代码显示了如何通过使用 XpsPrint API 将 Visio 文档发送到打印机来打印它:

public static void Print(Diagram diagram, string printerName, string jobName, bool isWait){    if (diagram == null)        throw new ArgumentNullException("document");    // Use Aspose.Diagram to convert the document to XPS and store in a memory stream.    MemoryStream stream = new MemoryStream();    diagram.Save(stream, SaveFileFormat.XPS);    stream.Position = 0;    // Send a Diagram document to a printer using the XpsPrint API    Print(stream, printerName, jobName, isWait);}

在 C# 中以编程方式将 Visio 图表打印到默认打印机

可以使用 C# 以编程方式打印 Visio 图表文件,例如 VSDX、DWG、VST 等。请按照以下步骤操作:

  • 创建Diagram类的实例以加载要打印的图表。
  • 调用不带任何参数或参数的Print方法。

下面的代码解释了如何使用 C# 以编程方式将 Microsoft Diagram 文件打印到默认打印机:

// Load source Visio VSD or VSDX diagramDiagram diagram = new Diagram(dataDir + "Drawing1.vsdx");// Call the print method to print whole Diagram using the default printerdiagram.Print();

使用 C# 以编程方式将 Visio 图表打印到特定打印机

您可以使用以下步骤将包含不同形状的 Visio 图表打印到特定打印机:

  • 使用Diagram类加载输入图表文件
  • 指定打印机名称和作业名称并调用Print()方法。

以下代码详细说明了如何在 C# 中将 Diagram 文件打印到特定打印机:

// Load source Visio diagramDiagram diagram = new Diagram(dataDir + "Drawing1.vsdx");// Call the print method to print whole Diagram using the printer name and set document name in the print jobdiagram.Print("LaserJet1100", "Test Job");

如果你想试用Aspose的全部完整功能,可联系在线客服获取30天临时授权体验。


还想要更多吗可以点击阅读【Aspose最新资源在线文库】查找需要的教程资源。如果您有任何疑问或需求,请随时加入Aspose技术交流群(),我们很高兴为您提供查询和咨询
标签:

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2021年7月10日
下一篇 2021年7月10日

相关推荐

发表回复

登录后才能评论