Reputation: 146
i have:
function printContent2(div_id)
{
var content = document.getElementById(div_id);
var map_src = window.open("", "PRINT MAP", "width=800,height=600,top=0,left=0,toolbar=no,scrollbars=no,status=no,resizable=no");
map_src.document.write('<html><head>');
map_src.document.write('<link rel="stylesheet" href="/leaflet-0.5.1/0.7.3/leaflet.css"/>');
map_src.document.write('</head><body>');
map_src.document.write(content.innerHTML);
map_src.document.write('</body></html>');
map_src.document.close();
map_src.focus();
map_src.print();
}
.mapstyle {
height: 100%;
height: -webkit-calc(100% - 69px);
height: -moz-calc(100% - 69px);
height: calc(100% - 74px);
margin-left: 420px;
}
div id="map" class="mapstyle"
and after
printContent2('map');
show on full list.
I need set height = 400px.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Upvotes: 1
Views: 4589
Reputation: 11859
you ca use something like this:
map_src.document.write("<html><head><style> #"+div_id+"{height:400px !important;font-size:12px;}</style>")
Upvotes: 1
Reputation: 3495
Try to add Div wrap
function printContent2(div_id)
{
var content = document.getElementById(div_id);
var map_src = window.open("", "PRINT MAP", "width=800,height=600,top=0,left=0,toolbar=no,scrollbars=no,status=no,resizable=no");
map_src.document.write('<html><head>');
//map_src.document.write('<link rel="stylesheet" href="/leaflet-0.5.1/0.7.3/leaflet.css"/>'); ** Remove this line
map_src.document.write("</head><body><div style='height:400px;border:1px solid blue;'>");
map_src.document.write(content.innerHTML);
map_src.document.write('</div></body></html>');
map_src.document.close();
map_src.focus();
map_src.print();
}
Updated Answer: I have Seen your code. It seems like there is an issue with your code . Just remove or comment below line and it's working for me.
map_src.document.write('<link rel="stylesheet" href="/leaflet-0.5.1/0.7.3/leaflet.css"/>'); // Remove this Line.
Upvotes: 0