Capture Display

2 posts, 0 answers
  1. Andre
    Andre avatar
    12 posts
    Member since:
    Feb 2011

    Posted 06 Feb Link to this post

    Hi 

    Is it possible to capture/export the display of the map tool as a pdf or jpg?

    Eg A method along the lines of save as xxx.pdf

    thanks

  2. Dimitar
    Admin
    Dimitar avatar
    1994 posts

    Posted 07 Feb Link to this post

    Hi Andre,

    The following snippet shows how you can export the current map to an image:
    private void radButton1_Click(object sender, EventArgs e)
    {
        var bitmap = new Bitmap((int)this.radMap1.MapElement.ViewportInPixels.Size.Width, (int)this.radMap1.MapElement.ViewportInPixels.Height);
        Graphics g = Graphics.FromImage(bitmap);
        RadGdiGraphics gg = new RadGdiGraphics(g);
     
        foreach (MapVisualElement element in this.radMap1.MapElement.Providers[0].GetContent(this.radMap1.MapElement))
        {
            element.Paint(gg, this.radMap1.MapElement);
        }
         
        bitmap.Save(@"D:\test.png", ImageFormat.Png);
    }

    Then you can use RadPdfProcessing to create a pdf document.

    I hope this will be useful. Let me know if you have additional questions.

    Regards,
    Dimitar
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top