Closed barbalex closed 7 years ago
I checked the code in http://rowanwins.github.io/leaflet-easyPrint
You use CurrentSize
instead of Current
in printPlugin.printMap('CurrentSize', 'fileName')
there.
I tried this in my own code.
Result: the map is now printed :-)
New issue: all the map controls have disappeared after printing. Including the PrintControl :-(
duh, CurrentSize
is actually mentioned in the readme so please excuse my oversight. It is very easy to assume that the same expressions as in options.sizeModes
are used
Hi @barbalex
I've had a report on the disappearing controls in #38 so I'll get that patched and release a new version.
Yeah unfortunately that naming thing is a bit clunky at the moment, I'll see if I can think of a better way to handle it because it is likely to cause confusion...
Give v2.1.7 a gothat should bring the missing controls back :)
yes, that solves it. Thanks a lot!!!
I have the same issues replicating the simple example from the github-page.
This 'works' (with Leaflet-controls disappearing and reappearing):
`var printPlugin = L.easyPrint({ title: 'My awesome print button', hidden: true, exportOnly: true, }).addTo(map);
$('#map').click(function() { printPlugin.printMap('CurrentSize', 'MyFileName'); }) `
But using 'Current', 'A4Landscape', 'A4Portrait' and self-defined sizes i get:
index.js:141 oops, something went wrong! TypeError: Cannot read property 'width' of undefined at b._resizeAndPrintMap (index.js:151) at index.js:138 at
I see the same problems and errors. Today I had the idea for a workaround.
I hide the controls and use solely two manual print buttons (1 for png, 1 for printer).
E.g. have a look at https://bsommer.de/nsbapps/WoBinIch/index.html . This works with Chrome and Firefox. Not (yet?) with Edge, Firefox, Safari.
Bernd
Von: jstie [mailto:notifications@github.com] Gesendet: Mittwoch, 10. Januar 2018 14:21 An: rowanwins/leaflet-easyPrint leaflet-easyPrint@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Betreff: Re: [rowanwins/leaflet-easyPrint] width undefined when using "printMap(size, filename)" (#41)
I have the same issues replicating the simple example from the github-page. I use carto.js (includes Leaflet 0.7.3).
This 'works' (with Leaflet-controls disappearing and reappearing):
`var printPlugin = L.easyPrint({ title: 'My awesome print button', hidden: true, exportOnly: true, }).addTo(map);
$('#map').click(function() { printPlugin.printMap('CurrentSize', 'MyFileName'); }) `
But using 'Current', 'A4Landscape', 'A4Portrait' and self-defined sizes i get:
index.js:141 oops, something went wrong! TypeError: Cannot read property 'width' of undefined at b._resizeAndPrintMap (index.js:151) at index.js:138 at
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rowanwins/leaflet-easyPrint/issues/41#issuecomment-356600190 , or mute the thread https://github.com/notifications/unsubscribe-auth/AF5h5bM3Eplu9lnkNuCfEBoS6aL7Q6Qhks5tJLkygaJpZM4PBjUZ . https://github.com/notifications/beacon/AF5h5YL1hxUxq_nft8dNuQz-4yHP-axDks5tJLkygaJpZM4PBjUZ.gif
Found a solution, simply use these values:
Example: printPlugin.printMap('A4Landscape page', 'MyFileName');
Best ;)
Found a solution, simply use these values:
- "A4Portrait page"
- "A4Landscape page"
- "CurrentSize"
Example: printPlugin.printMap('A4Landscape page', 'MyFileName');
Best ;)
Thanks! @hankerspace it works for me.
The output in the console is:
My component is:
Seems like the same problem as https://github.com/rowanwins/leaflet-easyPrint/issues/32