AnsweredAssumed Answered

Print/Write a map in a PDF document.

Question asked by Reda20 on Dec 20, 2014
Latest reply on Nov 17, 2015 by schlot

Dear All,


I am working on reports related to tables and statistics.

I am conducting a search through dropdownlist selections and queries which is working just fine:

var selectQuery = new esri.tasks.Query();

selectQuery.where = "NAME_ENGLISH LIKE '" + + "'";

selectQuery.outFields = ["*"];


var upc_fi_selectQuery = new esri.tasks.Query();

upc_fi_selectQuery.spatialRelationship = selectQuery.SPATIAL_REL_CONTAINS;


AttFeatureLayer.selectFeatures(upc_fi_selectQuery, esri.layers.FeatureLayer.SELECTION_NEW, function (features)


// do this and that



After that I am running a script to write tables in a Windows document as follows (for instance):

var newWin ="");

newWin.document.write ("<label style='font-family: Trebuchet MS; font-weight:bold; font-size: 18px; color: #C0504D;'>Tourism Ecosystems Zone Details</label>");

newWin.document.write(Rep_T_tbTCA.outerHTML); // writing a table in a pdf document.

newWin.document.write ('<br></br>');


  newWin.document.write("<label style='font-family: Trebuchet MS; font-weight:bold; font-size: 18px; color: #C0504D; page-break-after: always'>Location of the the feature</label>");

  newWin.document.write ('<br></br>');



Till now everything works just fine.


The map now is zoomed to the selected feature.

Now, I need to print the current extent of the map inside the pdf document:


<div id="map" class="map" align="justify"





var mapd = document.createElement("div"); = "map_rep";





I am getting the following as a response, which is not required result:

[object HTMLDivElement]


I have seen other possibilities involving geoprocessing printing task using ArcGIS Online maps which is not the case for me as I am using a map published as a map service and I have not interest in going through ArcGIS Online.


Please kindly advice !




- ArcGIS Server 10.1 Enterprise.

- JS API 3.11