Here is what I use to export to a BMP. There is also an ExportPDFClass() for line 8 with similar functions.
Uses ESRI.ArcGIS.Output
and VerifyFile merely checks if a file is already there and deletes it if it is. Should be fairly easy to reproduce.
Good Luck
Brent Hoskisson
public static bool ExportActiveView(IMap map, string bmpFile)
{
string pathName = "";
string fileName = "";
if (AOUtilities.VerifyFile(bmpFile, "bmp", out pathName, out fileName))
File.Delete(bmpFile);
IActiveView av = (IActiveView)map;
IExport pExport = new ExportBMPClass();
pExport.ExportFileName = bmpFile;
//pExport.Resolution = 96;
tagRECT eRect = av.ExportFrame;
IEnvelope pPBE = new EnvelopeClass();
pPBE.PutCoords(eRect.left, eRect.top, eRect.right, eRect.bottom);
pExport.PixelBounds = pPBE;
try
{
int hDC = pExport.StartExporting();
av.Output(hDC, Convert.ToInt32(pExport.Resolution), ref eRect, null, null);
pExport.FinishExporting();
return true;
}
catch
{
return false;
}
finally
{
pExport.Cleanup();
}
}