I have a problem with printing maps Gmap V3.
Printing is done by pressing a button. Here’s the code:
function Print() {
text = document.getElementById('mapCanvas').innerHTML;
//mapCanvas is div whith map
printwin = open('', 'printwin', 'width=545,height=446');
printwin.document.open();
printwin.document.writeln('<html><head><title></title></head><body onload=print();close()>');
printwin.document.writeln(text);
printwin.document.writeln('</body></html>');
printwin.document.close();
}
On the map uses custom markers. When printing, they do not appear, and if you print this page through the standard means everything is fine.
Anybody encountered this problem?
P.S. Sorry for bad English. 🙂
The markers are not included in the
innerHTMLof thediv. Instead, they are overlayed on the map itself. The problem is not that you cannot print the markers, but that you are only copying the map into your new window and not the markers themselves.To solve your issue, you must include in your new html document more than the
innerHTMLof yourmapCanvasdiv. Also include thejavascriptand the code that places the markers over your map.On the other hand, I think you should try having a different CSS file for printing, which hides what you do not want to display when printing, while at the same time allows for your map and markers to be displayed.
Do that by using this in the css: