javascript - Printing google map with marker -
i want print particular part of web page contains google maps markers pointing location.
the problem javascript function printing google maps not markers. when printing ctrl+p, printing whole page google maps , markers.
i using chrome , firefox browser.
can tell me problem. why not function printing markers. appreciated.
function printdiv(firstdivid, seconddivid, thirddivid) { /* creating iframe printing */ ifrm = document.createelement("iframe"); ifrm.setattribute("name", "print_frame"); ifrm.setattribute("id", "print_frame_id"); ifrm.setattribute("src", "#"); ifrm.setattribute("frameborder", 0); ifrm.style.width = 0 + "px"; ifrm.style.height = 0 + "px"; document.body.appendchild(ifrm); /* creating printablediv gethering content divs */ printablediv = document.createelement("div"); printablediv.setattribute("id", "printabledivid"); document.body.appendchild(printablediv); /* creating printablediv chart title css */ var titlediv = document.createelement("div"); titlediv.setattribute("id", "titlediv"); titlediv.setattribute("style", "width:96%;text-align:center;background-color:rgb(255, 238, 182);border-top: 1px solid orange;border-bottom: 1px solid orange;font-size: 16px;font-family: calibri;border-right: 0px;border-left: 0px;margin-left: 18px;font-weight: bold;"); document.getelementbyid("printabledivid").appendchild(titlediv); document.getelementbyid("titlediv").innerhtml = $("#" + firstdivid).html(); $("#" + seconddivid).clone().appendto("#printabledivid"); **this second div contains google maps.** if (thirddivid != '') { $("#" + thirddivid).clone().appendto("#printabledivid"); } // landscape style var stylestr = '<style type="text/css" media="print"> @media print{@page {size: landscape}} </style>'; // landscape, working in chrome not in firefox. var printingcontent = stylestr+ document.getelementbyid("printabledivid").innerhtml; // without landscape // var printingcontent=document.getelementbyid("printabledivid").innerhtml; window.frames["print_frame"].document.body.innerhtml = printingcontent; window.frames["print_frame"].window.focus(); window.frames["print_frame"].window.print(); /* removing printablediv , iframe next time printing */ $("#printabledivid").remove(); $("#print_frame_id").remove(); }
Comments
Post a Comment