Supported with:
Additional library information: Contents, Object Model Diagram
See the following sections for more information about this namespace:
- ArcView with Publisher
- ArcEditor with Publisher
- ArcInfo with Publisher
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.
- Specify the ArcGIS Publisher settings.
- Create a published map.
- Specify the packager settings.
- Create a data package for one or more published maps.
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.
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.
[VB.NET]
Dim publisherEngine As IPMFPublish = New PublisherEngine
Dim publisherSettings As IPropertySet = publisherEngine.GetDefaultPublisherSettings
[C#]
IPMFPublish publisherEngine = new PublisherEngine();
IPropertySet publisherSettings = publisherEngine.GetDefaultPublisherSettings;
To publish a map, you need to provide PageLayout, DefaultView, Settings, RelativePaths, and output Document.
[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);
A 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.
Use packager settings to control how the data is packaged. There are options for data format, feature intersecting, raster clipping, and copying.
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.
[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);