AnsweredAssumed Answered

Not quite getting what I want from PrintTask

Question asked by evtguy on Apr 5, 2013
Latest reply on Apr 18, 2013 by geonetadmin
I'm just getting my feet wet with the PrintTask functionality in v3.3 of the API. Ideally, I just wanted to take what I see on the screen, export it to a JPEG, and then insert that into a "report" that I build on the fly with JS & HTML. I'm using PrintTask and the "Export Web Map Task" from our 10.1 install of ArcGIS Server. The first attachment (screenshot01) is what I see on my screen. The second attachment (screenshot02) shows the exported JPEG as it appears in my generated report.

As you can see, they only loosely resemble each other. I have two census feature layers that have dynamic labels which do not even show up in the exported JPEG (this might be a bug? I recall reading a thread recently somewhat related to this..). Next, the linework in the exported image are huge and bloated compared with what I see on screen. How do I produce an exported image that is as close to WYSIWYG as possible?

Here's my relevant code for my printTask creation:

 pTemplate = new esri.tasks.PrintTemplate();
 pTemplate.exportOptions = {
  width: 600,
  height: 400,
  dpi: 300
 };
 pTemplate.format = "jpg";
 pTemplate.layout = "MAP_ONLY";
 pTemplate.preserveScale = false;
 pTemplate.showAttribution = false;

 var params = new esri.tasks.PrintParameters();
 params.map = map;
 params.template = pTemplate;
  
 thePrintTask = new esri.tasks.PrintTask(url);
 thePrintTask.execute(params, function(result) {
  jpgMapDiv = theDocument.createElement("div");
  jpgMapDiv.setAttribute("id","jpegMap");
  setStyle(jpgMapDiv, {
   width : '95%',
   height: '400px',
   marginRight : 'auto',
   marginLeft : 'auto',
   borderTop: '2px solid black',
   padding: "10px"
  });       
  jpgMapDiv.innerHTML = "<img src=\"" + result.url + "\" style=\"border:2px solid black;left:25%\"\>";
  theDocument.body.appendChild(jpgMapDiv);
 }); 


THANKS!
Steve

Outcomes