Select to view content in your preferred language

Download shown Map as PDF

3059
11
Jump to solution
04-19-2020 10:30 PM
rsharma
Frequent Contributor

Hi,

I want to download map with graphics on different graphics layer as pdf. Suggestions will be helpful, Thanx in advance.

0 Kudos
11 Replies
rsharma
Frequent Contributor

Hi

I am still not able to download the map on button click. Got this link also. Can you please help me in any way.

Take a screenshot of a SceneView | ArcGIS API for JavaScript 4.15 

0 Kudos
rsharma
Frequent Contributor

I make it work like this. this return an image in base 64, further anyone can convert it to image.

    // add an event listener to trigger the area selection mode
        screenshotBtn.addEventListener("click", function() {

         let area = null;
         const xmin =1;
         const ymin = 1;
         const xmax = 1400;
         const ymax= 700;
        area = {
        x: xmin,
        y: ymin,
        width: xmax - xmin,
        height: ymax - ymin
      };

      // the screenshot of the selected area is taken
      view
        .takeScreenshot({ area: area, format: "png" })
        .then(function(screenshot) {
          var data_image_url=screenshot.dataUrl;
          //console.log(data_image_url);
          jQuery.ajax({
                        type : "POST",
                        dataType : "JSON",
                        data : {action:'save_map_image',listing_id:<?=$list_data['listing_id']?>,image_data_url:data_image_url }
                         });
            });
          });

0 Kudos