Skip to content

Print panel

Filip Leitner edited this page Apr 30, 2024 · 3 revisions

Print the map

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

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, {});
  }
}
Clone this wiki locally