1.1.1 • Published 12 months ago

@geosdi/ngx-leaflet-print-plugin v1.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
12 months ago

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

Methodaction
withLandscape(title? : string, pageSize?: string, action? : any): ILeafletPrintPluginServiceL.control.browserPrint.mode.landscape(title, pageSize, action)
withPortrait(title? : string, pageSize?: string, action? : any): ILeafletPrintPluginServiceL.control.browserPrint.mode.portrait(title, pageSize, action)
withCustom(title? : string, pageSize?: string, action? : any): ILeafletPrintPluginServiceL.control.browserPrint.mode.custom(title, pageSize, action)
withAuto(title? : string, pageSize?: string, action? : any): ILeafletPrintPluginServiceL.control.browserPrint.mode.auto(title, pageSize, action)
withPosition(position: 'topleft' or 'topright' or 'bottomleft' or 'bottomright'): ILeafletPrintPluginServiceposition of the button
withMap(map: any): ILeafletPrintPluginServicethe leaflet map
withLayer(layer: any): ILeafletPrintPluginServicebase layer
withCustomPrintStyle(customPrintStyle: string): ILeafletPrintPluginServiceStyle for rectangle on custom print. 'customPrintPane' - is a custom pane with z-index => 9999
withDocumentTitle(documentTitle: string): ILeafletPrintPluginServiceSets the text which appears as the print page title
withTitle(title: string): ILeafletPrintPluginServiceSets the text which appears as the tooltip of the print button
withClosePopupsOnPrint(closePopupsOnPrint: boolean): ILeafletPrintPluginServicendicates if we need to force popup closing for printed map
withContentSelector(contentSelector: string): ILeafletPrintPluginServiceContent 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): ILeafletPrintPluginServicePages selector for printed map, will select and dynamically inject additional pages content on printed maps.
withManualMode(manualMode: boolean): ILeafletPrintPluginServiceAdds a button with id='leaflet-browser-print--manualMode-button' for debugging purpose, also can be used to print map with external button.
addPrintPlugin(): voidadd plugin to map
1.1.1

12 months ago

1.1.0

1 year ago

1.0.6

1 year ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.3

2 years ago

1.0.0

3 years ago