Print/Export map

2043
6
10-02-2011 10:21 AM
MiriRevivo
Occasional Contributor
Hi,

Is there any way to print or export the contents of a map in ArcGIS Runtime?

Thanks,
Miri Revivo.
0 Kudos
6 Replies
MichaelBranscomb
Esri Frequent Contributor
Hi,

We're currently working on a print capability and hope to have this ready by the next beta later in the year.

Cheers

Mike
0 Kudos
MiriRevivo
Occasional Contributor
Hi Mike,

Thank you for your reply. this is good news.
0 Kudos
ArtUllman
New Contributor
Could we use the ArcPY in a geoprocessing service to create a PDF?
0 Kudos
BKuiper
Occasional Contributor III
Hi,

while you are waiting for Esri you can use the Telerik controls.

I use the Telerik controls to print ArcGIS maps.

I convert them to an Image using WriteableBitmap and then print them with the PdfFormatProvider.

here is a code example:

            // convert to image because of problems with graphicslayers not showing up
            // correctly (in lefttop corner instead on the correct location of the map) when writing to pdf
            WriteableBitmap wb = new WriteableBitmap(this.yourUIElement, new ScaleTransform() { ScaleX = 1, ScaleY = 1 });

            Image image = new Image();
            image.Height = 64;
            image.Margin = new Thickness(10);
            image.Source = wb;

            // make raddocument
            Section section = new Section();
            Paragraph paragraph = new Paragraph();
            InlineUIContainer container = new InlineUIContainer();
            container.UiElement = image;
            container.Width = 750;
            container.Height = 1000;

            paragraph.Inlines.Add(container);
            section.Blocks.Add(paragraph);

            RadDocument document = new RadDocument();
            document.DefaultPageLayoutSettings = new PageLayoutSettings(PaperTypes.Letter);
            document.PageViewMargin = new SizeF(0.0f, 0.0f);
            document.ParagraphDefaultSpacingBefore = 0;
            document.ParagraphDefaultSpacingAfter = 0;

            // use padding to center, perhaps find a more appropriate way to do this in the future.
            document.SectionDefaultPageMargin = new Telerik.Windows.Documents.Layout.Padding(32, 25, 0, 0);
            document.Children.Add(section);

            PdfFormatProvider provider = new PdfFormatProvider();

            string extension = "pdf";

            SaveFileDialog dialog = new SaveFileDialog()
            {
                DefaultExt = extension,
                Filter = String.Format("{1} file (*.{0})|*.{0}|All files (*.*)|*.*", extension, "PDF"),
                FilterIndex = 1
            };

            bool? dialogResult = dialog.ShowDialog();
            if (dialogResult == true)
            {
                using (Stream output = dialog.OpenFile())
                {
                    provider.Export(document, output);
                    provider.ExportSettings = new PdfExportSettings() { InlineUIContainersExportMode = 0 };
                }
            }
0 Kudos
TomSanderson
New Contributor II
G'Day Mike

I haven't found the print capacity in Beta 2 of runtime. Will this be available earlier next year? and will it be able to print to A1 in size?

Cheers

Tom
0 Kudos
MichaelBranscomb
Esri Frequent Contributor
Hi,

Unfortunately, we didn't manage to include any specific printing support in the API in Beta 2. You might want to take a look at this SL/WPF sample from Dominique Broux: http://www.arcgis.com/home/item.html?id=e361c2cc69784fcba34358d0458f66e3.

Cheers

Mike
0 Kudos