Google maps print problem

Page: 1

Author Post
Member
Registered: Oct 2012
Posts: 19
I show a Google Map with a marker inside a floatbox.

This works fine.

But when I want to print the map, the marker disappear (on print preview and print result).

When I look at your example (Google maps and Floatbox), you have the same problem.

Thanks for help.
Administrator
Registered: Aug 2008
Posts: 3382
It's not so much a problem, but rather just the way things are. The print function prints the static content. Scripts are not loaded or executed in the print window.

The Google Map markers are dynamic content that's added to the map by script after the map loads, and hence is not part of the static content that gets printed.

To print the markers or other dynamic content, you could set showNewWindow:true in the floatbox options and then print that new window manually using the browser's print menu.
Member
Registered: Oct 2012
Posts: 19
OK, I understand.

An is it possible to add a 'Print' button (to activate the browser print menu) INSIDE the floatbox (so users click inside the floatbox and don't have to use directly the browser's print menu) ?

Lot of maps applications works this way to print maps.

Regards.
Administrator
Registered: Aug 2008
Posts: 3382
It's very easy to add a button to your box content that has onclick="print()" assigned. Note that this will invoke the print dialog in the context of the entire current page and not just for the portion of the page displayed within the floatbox.
Member
Registered: Oct 2012
Posts: 19
To print only the frame content (and avoid printing the entire page), I added a new button 'Printable map'.

This opens a new window in a 'normal' window (so I can easily print the content).

This works fine with a classic link :
<a href='mylink.php' target="_blank">Printable map</a>

But not with a button. If I use a classic button, nothing happens when I click the button.

And with a floatbox button, I can only open the new window in a floatbox, so I have the same problem for printing.

Is is possible to use a floatbox button to open a new window in a 'normal' window (something like target="_blank") ?

Thanks for your help.
Administrator
Registered: Aug 2008
Posts: 3382
Floatbox's facility for this is the showNewWindow option.

Page: 1