Print panel - hslayers/hslayers-ng GitHub Wiki

Print the map

The print panel allows the user to print the rendered map and specify its name in the title.

Print panel

Enable/disable

import {HsConfig} from 'hslayers-ng/config';
@Component({
  selector: 'your-app-component',
  templateUrl: 'your-app-component.html',
})
export class YourAppComponent {
  constructor(hsConfig: HsConfig) {
    this.HsConfig.update({
      panelsEnabled: {
        print: true //(true by default)
      }
    });
  }
}

If not using HslayersModule containing all components

Add HsPrintModule import:

import {HsPrintModule} from 'hslayers-ng/modules/print';
@NgModule({
  imports: [HsPrintModule],
})
export class YourAppModule {}

Add HsPrintComponent component:

import {HsPrintModule} from 'hslayers-ng/modules/print';
import {HsLayoutService } from 'hslayers-ng/core';
@Component({
  selector: 'your-app-component',
  templateUrl: 'your-app-component.html',
})
export class YourAppComponent {
  constructor(hsLayoutService: HsLayoutService) {
    hsLayoutService.createPanel(HsPrintComponent, {});
  }
}