Export Image from Map and send it to Server

622
1
Jump to solution
03-25-2013 09:07 AM
LukasKalt
New Contributor II
Hi there

We are trying replace WebADF with the API for Javscript. We have an ASP .NET application. Until now we had a functionality, where the user could export the map to an Image (PNG) or an PDF. I know, that this is possible with the esri.dijit.Print package. But that doesn't work for us. We need the export the map into a bytestream and send it to the ASP .NET server and create a customized image or PDF (multi paged report) there. Is this possible?

With Web ADF we used the IMapFunctionality.DrawExtent method.
0 Kudos
1 Solution

Accepted Solutions
LukasKalt
New Contributor II
If people are wondering. I found a solution:

You can use esri.tasks.PrintTask. This class sends the result of the URL of the generated image. Which can be sent to the server:

Example:
    var task = new esri.tasks.PrintTask(printUrl);
    dojo.connect(task, 'onComplete', function (result) {
        PageMethods.SendMap(result.url, onSucceeded, onFailed);
    });

    var params = new esri.tasks.PrintParameters();
    params.map = map;
    var template = new esri.tasks.PrintTemplate();
    template.exportOptions = {
        width: 700,
        height: 500,
        dpi: 96
    };
    template.format = "JPG";
    template.layout = "MAP_ONLY";
    params.template = template;
    task.execute(params);

View solution in original post

0 Kudos
1 Reply
LukasKalt
New Contributor II
If people are wondering. I found a solution:

You can use esri.tasks.PrintTask. This class sends the result of the URL of the generated image. Which can be sent to the server:

Example:
    var task = new esri.tasks.PrintTask(printUrl);
    dojo.connect(task, 'onComplete', function (result) {
        PageMethods.SendMap(result.url, onSucceeded, onFailed);
    });

    var params = new esri.tasks.PrintParameters();
    params.map = map;
    var template = new esri.tasks.PrintTemplate();
    template.exportOptions = {
        width: 700,
        height: 500,
        dpi: 96
    };
    template.format = "JPG";
    template.layout = "MAP_ONLY";
    params.template = template;
    task.execute(params);
0 Kudos