EPS files use the PostScript page description language to describe vector and raster objects. PostScript is the publishing industry standard for high-end graphics files,
cartography, and printing. EPS files can be edited in many drawing applications or placed as a graphic in most page layout applications.
EPS files support embedding of fonts so that users who do not have Esri Fonts installed can still view the proper symbology.
//This example demonstrates how to export a layout to EPS.
//Added references
using ArcGIS.Desktop.Core; //Project
using ArcGIS.Desktop.Layouts; //Layout classes
using ArcGIS.Desktop.Framework.Threading.Tasks; //QueuedTask
using ArcGIS.Desktop.Mapping; //Export formats
publicclass ExportLayoutToEPSExample
{
publicstatic Task ExportLayoutToEPSAsync(string LayoutName, string Path)
{
//Reference a layoutitem in a project by name
LayoutProjectItem layoutItem = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault(item => item.Name.Equals(LayoutName));
if (layoutItem == null)
return Task.FromResult<Layout>(null);
//Create EPS format with appropriate settings
EPSFormat EPS = new EPSFormat();
EPS.Resolution = 300;
EPS.OutputFileName = Path;
return QueuedTask.Run(() =>
{
//Export Layout
Layout lyt = layoutItem.GetLayout(); //Loads and returns the layout associated with a LayoutItem
if (EPS.ValidateOutputFilePath())
{
lyt.Export(EPS);
}
});
}
}
//This example demonstrates how to export an individual map frame on a layout to EPS.
//Added references
using ArcGIS.Desktop.Core; //Project
using ArcGIS.Desktop.Layouts; //Layout classes
using ArcGIS.Desktop.Framework.Threading.Tasks; //QueuedTask
using ArcGIS.Desktop.Mapping; //Export formats
publicclass ExportMapFrameToEPSExample
{
publicstatic Task ExportMapFrameToEPSAsync(string LayoutName, string MFName, string Path)
{
//Reference a layoutitem in a project by name
LayoutProjectItem layoutItem = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault(item => item.Name.Equals(LayoutName));
if (layoutItem == null)
return Task.FromResult<Layout>(null);
//Create EPS format with appropriate settings
EMFFormat EPS = new EMFFormat();
EPS.Resolution = 300;
EPS.OutputFileName = Path;
return QueuedTask.Run(() =>
{
//Export MapFrame
Layout lyt = layoutItem.GetLayout(); //Loads and returns the layout associated with a LayoutItem
MapFrame mf = lyt.FindElement(MFName) as MapFrame;
EPS.OutputFileName = Path;
if (EPS.ValidateOutputFilePath())
{
mf.Export(EPS);
}
});
}
}
//This example demonstrates how to export the active mapview to EPS.
//Added references
using ArcGIS.Desktop.Framework.Threading.Tasks; //QueuedTask
using ArcGIS.Desktop.Mapping; //MapView and Export formats
publicclass ExportActiveMapToEPSExample
{
publicstatic Task ExportActiveMapToEPSAsync(string Path)
{
return QueuedTask.Run(() =>
{
//Reference the active map view
MapView mapv = MapView.Active;
//Create EMF format with appropriate settings
EPSFormat EPS = new EPSFormat();
EPS.Resolution = 300;
EPS.Height = 500;
EPS.Width = 800;
EPS.OutputFileName = Path;
//Export active map view
if (EPS.ValidateOutputFilePath())
{
mapv.Export(EPS);
}
});
}
}