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

Cannot read property 'width' of undefinded #105

Open
chhe-01 opened this issue Oct 6, 2019 · 6 comments
Open

Cannot read property 'width' of undefinded #105

chhe-01 opened this issue Oct 6, 2019 · 6 comments

Comments

@chhe-01
Copy link

chhe-01 commented Oct 6, 2019

Hello,
I want to create a Button in my bootstrap dropdown menu to print a leaflet map. So I have the following Code:

var printer = L.easyPrint({
  sizeModes: ['A4Landscape'],
  tileLayer: cartoLight,
  hideControlContainer: true,
})  .addTo(map);

And I create a function:

$("#printer-btn").click(function() { printer.printMap('A4Landscape'); $(".navbar-collapse.in").collapse("hide"); return false; });

But now, when I click my printbutton in the dropdown menu I get the following error in my chrome console:

oops, something went wrong! TypeError: Cannot read property 'width' of undefined
at e._resizeAndPrintMap (bundle.js:1)
at bundle.js:1

What can I do? I installed the latest version from the repository.

@sommerbernd
Copy link

sommerbernd commented Oct 6, 2019 via email

@chhe-01
Copy link
Author

chhe-01 commented Oct 7, 2019

Oh ok. That is not good.
Maybe the developer of easyprint can help?

@urakovaliaskar
Copy link

I solved it by adding word page to the first argument.
printPlugin.printMap('A4Landscape page', 'MyFileName');

@seanebum
Copy link

These no longer seem to be working. When using 'A4Landscape page' or 'A4Portrait page' it seems to be giving the 'oops, something went wrong! TypeError: Cannot read properties of undefined (reading 'width')' error, still.

@seanebum
Copy link

Oops! Nevermind, the relevant option needs to be provided to sizeModes as well! (sizeModes=['A4Portrait'] to call printMap('A4Portrait page'))

@zirkusanion0v
Copy link

A4Portrait page works
A4Landscape page NOT

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