• ArcGIS Pro二次开发-布局导出PDF


    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

  • 相关阅读:
    文件处理
    集合、字符编码
    元组类型、字典类型以及内置方法
    元组类型、字典类型
    数据类型和内置方法
    while、for循环控制之if、else
    Maven 使用
    Maven 常用命令
    css 文件连接不到网页
    java I/O系统
  • 原文地址:https://www.cnblogs.com/gisoracle/p/12490445.html
Copyright © 2020-2023  润新知