Hi everyone,
I have a problem with Arcobjects SDK C#. I want to export a MXD to PDF, AI and PNG.
The PDF and AI Export works fine but not the PNG Export.
When I export to PNG, I have this error : Exception de HRESULT : 0x80040334
My call :
IMapDocument pMapDoc = new MapDocument();
pMapDoc.Open(folderFileMXD + nameFile + ".mxd");
IActiveView m_ActiveView = pMapDoc.ActiveView;
ExportActiveViewParameterized(nameFile, m_ActiveView, 300, 1, "PNG", folderFilePNG, false);
My function :
private static void ExportActiveViewParameterized(string fileName, IActiveView docActiveView, int iOutputResolution, int lResampleRatio, string ExportType, string sOutputDir, Boolean bClipToGraphicsExtent)
{
try
{
IExport docExport;
IPrintAndExport docPrintExport;
IOutputRasterSettings RasterSettings;
// The Export*Class() type initializes a new export class of the desired type.
if (ExportType == "PDF")
{
docExport = new ExportPDFClass();
}
else if (ExportType == "AI")
{
docExport = new ExportAIClass();
}
else if (ExportType == "PNG")
{
docExport = new ExportPNGClass();
}
else
{
ExportType = "EMF";
docExport = new ExportEMFClass();
}
docPrintExport = new PrintAndExportClass();
docExport.ExportFileName = sOutputDir + fileName + "." + docExport.Filter.Split('.')[1].Split('|')[0].Split(')')[0];
//// check if export is vector or raster
if (docExport is IOutputRasterSettings)
{
// for vector formats, assign the desired ResampleRatio to control drawing of raster layers at export time
RasterSettings = (IOutputRasterSettings)docExport;
RasterSettings.ResampleRatio = (int)lResampleRatio;
}
docPrintExport.Export(docActiveView, docExport, 300, bClipToGraphicsExtent, null);
}
catch (Exception e)
{
Log.Error("FAILURE");
Log.Error(e.Message);
Log.Error(e.StackTrace);
}
}
Do you have an idea of the problem ?
Thanks in advance