James,
The first part of this is following the tutorial for creating a custom print service:
Tutorial: Publishing additional services for printing—Documentation (10.3 and 10.3.1) | ArcGIS for S...
then follow this blog post (even know it says printing popups):
Printing Popups from Web Application | ArcGIS Blog
I personally have made changes to the Print Widgets Print.js to look for a specific layer in the map and if that layer is present then add certain attributes to the layouts customTextElements.
So in the Print.js print function:
print: function() {
if (this.printSettingsFormDijit.isValid()) {
var form = this.printSettingsFormDijit.get('value');
lang.mixin(form, this.layoutMetadataDijit.get('value'));
this.preserve = this.preserveFormDijit.get('value');
lang.mixin(form, this.preserve);
this.layoutForm = this.layoutFormDijit.get('value');
var mapQualityForm = this.mapQualityFormDijit.get('value');
var mapOnlyForm = this.mapOnlyFormDijit.get('value');
lang.mixin(mapOnlyForm, mapQualityForm);
var elementsObj = this.customTextElementsDijit.get('value');
var cteArray = [];
for (var p in elementsObj) {
var cte = {};
cte[p] = elementsObj[p];
cteArray.push(cte);
}
var template = new PrintTemplate();
template.format = form.format;
template.layout = form.layout;
template.preserveScale = (form.preserveScale === 'true' || form.preserveScale === 'force');
template.label = form.title;
template.exportOptions = mapOnlyForm;
template.showAttribution = false;
template.layoutOptions = {
authorText: form.author,
copyrightText: form.copyright,
legendLayers: (this.layoutForm.legend.length > 0 && this.layoutForm.legend[0]) ?
null : [],
titleText: form.title,
customTextElements: cteArray
};
var plyr;
array.some(this.map.graphicsLayerIds, lang.hitch(this, function (layerId) {
var lyr = this.map.getLayer(layerId);
if(lyr.name === "Search Results: Parcels"){
plyr = lyr;
return true;
}
}));
if(plyr){
var xppins = "", obj, cTextElements = [];
array.map(plyr.graphics, lang.hitch(this, function(gra, index){
if (plyr.graphics.length === 1){
obj = {OwnerName: "Owner Name: " + gra.attributes.NAME};
cTextElements.push(obj);
obj = {PPIN: "PPIN: " + gra.attributes.PPIN};
cTextElements.push(obj);
obj = {ParcelNum: "Parcel Number: " + gra.attributes.PARCEL_NUMBER};
cTextElements.push(obj);
obj = {StreetAdd: "Street Address: " + gra.attributes.STREET_ADDRESS};
cTextElements.push(obj);
}else if (plyr.graphics.length > 1){
if (xppins === ""){
xppins = gra.attributes.PPIN;
} else {
if([7,16,25,34,43,52,61,70,79,88,97].indexOf(index) > -1){
xppins = xppins + ",\r\n" + gra.attributes.PPIN;
}else{
xppins = xppins + ", " + gra.attributes.PPIN;
}
}
obj = {OwnerName: "Selected PPINs: " + xppins};
cTextElements.push(obj);
}
template.layoutOptions.customTextElements = cTextElements;
}));
}
this.printparams.template = template;
this.printparams.extraParameters = {
printFlag: true
};
var fileHandel = this.printTask.execute(this.printparams);
var result = new printResultDijit({
count: this.count.toString(),
icon: (form.format === "PDF") ? this.pdfIcon : this.imageIcon,
docName: form.title,
title: form.format + ', ' + form.layout,
fileHandle: fileHandel,
nls: this.nls
}).placeAt(this.printResultsNode, 'last');
result.startup();
domStyle.set(this.clearActionBarNode, 'display', 'block');
this.count++;
} else {
this.printSettingsFormDijit.validate();
}
},