// load the VSDM in an object of Diagram 
var visio = new Diagram("template.vsdm");
// save VSDM as JPEG 
visio.Save("output.jpeg", SaveFileFormat.JPEG);