rowanwins / leaflet-easyPrint

A leaflet plugin which adds an icon to print the map - Demo @ http://rowanwins.github.io/leaflet-easyPrint/
MIT License
248 stars 137 forks source link

Uncaught TypeError: printer.easyPrint is not a function at eval in typescript #119

Open yog3sha opened 3 years ago

yog3sha commented 3 years ago

I am unable to find easyPrint function to call it in typescript. I have created leaflet map in my Vue+TS app using component imports as follows import { LMap, LTileLayer, LMarker, LPopup, LIcon, LControl } from "vue2-leaflet"; import 'leaflet-easyprint'; import { EasyPrintControl, EasyPrintOptions } from '../../leaflet-easyprint';

And I am trying to print map as follows: ` const printer = L.easyPrint({ hidden: false, exportOnly: false });

printer.easyPrint({
  hidden: false,
  exportOnly: false
});

`

dario85-dev commented 3 years ago

i've done like this in angular

import * as L from 'leaflet'; import 'leaflet-easyprint';

this.printControl = (L as any).easyPrint({ title: 'Print Me', position: 'bottomleft', sizeModes: ['Current'], filename: this.uid, exportOnly: true, tileWait: 4000, hidden: true, hideControlContainer: true }).addTo(this.map);

this.printControl.printMap('CurrentSize');