Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The map is removed from screen during the export. #44

Closed
LMF-personal opened this issue Sep 12, 2017 · 9 comments
Closed

The map is removed from screen during the export. #44

LMF-personal opened this issue Sep 12, 2017 · 9 comments

Comments

@LMF-personal
Copy link

How to keep the map from disappearing?

@rowanwins
Copy link
Owner

Can you show your configuration @LMF-personal ?

@LMF-personal
Copy link
Author

LMF-personal commented Sep 13, 2017

This is the configuration I used for this plug-in.

	var dimensions = me._map.getSize();
	var mapSize = {
		width: dimensions.x,
		height: dimensions.y,
		className: 'mapCssClass',
		tooltip: 'map container size'
	}
	this._printer= L.easyPrint({
  		hidden:true,
  		sizeModes: ['Current', 'A4Landscape', 'A4Portrait',mapSize],
  		filename: 'myMap',
  		exportOnly: true,
  		hideControlContainer: true
	}).addTo(me._map);

        this._printer.printMap('mapCssClass', 'MyFileName');

At the same time, I found that when exporting the map, I could only export the top of the map when using the current size parameter, so I defined the print size.

For the problem of map disappearing, I found that when the map was exported, a div container was created outside the map container, and the style of the div container was set as follows.
image
The height of this div is 100%, but the width is not set, the default is 0, so the map disappears. Can this problem be solved? thank you
@rowanwins

@rowanwins
Copy link
Owner

Hi @LMF-personal

What happens when you try and use one of the default sizes, such as A4 portait?

printPlugin.printMap('A4Portait', 'MyFileName');

Are you getting any errors in your console?

@santiquetzal
Copy link

Same problem happens to me, I'm using the following code:

leafletData.getMap('mapViewer').then(function(map){
    L.easyPrint({
        sizeModes: ['Current', 'A4Portrait', 'A4Landscape'],
        exportOnly: true
    }).addTo(map);
}

If I export to 'Current' size the map shows in the screen during the export or print action, but when exporting to A4Portrait or A4Landscape the map dissapears.

@santiquetzal
Copy link

Mmm, my map is included using:

<leaflet id="mapViewer" height="480px" width="auto"></leaflet>

If I avoid using auto the map doesn't dissapears during export:

<leaflet id="mapViewer" height="400px" width="400px"></leaflet>

@rowanwins
Copy link
Owner

Hi @santiquetzal & @LMF-personal

I believe this should now be resolved in v2.1.8 . Let me know if you continue to have issues

@santiquetzal
Copy link

It's working well.
Thanks

@jstie
Copy link

jstie commented Jan 10, 2018

I still have the problem of a disappearing map using
L.easyPrint({ hidden: false, exportOnly: true, sizeModes: ['Current', 'A4Landscape', 'A4Portrait'] }).addTo(map);

Using 'Current' only the Leaflet controls disappear. Using the other sizes the whole map disappears.

@astridx
Copy link

astridx commented Mar 2, 2018

I still have also the problem of a disappearing map using exportOnly: true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants