Select to view content in your preferred language

Low print/export quality -- print template settings not being used

3345
2
Jump to solution
11-13-2015 10:20 AM
ConversantMedia
Deactivated User

I'm 2 days into the ArcGIS JavaScript API. Can someone help me understand why my print template settings aren't being acknowledged in the code below? Thanks!

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
    <title></title>
    <link rel="stylesheet" href="http://js.arcgis.com/3.14/dijit/themes/nihilo/nihilo.css">
    <link rel="stylesheet" href="http://js.arcgis.com/3.14/esri/css/esri.css">
    <style>
        #map{
          width:640px;
          height:640px;
        }
        .esriAttribution{
          visibility: hidden;
        }
        .logo-med{
          visibility: hidden;
        }
    </style>
    <script src="http://js.arcgis.com/3.14/"></script>
    <script>
      require([
        "esri/map", "esri/tasks/PrintTemplate", "esri/tasks/PrintParameters", "esri/dijit/Print", "dojo/dom"], function(Map, PrintTemplate, PrintParameters, Print, dom) {
        var map = new Map( "map",{basemap: "streets",center: [-95.993, 36.154],zoom: 12,slider: false} );


        // esriConfig.defaults.io.proxyUrl = "/proxy/";
        var template = new PrintTemplate();
        template.exportOptions = {
          width: 640,
          height: 640,
          dpi: 96
        };
        template.format = "PNG";
        template.layout = "A3 Landscape";
        template.preserveScale = true;
        
        var params = new PrintParameters();
        params.map = map;
        params.template = template;
      
        printer = new Print({
          map: map,
          template: template,
          url: "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%2..."
        }, dom.byId("printButton"));
        printer.startup();


        alert(JSON.stringify(template.exportOptions));
        


  
      });
    </script>
  </head>
  <body>
    <div id="map"></div>
     <div id="printButton"></div>
  </body>
</html>
0 Kudos
1 Solution

Accepted Solutions
ChrisSmith7
Honored Contributor

Try wrapping it in setExtent, like this jsfiddle example:

Edit fiddle - JSFiddle

I confirmed, the size change works in this example (the URL is in the console log, FYI).

View solution in original post

0 Kudos
2 Replies
ChrisSmith7
Honored Contributor

Try wrapping it in setExtent, like this jsfiddle example:

Edit fiddle - JSFiddle

I confirmed, the size change works in this example (the URL is in the console log, FYI).

0 Kudos
ConversantMedia
Deactivated User

works like a charm! thank you so much!

0 Kudos