using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using ArcGIS.Core.CIM; using ArcGIS.Core.Data; using ArcGIS.Core.Geometry; using ArcGIS.Desktop.Catalog; using ArcGIS.Desktop.Core; using ArcGIS.Desktop.Editing; using ArcGIS.Desktop.Extensions; using ArcGIS.Desktop.Framework; using ArcGIS.Desktop.Framework.Contracts; using ArcGIS.Desktop.Framework.Dialogs; using ArcGIS.Desktop.Framework.Threading.Tasks; using ArcGIS.Desktop.Mapping; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using ArcGIS.Desktop.Core.Events; using ArcGIS.Core.Events; using ArcGIS.Desktop.Mapping.Events; using ArcGIS.Desktop.Layouts; namespace ylsetpro { internal class btnAddData : Button { protected override void OnClick() { var layout = LayoutView.Active; QueuedTask.Run(() => { if (layout == null) return; // create the name of the pdf file var pdf = System.IO.Path.Combine( System.IO.Path.GetTempPath(), "gisoracle.pdf"); if (System.IO.File.Exists(pdf)) System.IO.File.Delete(pdf); //Specify the exportFormat - PDF, var exportFormat = new PDFFormat() { OutputFileName = pdf, Resolution = 300, DoCompressVectorGraphics = true, DoEmbedFonts = true, HasGeoRefInfo = true, ImageCompression = ImageCompression.Adaptive, ImageQuality = ImageQuality.Better, LayersAndAttributes = LayersAndAttributes.LayersAndAttributes }; layout.Layout.Export(exportFormat); }); } } }
参考:https://github.com/esri/arcgis-pro-sdk/wiki/ProConcepts-Layouts