翻譯|使用教程|編輯:李顯亮|2021-08-13 10:03:21.423|閱讀 241 次
概述:我們可以使用 C#以編程方式打印VSDX、DWG、VDW、VSTX等圖表文檔。Aspose.Diagram for .NET API 可以集成到基于 .NET 的應用程序中,以處理 Microsoft Visio 文件。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
我們可以使用 C#以編程方式打印VSDX、DWG、VDW、VSTX等圖表文檔。Aspose.Diagram for .NET API 可以集成到基于 .NET 的應用程序中,以處理 Microsoft Visio 文件。請參考以下用例打印圖表文檔:
我們可以使用Aspose.Diagram for .NET以 VSD、VSDX、DWG 和許多其他支持的文件格式打印 Visio 形狀和圖表。
XpsPrint 類對于在服務器端應用程序上打印圖表文件非常有用,因為服務不支持使用 .NET Framework 打印類。以下步驟解釋了如何使用 C# 以編程方式使用 XpsPrint 打印 Visio 文檔:
以下代碼顯示了如何通過使用 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 圖表文件,例如 VSDX、DWG、VST 等。請按照以下步驟操作:
下面的代碼解釋了如何使用 C# 以編程方式將 Microsoft Diagram 文件打印到默認打印機:
// Load source Visio VSD or VSDX diagram Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); // Call the print method to print whole Diagram using the default printer diagram.Print();
您可以使用以下步驟將包含不同形狀的 Visio 圖表打印到特定打印機:
以下代碼詳細說明了如何在 C# 中將 Diagram 文件打印到特定打印機:
// Load source Visio diagram Diagram 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 job diagram.Print("LaserJet1100", "Test Job");
如果你想試用Aspose的全部完整功能,可聯系在線客服獲取30天臨時授權體驗。
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn