IMapDocument mapDocument = new MapDocumentClass();
mapDocument.Open("path to my document");
// at this point you might want to navigate to a desired location and scale
ESRI.ArcGIS.Carto.IActiveView activeView = mapDocument.ActiveView;
ESRI.ArcGIS.Geometry.IEnvelope zoomExtent = new ESRI.ArcGIS.Geometry.EnvelopeClass();
//possiblities are for example
//zoomExtent.CenterAt();
//zoomExtent.Expand();
//zoomExtent.PutCoords();
activeView.Extent = zoomExtent;
ESRI.ArcGIS.Output.IExport export = new ESRI.ArcGIS.Output.ExportPNGClass();
System.String pathFileName = "name of export png file";
export.ExportFileName = pathFileName;
// Because we are exporting to a resolution that differs from screen
// resolution, we should assign the two values to variables for use
// in our sizing calculations
System.Int32 screenResolution = 96;
System.Int32 outputResolution = 300;
export.Resolution = outputResolution;
ESRI.ArcGIS.Display.tagRECT exportRECT; // This is a structure
exportRECT.left = 0;
exportRECT.top = 0;
exportRECT.right = activeView.ExportFrame.right * (outputResolution / screenResolution);
exportRECT.bottom = activeView.ExportFrame.bottom * (outputResolution / screenResolution);
// Set up the PixelBounds envelope to match the exportRECT
ESRI.ArcGIS.Geometry.IEnvelope envelope = new ESRI.ArcGIS.Geometry.EnvelopeClass();
envelope.PutCoords(exportRECT.left, exportRECT.top, exportRECT.right, exportRECT.bottom);
export.PixelBounds = envelope;
System.Int32 hDC = export.StartExporting();
activeView.Output(hDC, (System.Int16)export.Resolution, ref exportRECT, null, null); // Explicit Cast and 'ref' keyword needed
export.FinishExporting();
export.Cleanup();
mapDocument.Close();