jamest582

Printing issue with graphics layer and legend

Discussion created by jamest582 on May 11, 2010
Latest reply on Dec 15, 2010 by anwar1
I am having some weird behavior with the print page.  First, I am using ESRI's street maps as my base layer then I have a graphics layer on top of along with a legend.  The problems that I am having are if I am zoomed out to the state level and launch the print page the base map is pu into four tiles down the page, while the graphics layer is centered in the page and not in the correct location and the legend does not show up (Picture 1).  Second, if I am zoomed into the a county or tract I have the same problem but this time there are less tiles for the base map and the legend shows up but with no background (Picture 2).  Fianlly, if you use firefox the graphics layer or the lengend never show up in the print page.  Any help would be greatly appreciated.

function clickheretoprint(divId, title, right, top, w, h) {

    if (right == null) right = 100;
    if (top == null) top = 25;
    if (w == null) w = 1000;
    if (h == null) h = 1000;
    if (title == null) title = "Print Screen";

    var disp_setting = "toolbar=yes,location=no,directories=yes,menubar=yes,";
    disp_setting += "scrollbars=yes,width=" + w + ", height=" + h + ", right=" + right + ", top=" + top;

    //get the html of the div  
    var content_vlue = dojo.byId('mapDiv').innerHTML;
    //strip out the link tags else we'll link back to the mapper page
    content_vlue = content_vlue.replace(/<a/g, "<span");
    content_vlue = content_vlue.replace(/<\/a/g, "</span");

    var docprint = window.open("", "", disp_setting);
    docprint.document.open();
    docprint.document.write('<html><head><title>' + title + '</title>');
    docprint.document.write('<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=1.6"></script>');
    docprint.document.write('</head><body onLoad="self.print()"><left>');
    docprint.document.write('<div id="position" style="position:absolute;margin-left:50px;margin-top:50px;">');
    docprint.document.write(content_vlue);
    docprint.document.write('</left></body></html>');
    docprint.document.close();
    docprint.focus();
}

Attachments

Outcomes