Convert Visio file to JPG in CSharp Automatically
Posted on 2009-07-09
Hello Experts! I have searched and searched and have yet to find a solution for my problem.
The Scenario: Pulling Visio diagrams out of database via already existing Csharp code that is part of a Windows service. I can get the diagram out and written to a temp file. Now I need to convert it to a jpg programatically.
Using: VS 2008, Visio 2003
I think I should use the Microsoft Interop Drawing Control assembly for Visio to do this; however, in every attempt, I have run into errors from "Class not registered" to must be executed in a singled threaded apartment. It's installed and registered. Can run another app on the same machine that uses the Visio ocx on a windows form (that I created) with no problems. Even tried uninstalling and reinstalling Visio and VS.
I've tried running it in a different thread, creating a console app just to see if I can get it to work, and a host of other things (3 days worth). I suspect that I am having an issue because I am trying to do this "in the background" with no UI.
Does this make any sense to anyone? Suggestions for how to achieve my end result?
Thanks in advance!