AnsweredAssumed Answered

How to print a .dwg file in solidworks API?

Question asked by Robert Murrell on Sep 17, 2019

I am trying to develop a .NET application that will print existing .dwg format files using the Solidworks API.


The problem is that I am unclear about how to open the file for printing. I have tried locating the file using an OpenFileDialog control, and then printing the file using IPrintManager, as below:


    IPrintManager iPrint;


    if (openFileDialog1.ShowDialog() == DialogResult.OK)
        var filePath = openFileDialog1.FileName;

        iPrint.PrintOut(1, filePath);



...but this just throws an "Object reference not set" error.


I only want to take an existing file and send it to the printer. How can I do this?



On further review, I see what a dumb question this is. The examples under IPrintManager in the API help spell out what I'm trying to do.