-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi, what is the best way to print a gmaps object?
I read this article but I do not like this methodology very much, though.
thanks for your help
Luca
Hello lramellavotta,
You could print using the following javascript:
var content = document.getElementByID('mapMainCanvas'); //has to be first.
var win = window.open();
win.document.write(content);
win.print();
win.close();
Or you could open it in a new window, and print it with zk.
Best Regards,
Darksu
Hi Darksu,
<button label="" image="/images/Stampa.png" width="120px" height="45px">
<attribute name="onClick">
Clients.evalJavaScript("cmdPrint('" +gmaps.getUuid()+ "')");
</attribute>
</button>
<script type="text/javascript">
function cmdPrint(uuid)
{
var content = zk.Widget.$("$gmaps");
var win = window.open();
win.document.write(content);
win.print();
win.close();
}
</script>
<gmaps version="3.9" id="gmaps" width="1100px" height="470px" showSmallCtrl="true" />
If I run this code I print a page with [object Object] and nothing other......
p.s. uuid is for other test
This code print the map but without gmarker... ?!?!?
<script type="text/javascript">
function cmdPrint(uuid)
{
var content = zk.Widget.$('$gmaps');
var win = window.open();
win.document.writeln($(content).html());
win.print();
win.close();
}
</script>
that doesnt work with me!
Hi Nateno, this my code (with zk 6.5.3)
<button label="" image="/images/Stampa.png" width="120px" height="45px">
<attribute name="onClick">
Clients.evalJavaScript("cmdPrint('" +gmaps.getUuid()+ "')");
</attribute>
</button>
<gmaps version="3.9" id="gmaps" width="1100px" height="470px" showSmallCtrl="true" />
I read, from stackoverflow, a note related a "gmnoprint". This section lock printable markers. The I tried to remove....but without success... this is a wrong way
function cmdPrint(uuid)
{
var content = zk.Widget.$('$gmaps');
var custom = jq($(content)).clone();
$(custom).find('.gmnoprint').remove('gmnoprint');
$(custom).find('.gmnoprint').removeClass('gmnoprint');
var win = window.open();
win.document.write("<TITLE>Stampa cartina</TITLE>");
win.document.write($(custom).html());
//win.print();
//win.close();
}
It surprises me that this problem it is so difficult to solve...
Asked: 2015-05-10 10:44:29 +0800
Seen: 20 times
Last updated: May 17 '15
How loop gmaps marker in javascript?
wrong valueException come in front of modal popup [closed]
Use parameters in a conditional @command
Problems with multiple press and onCtrlKey
MVVM @save on the fly [closed]
Unable to activate destroyed desktop
org.zkoss.zk.ui.UiException: java.lang.ClassNotFoundException
How to put a image or Letter over image on a specific XY Coordinate