Printing resized map using javascript

570
0
10-11-2013 11:31 AM
AndyMonplaisir
New Contributor II
Greetings,

I have setup the map to resize when the print button is clicked to take up the entire page. Then I would call the window.print() to print the map, but what continues to happen is I get a slightly offset map with the graphic missing from the map. Does anyone know How I can accomplish this task to include the graphic when printing. When the map resizes full screen, it still contains the point on the map.

Below is my javascript code of what I doing with the map Div:

        function setLandScape() {

            try {
                //Get the HTML of whole page
                var oldPage = document.body.innerHTML;
                var windowHeight = screen.availHeight / 4 * 3 + "px"
                //Get the Div object

                var div2 = document.getElementById('content1');
                var tleDiv = document.getElementById('dvTitle');

                var oldWidth = div2.style.width;
                var oldHeight = div2.style.height;
                var oldFloat = div2.style.styleFloat;
                var oldPosition = div2.style.position;
                var oldTlePosition = tleDiv.style.position;
                var oldTleTop = tleDiv.style.top;

                div2.style.position = "fixed";
                div2.style.width = "100%";
                div2.style.height = "100%";
                div2.style.styleFloat = "";
                div2.style.top = "0";
                div2.style.left = "0";


                tleDiv.style.position = "fixed";
                tleDiv.style.top = "10";

                var toolbar = document.getElementById('navToolbar');
                toolbar.style.display = "none";

                var dataElement = document.getElementById('UpdatePanel2');
                if (dataElement.style.display == "") {
                    dataElement.style.display = "none";
                }

                window.setTimeout(function () {

                    window.print()

                    div2.style.position = oldPosition;
                    div2.style.width = oldWidth;
                    div2.style.height = oldHeight;
                    div2.style.styleFloat = oldFloat;
                    div2.style.top = "";
                    div2.style.left = "";

                    tleDiv.style.top = oldTleTop;
                    tleDiv.style.position = oldTlePosition;
                    toolbar.style.display = "block";
                    if (dataElement.style.display == "none") {
                        dataElement.style.display = "";
                    }
                }, 2000);

            }
            catch (e) {
                alert(e.Message);
            }
        }

Thanks,
Andy
0 Kudos
0 Replies