@geosdi/ngx-leaflet-print-plugin
v1.1.9
Published
Service to add print to map
Downloads
4
Maintainers
Readme
NgxLeafletPrint
This library was generated with Angular CLI version 13.0.0.
General information
Service to wrap leaflet.browser.print see documentation to https://github.com/Igor-Vladyka/leaflet.browser.print
Installation
npm i @geosdi/ngx-leaflet-print-plugin --save
It depends on :
"@angular/common": ">=13.0.0",
"@angular/core": ">=13.0.0",
"typescript": ">=4.4.4",
"leaflet": ">=1.7.1",
"leaflet.browser.print": "^1.0.6"
Usage
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class BootstrapService {
constructor(private ngxLeafletPrintPluginService: NgxLeafletPrintPluginService) {
}
public initBaseMaps() {
this.ngxLeafletPrintPluginService
.withCustom('Custom Label')
.withLandscape()
.withPortrait()
.withAuto()
.withTitle("TITLE")
.withDocumentTitle("DOCUMENT")
.withClosePopupsOnPrint(true)
.withCustomPrintStyle('{ color: "red", dashArray: "5, 10", pane: "customPrintPane" }')
.withPosition('topright')
.withLayer(layer)
.withMap(this.map).addPrintPlugin();
}
}
Methods
| Method | action | ------------- | ------------- | | withLandscape(title? : string, pageSize?: string, action? : any): ILeafletPrintPluginService | L.control.browserPrint.mode.landscape(title, pageSize, action) | | withPortrait(title? : string, pageSize?: string, action? : any): ILeafletPrintPluginService | L.control.browserPrint.mode.portrait(title, pageSize, action)| | withCustom(title? : string, pageSize?: string, action? : any): ILeafletPrintPluginService | L.control.browserPrint.mode.custom(title, pageSize, action)| | withAuto(title? : string, pageSize?: string, action? : any): ILeafletPrintPluginService| L.control.browserPrint.mode.auto(title, pageSize, action)| | withPosition(position: 'topleft' or 'topright' or 'bottomleft' or 'bottomright'): ILeafletPrintPluginService| position of the button| | withMap(map: any): ILeafletPrintPluginService| the leaflet map| | withLayer(layer: any): ILeafletPrintPluginService| base layer| | withCustomPrintStyle(customPrintStyle: string): ILeafletPrintPluginService| Style for rectangle on custom print. 'customPrintPane' - is a custom pane with z-index => 9999| | withDocumentTitle(documentTitle: string): ILeafletPrintPluginService| Sets the text which appears as the print page title| | withTitle(title: string): ILeafletPrintPluginService| Sets the text which appears as the tooltip of the print button| | withClosePopupsOnPrint(closePopupsOnPrint: boolean): ILeafletPrintPluginService| ndicates if we need to force popup closing for printed map| | withContentSelector(contentSelector: string): ILeafletPrintPluginService| Content selector for printed map, will select and dynamically inject content on printed maps. For full functionality please check "Printing additional content section"| | withPagesSelector(pagesSelector: string): ILeafletPrintPluginService| Pages selector for printed map, will select and dynamically inject additional pages content on printed maps.| | withManualMode(manualMode: boolean): ILeafletPrintPluginService| Adds a button with id='leaflet-browser-print--manualMode-button' for debugging purpose, also can be used to print map with external button.| | addPrintPlugin(): void| add plugin to map|