This document is archived and information here might be outdated.  Recommended version.


Publisher (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Publisher

Publisher


Supported with:
  • ArcGIS for Desktop Basic with Publisher
  • ArcGIS for Desktop Standard with Publisher
  • ArcGIS for Desktop Advanced with Publisher
Library dependencies: Version, System, SystemUI, Geometry, GraphicsCore, Display, Server, Output, Geodatabase, GISClient, DataSourcesFile, DataSourcesGDB, DataSourcesOleDB, DataSourcesRaster, DataSourcesNetCDF, GeoDatabaseDistributed, GeoDatabaseExtensions, Carto, NetworkAnalysis, Location, GeoAnalyst, Animation, Maplex, Geoprocessing, NetworkAnalyst, Schematic, SpatialAnalyst, 3DAnalyst, GlobeCore, EngineCore, TrackingAnalyst, Framework, Desktop.Addins, GeoDatabaseUI, DisplayUI, OutputUI, Search, Catalog, CatalogUI, CartoUI, DataSourcesRasterUI, ArcCatalog, ArcCatalogUI, ArcMap, ArcMapUI, AnimationUI, Editor, GeoReferenceUI, EditorExt, LocationUI, GeoDatabaseDistributedUI, GeoprocessingUI, OutputExtensions, OutputExtensionsUI, ArcScan, NetworkAnalystUI, SpatialAnalystUI, SchematicUI, 3DAnalystUI, ArcScene, GlobeCoreUI, ArcGlobe

Additional library information: Contents, Object Model Diagram

The Publisher library implements the non-user interface (UI) functionality of the ArcGIS Publisher extension. The library can be used for the creation and packaging of Published Map Files (PMFs) and the creation of customized ArcReader applications. The PublisherEngine and PackagerEngine objects support the publishing of .pmfs and the subsequent packaging of the PMFs.
Developers do not extend this library.

See the following sections for more information about this namespace:

ArcGIS Publisher

You can use two classes to create and package PMFs. PublisherEngine is used to create published maps, while PackagerEngine is used to create file directories that contain the published map and all the data needed to use the map. The basic setup for using the PublisherEngine and PackagerEngine classes is described in the following sections:
Obtain an ArcGIS Publisher extension license
To access the Publisher objects, you must obtain an ArcGIS Publisher license. You can call for a license prior to accessing each Publisher object, call it once in a single subroutine, or call it once globally in the main routine in a program. Since you only need to call the single subroutine once, or the license is automatically enabled if you call it globally, these two approaches are the preferred methods for obtaining a license.
For more details on how to check out the ArcGIS Publisher license, see the AoInitialize component help.
Specify the ArcGIS Publisher settings
There are a number of settings that can be used when creating a published map. These settings control how the published map is used.
Publisher settings are placed in a property set until ready for use. Initialize the property set with the default publisher settings. Initializing the property set with defaults ensures that there will be no problems with Publisher settings that may or may not be saved in the map document. See the following code example:
[VB.NET]
Dim publisherEngine As IPMFPublish=New PublisherEngine
Dim publisherSettings As IPropertySet=publisherEngine.GetDefaultPublisherSettings
[C#]
IPMFPublish publisherEngine=new PublisherEngine();
IPropertySet publisherSettings=publisherEngine.GetDefaultPublisherSettings;
Create a published map
To publish a map, you need to provide the PageLayout, DefaultView, settings, RelativePaths, and output document parameters. See the following code example:
[VB.NET]
Dim application As IApplication
Dim mapDoc As IMapDocument=TryCast(application.Document, IMapDocument)
Dim pageLayout As IPageLayout=mapDoc.PageLayout
Dim defaultView As IActiveView=mapDoc.ActiveView
Dim settings As IPropertySet=publisherSettings
Dim relativePaths As Boolean=False
Dim document As String="C:/maps/myMap"
publisherEngine.Publish(pageLayout, defaultView, settings, relativePaths, document)
[C#]
IApplication application=null;
IMapDocument mapDoc=application.Document as IMapDocument;
IPageLayout pageLayout=mapDoc.PageLayout;
IActiveView defaultView=mapDoc.ActiveView;
IPropertySet settings=publisherSettings;
bool relativePaths=false;
string document="C:/maps/myMap";
publisherEngine.Publish(pageLayout, defaultView, settings, relativePaths, document);
The PageLayout is part of a map document. The DefaultView refers to the view that the published map opens in ArcReader. Settings are provided in the property set as described in the preceding text.
RelativePaths is a Boolean that controls how data source locations are stored in the published map for each layer. This setting has no effect on map documents that use Universal Naming Convention (UNC) (\\computer_name) paths or server connections, such as ArcSDE and ArcIMS.
The output document is the name you give to the published map.
Specify the packager settings
Use packager settings to control how the data is packaged. There are options for data format, feature intersecting, raster clipping, and copying.
Create a data package for one or more published maps
Data packages are created from published maps. When using the package method, you need to provide the package settings and the published map or maps to package. Since you can package more than one published map at a time, a string array of published maps is used. See the following code example:
[VB.NET]
Dim packagerEngine As IPMFPackage=New PackagerEngine
'Initialize default packager settings.
Dim packagerSettings As IPropertySet=packagerEngine.GetDefaultPackagerSettings
Dim cancelTracker As ITrackCancel=New CancelTracker
Dim arrMaps As IStringArray
packagerEngine.Package(packagerSettings, cancelTracker, arrMaps)
[C#]
IPMFPackage packagerEngine=new PackagerEngine();
//Initialize default packager settings.
IPropertySet packagerSettings=packagerEngine.GetDefaultPackagerSettings;
ITrackCancel cancelTracker=new CancelTracker();
IStringArray arrMaps=null;
packagerEngine.Package(packagerSettings, cancelTracker, arrMaps);