如何在c#中打印dwg文件

发布于 2024-12-20 12:22:37 字数 85 浏览 6 评论 0原文

我想在我的 c# 项目中以编程方式打印 dwg 文件,而无需打开 AutoCad。我的应用程序是基于网络的,并且我的文件位于共享文件夹中。我不知道该怎么做?

I want to print a dwg file programmatically in my c# project without opening AutoCad.my application is network base and my file is in a shared folder.I do not know how should i do that?

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

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

发布评论

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

评论(2

故事未完 2024-12-27 12:22:37

这有点棘手 -
您可以使用 Microsoft 的 print 命令,与 System.Diagnostics.Process 结合使用:

文件扩展名 DWG 属于 Autocad - 因此,当 Windows 尝试使用“打印”时文件,
它将使用 AutoCad 打印

试试这个:

using System.Diagnostics;

static void printDWGFile(string f)
{
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = "print";
startInfo.Arguments = f;
Process.Start(startInfo);
}

并喊:

printDWGFile("c:/Some-Autocad-File.dwg");

祝你好运!

this is abit tricky -
You can use Microsoft's print command, im combination with System.Diagnostics.Process:

The file extenstion DWG belongs to Autocad - hence when Windows will try to use 'print' with this file,
it will be printed using AutoCad

Try this one:

using System.Diagnostics;

static void printDWGFile(string f)
{
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = "print";
startInfo.Arguments = f;
Process.Start(startInfo);
}

and call:

printDWGFile("c:/Some-Autocad-File.dwg");

good luck!

静水深流 2024-12-27 12:22:37

您需要一个可以读取/渲染 DWG 文件的 .NET 组件,例如 CadLib 。开放设计联盟还有一个带有 .NET 包装器的 C++ 组件:http://opendesign.com/the_oda_platform/teigha_dot_net。

You would need a .NET component that can read/render DWG files, have a look at e.g. CadLib. the Open Design Alliance also have a C++ component with .NET wrappers: http://opendesign.com/the_oda_platform/teigha_dot_net.

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