Exemple #1
0
        public static 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);
                }
            }));
        }
Exemple #2
0
        public static Task ExportActiveMapToEPSAsync(string Path)
        {
            return(QueuedTask.Run(() =>
            {
                //Reference the active map view
                MapView map = 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())
                {
                    map.Export(EPS);
                }
            }));
        }
Exemple #3
0
        public void snippets_exportLayout()
        {
            #region Export a layout

            // Reference a layoutitem in a project by name
            LayoutProjectItem layoutItem = Project.Current.GetItems <LayoutProjectItem>().FirstOrDefault(item => item.Name.Equals("MyLayout"));
            if (layoutItem != null)
            {
                QueuedTask.Run(() =>
                {
                    Layout layout = layoutItem.GetLayout();
                    if (layout == null)
                    {
                        return;
                    }

                    // Create BMP format with appropriate settings
                    BMPFormat BMP = new BMPFormat()
                    {
                        Resolution     = 300,
                        OutputFileName = @"C:\temp\Layout.bmp"
                    };
                    if (BMP.ValidateOutputFilePath())
                    {
                        layout.Export(BMP);
                    }

                    // Create EMF format with appropriate settings
                    EMFFormat EMF = new EMFFormat()
                    {
                        Resolution     = 300,
                        OutputFileName = @"C:\temp\Layout.emf"
                    };
                    if (EMF.ValidateOutputFilePath())
                    {
                        layout.Export(EMF);
                    }

                    // create eps format with appropriate settings
                    EPSFormat EPS = new EPSFormat()
                    {
                        Resolution     = 300,
                        OutputFileName = @"C:\temp\Layout.eps"
                    };
                    if (EPS.ValidateOutputFilePath())
                    {
                        layout.Export(EPS);
                    }

                    // Create GIF format with appropriate settings
                    GIFFormat GIF = new GIFFormat()
                    {
                        Resolution     = 300,
                        OutputFileName = @"C:\temp\Layout.gif"
                    };
                    if (GIF.ValidateOutputFilePath())
                    {
                        layout.Export(GIF);
                    }

                    // Create JPEG format with appropriate settings
                    JPEGFormat JPEG = new JPEGFormat()
                    {
                        Resolution     = 300,
                        OutputFileName = @"C:\temp\Layout.jpg"
                    };
                    if (JPEG.ValidateOutputFilePath())
                    {
                        layout.Export(JPEG);
                    }

                    // Create PDF format with appropriate settings
                    PDFFormat PDF = new PDFFormat()
                    {
                        Resolution     = 300,
                        OutputFileName = @"C:\temp\Layout.pdf"
                    };
                    if (PDF.ValidateOutputFilePath())
                    {
                        layout.Export(PDF);
                    }

                    // Create PNG format with appropriate settings
                    PNGFormat PNG = new PNGFormat()
                    {
                        Resolution     = 300,
                        OutputFileName = @"C:\temp\Layout.png"
                    };
                    if (PNG.ValidateOutputFilePath())
                    {
                        layout.Export(PNG);
                    }

                    // Create SVG format with appropriate settings
                    SVGFormat SVG = new SVGFormat()
                    {
                        Resolution     = 300,
                        OutputFileName = @"C:\temp\Layout.svg"
                    };
                    if (SVG.ValidateOutputFilePath())
                    {
                        layout.Export(SVG);
                    }

                    // Create TGA format with appropriate settings
                    TGAFormat TGA = new TGAFormat()
                    {
                        Resolution     = 300,
                        OutputFileName = @"C:\temp\Layout.tga"
                    };
                    if (TGA.ValidateOutputFilePath())
                    {
                        layout.Export(TGA);
                    }

                    // Create TIFF format with appropriate settings
                    TIFFFormat TIFF = new TIFFFormat()
                    {
                        Resolution     = 300,
                        OutputFileName = @"C:\temp\Layout.tif"
                    };
                    if (TIFF.ValidateOutputFilePath())
                    {
                        layout.Export(TIFF);
                    }
                });
            }
            #endregion
        }