{"id":16386494,"url":"https://github.com/rowanwins/leaflet-easyprint","last_synced_at":"2025-04-12T21:21:44.562Z","repository":{"id":18263211,"uuid":"21422064","full_name":"rowanwins/leaflet-easyPrint","owner":"rowanwins","description":"A leaflet plugin which adds an icon to print the map - Demo @ http://rowanwins.github.io/leaflet-easyPrint/","archived":false,"fork":false,"pushed_at":"2022-02-15T10:24:16.000Z","size":131,"stargazers_count":255,"open_issues_count":64,"forks_count":140,"subscribers_count":23,"default_branch":"gh-pages","last_synced_at":"2025-04-05T23:26:14.769Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rowanwins.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-02T11:43:22.000Z","updated_at":"2025-03-28T08:19:19.000Z","dependencies_parsed_at":"2022-07-26T21:32:13.242Z","dependency_job_id":null,"html_url":"https://github.com/rowanwins/leaflet-easyPrint","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rowanwins%2Fleaflet-easyPrint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rowanwins%2Fleaflet-easyPrint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rowanwins%2Fleaflet-easyPrint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rowanwins%2Fleaflet-easyPrint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rowanwins","download_url":"https://codeload.github.com/rowanwins/leaflet-easyPrint/tar.gz/refs/heads/gh-pages","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248632535,"owners_count":21136707,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T04:17:25.725Z","updated_at":"2025-04-12T21:21:44.528Z","avatar_url":"https://github.com/rowanwins.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## leaflet-easyPrint\nA simple [leaflet](http://www.leafletjs.com) plugin which adds an icon to print or export a map. \n\n## Features\n* Supports resizing to predefined sizes (A4 Landscape \u0026 Portrait) as well as custom sizes\n* Supports saving to png, as well as printing\n* Compatible with both Leaflet v1+ and 0.7\n* Tested on Chrome, Firefox\n  * Incompatible with IE \u0026 Edge due to `dom-to-image` dependency\n\nCheck out the [demo](http://rowanwins.github.io/leaflet-easyPrint/).\n\n### Download\nYou can either download this repo directly or install via NPM.\n````\nnpm install leaflet-easyprint\n````\n\n### Options\nYou can pass a number of options to the plugin to control various settings.\n\n| Option        | Type         | Default      | Description   |\n| ------------- |--------------|--------------|---------------|\n| title | string | 'Print map' | Sets the text which appears as the tooltip of the print/export button |\n| position | [Leaflet control position](http://leafletjs.com/reference-1.1.0.html#controls) | 'topleft' | Positions the print button |\n| sizeModes | array | `Current` | Options available include `Current`, `A4Portrait`, `A4Landscape` or a [custom size object](#custom-print-sizes) |\n| defaultSizeTitles | object | `{Current: 'Current Size', A4Landscape: 'A4 Landscape', A4Portrait: 'A4 Portrait'}`| button tooltips for the default page sizes |\n| exportOnly | Boolean | `false` | If set to `true` the map is exported to a png file |\n| tileLayer | [Leaflet tile layer](http://leafletjs.com/reference-1.1.0.html#tilelayer) | `null` | A tile layer that you can wait for to draw (helpful when resizing) |\n| tileWait | Integer | 500 | How long to wait for the tiles to draw (helpful when resizing) |\n| filename | string | 'map' | Name of the file if export only option set to true |\n| hidden | Boolean | false | Set to true if you don't want to display the toolbar. Instead you can create your own buttons or fire print events programmatically. You still need to call `addTo(map)` to set the leaflet map context. |\n| hideControlContainer | Boolean | true | Hides the leaflet controls like the zoom buttons and the attribution on the print out. |\n| hideClasses | array | [] | Hides classes on the print out. Use an array of strings as follow : ['div1', 'div2'] |\n| customWindowTitle | string | Defaults to title of map window. | A title for the print window which will get added the printed paper. |\n| spinnerBgColor | string | '#0DC5C1' | A valid css colour for the spinner background color. |\n| customSpinnerClass | string | 'epLoader' | A class for a custom css spinner to use while waiting for the print. |\n\n\n### Example\n````\nL.easyPrint({\n\ttitle: 'My awesome print button',\n\tposition: 'bottomright',\n\tsizeModes: ['A4Portrait', 'A4Landscape']\n}).addTo(map);\n````\n\n### Methods / Using programmatically\n| Method        | Options      | Description   |\n| --------------|--------------|--------------|\n| printMap(size, filename) | Print size name, either 'CurrentSize', 'A4Portrait', 'A4Landscape', or the `className` of a custom size. And a filename | Manually trigger a print operation |\n````\nvar printPlugin = L.easyPrint({\n\thidden: true,\n\tsizeModes: ['A4Portrait']\n}).addTo(map); \nprintPlugin.printMap('A4Portrait', 'MyFileName');\n````\n\n\n### Custom Print Sizes\nYou can create additional print sizes by passing in some options. Width \u0026 Height are defined in pixels at 90DPI. THe css class ought to contain a background base64 encoded svg image.\n````\nvar a3Size = {\n\twidth: 2339,\n\theight: 3308,\n\tclassName: 'a3CssClass',\n\ttooltip: 'A custom A3 size'\n}\n\n// in css \n.easyPrintHolder .a3CssClass { \n  background-image: url(data:image/svg+xml;utf8;base64,PD9...go=);\n}\n````\n\n### Acknowledgements\nHuge hats off go to [mourner](https://github.com/mourner) and all the [contributors](https://github.com/Leaflet/Leaflet/graphs/contributors) to the leaflet.js project, it's an amazing piece of open source software!\n\nAlso uses [dom-to-image](https://github.com/tsayen/dom-to-image) and [FileSaver](https://github.com/eligrey/FileSaver.js) under the hood.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frowanwins%2Fleaflet-easyprint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frowanwins%2Fleaflet-easyprint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frowanwins%2Fleaflet-easyprint/lists"}