Select to view content in your preferred language

Generate IMage out of Map which has lot of graphics

569
3
08-28-2013 03:40 AM
vinayb
by
Deactivated User
HI All,

    We want to generate PDF of the dynamic world map , it is suppose i highlighted some of the counties in map through JS code when user does some interaction like clicking on country . now i want to show it in PDF , i am using a PDF generation tool where it will print the html file served to it .So in this case i have  to programmatic set all the interaction of user is there by any chance i can get image of the map that i have created.
0 Kudos
3 Replies
ZachLiu1
Deactivated User
https://developers.arcgis.com/en/javascript/jssamples/widget_print_esri_request.html

I believe this sample serves your mission well. You can customize the template and output format with the print task.

Do make sure you get the proxy page right for this to work.

🙂
0 Kudos
vinayb
by
Deactivated User
HI ALl,

  I just need image out of the map , the print task  can generate image out of map and it has been described in the sample [URL="https://developers.arcgis.com/en/javascript/jssamples/widget_print_webmap.html"] but the problem is it is making use print class and finally when i select jpg option there is link called printout appearing which has path to image but i dont how it works how can i get the path to image or image itself.
0 Kudos
VinayBansal
Frequent Contributor
Do it using Print task

 
var printTaskURL = "<URL of Print Service>";
var templatePrint = new esri.tasks.PrintTemplate();
                templatePrint.format = "JPG";
                templatePrint.layout = "MAP_ONLY";                
                templatePrint.exportOptions = {
                    width: map.width,
                    height: map.height,
                    dpi: 96
                };
  var params = new esri.tasks.PrintParameters();
                params.map = map;
                params.preserveScale = false;
                params.currentExtent = map.extent;
                params.template = templatePrint;
                

                var printTask = new esri.tasks.PrintTask(printTaskURL);

                dojo.connect(printTask, 'onComplete', function (result) {
                   
                            window.open(result.url, "_blank");
                        
                });
                dojo.connect(printTask, 'onError', function (error) {
                  
                    alert(error);
                })
                printTask.execute(params);
0 Kudos