Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to print dwg file in c#

Tags:

c#

winforms

dwg

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?

like image 436
M_Mogharrabi Avatar asked Dec 10 '25 19:12

M_Mogharrabi


1 Answers

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!

like image 102
Shai Avatar answered Dec 13 '25 08:12

Shai