Print and PDF Export
The timeline includes print optimized styling through the print add-on. This needs to be added to the download package or installed separately from a dedicated NPM package.
Print styling is applied when someone prints the page that contains the timeline. In addition to that, you can call the print method on the instance which grabs only the markup of the timeline, places it onto a temporary page and calls the browsers printing function. This is especially useful when you want to add a button to only print the timeline rather than the whole page.
Besides printing, PDF export is possible through the print dialog of the browser.
Demo
By calling the print method, the timeline will open a new window and print its content.
html<mbsc-eventcalendar #mycal
[view]="calView"
[modules]="calendarModules">
</mbsc-eventcalendar>
<mbsc-button (click)="printCal()">
Print timeline
</mbsc-button>
tsimport { print } from '@mobiscroll/print';
@Component({
selector: 'app-root',
templateUrl: './app.component.html'
})
export class AppComponent {
@ViewChild('mycal', { static: false })
inst!: MbscEventcalendar;
calendarModules = [print];
calView = {
timeline: {
type: 'week',
startDay: 1,
endDay: 5,
eventDisplay: 'fill'
}
};
printCal(): void {
this.inst.print();
}
}

import { CommonModule } from '@angular/common';
import { HttpClient } from '@angular/common/http';
import { Component, OnInit, ViewChild } from '@angular/core';
import {
MbscCalendarEvent,
MbscEventcalendar,
MbscEventcalendarView,
MbscModule,
MbscResource,
setOptions ,
} from '@mobiscroll/angular';
import { print } from '@mobiscroll/print';
setOptions({
locale: ,
theme: ' ',
themeVariant: ' '
});
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
standalone: true,
imports: [CommonModule, MbscModule],
})
export class AppComponent implements OnInit {
constructor(private http: HttpClient) {}
@ViewChild('mycal', { static: false })
inst!: MbscEventcalendar;
calendarModules = [print];
myEvents: MbscCalendarEvent[] = [];
myResources: MbscResource[] = [
{
id: 1,
name: 'Flatiron Room',
color: '#fdf500',
},
{
id: 2,
name: 'The Capital City',
color: '#ff0101',
},
{
id: 3,
name: 'Heroes Square',
color: '#01adff',
},
{
id: 4,
name: 'Thunderdome',
color: '#ff4600',
},
{
id: 5,
name: 'King’s Landing',
color: '#239a21',
},
{
id: 6,
name: 'Gathering Field',
color: '#8f1ed6',
},
];
calView: MbscEventcalendarView = {
timeline: {
type: 'week',
startDay: 1,
endDay: 5,
eventDisplay: 'fill',
},
};
printView(): void {
this.inst.print();
}
ngOnInit(): void {
this.http.jsonp<MbscCalendarEvent[]>('https://trial.mobiscroll.com/daily-weekly-events/', 'callback').subscribe((resp) => {
this.myEvents = resp;
});
}
}