---
title: "Angular Agenda Printing the View Example | Mobiscroll"
component: "Agenda"
framework: "Angular"
library_version: "6.1.5"
url: "https://demo.mobiscroll.com/angular/agenda/printing-the-view"
---

# Printing the View - Angular Agenda demo

Print only the agenda — not the full page — using the Angular print add-on, with PDF export via the browser print dialog.

- [Live demo](https://demo.mobiscroll.com/angular/agenda/printing-the-view)
- [View code on GitHub](https://github.com/acidb/mobiscroll-demos-angular/tree/main/src/demos/eventcalendar/agenda/printing-the-view)
- This demo in other frameworks: [JavaScript](https://demo.mobiscroll.com/javascript/agenda/printing-the-view.md), [jQuery](https://demo.mobiscroll.com/jquery/agenda/printing-the-view.md), [React](https://demo.mobiscroll.com/react/agenda/printing-the-view.md), [Vue](https://demo.mobiscroll.com/vue/agenda/printing-the-view.md)

## Description

The agenda 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 print is called on a page that contains the agenda. In addition to that, you can call the `print` method on the instance which grabs only the markup of the agenda 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 agenda rather than the whole page.

Besides printing, PDF export is possible through the print dialog of the browser.

The **print module** is not available in the trial. You can try the live demo to see how it looks.

## What this demo shows

- Shows a monthly agenda view with events listed and grouped by date.
- **Printing** A `Print the agenda` button is displayed next to the month view on the left side and opens the browser print dialog, applying print styling so the agenda can be printed or exported to PDF.
- **Header navigation** The month and year label in the top left opens date navigation. The previous and next arrows and the Today button on the right move between months and jump back to the current date.
- **Agenda list:** The area below the header lists events for the selected month. Events in the agenda are grouped by date.
- **Sticky day headers** As the agenda scrolls vertically, each day stays visible with a sticky date header while its events appear underneath.
- **Events:** Events appear as agenda cards with a colored strip on the left and the event title next to it. Start and end times are stacked on the right side of timed events. All-day events show the all-day label on the right.
- **Event interaction:** Hovering an event highlights it.
- **Event selection:** Clicking an event selects and highlights it.

## Best for

- **Printable agendas** Creating printable agenda that can be shared or posted.
- **Schedules and planning** Preparing printed schedules, planning overviews, and event-based agendas for review or distribution.
- **Archiving and reporting** Printing or exporting agenda views for record-keeping, handouts, or browser-based PDF generation.

## Tutorial

By calling the `print` method, the agenda will open a new window and print its content.

```html
<mbsc-eventcalendar #mycal
    [view]="calView"
    [modules]="calendarModules">
</mbsc-eventcalendar>
<mbsc-button (click)="printCal()">
    Print agenda
</mbsc-button>
```

```ts
import { print } from '@mobiscroll/print';

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html'
})
export class AppComponent {
    @ViewChild('mycal', { static: false })
    inst!: MbscEventcalendar;
    calendarModules = [print];
    calView = {
        agenda: { type: 'month' }
    };
    printCal(): void {
        this.inst.print();
    }
}
```

## API used in this demo

- [`theme`](https://mobiscroll.com/docs/angular/eventcalendar/api#opt-theme) - option
- [`themeVariant`](https://mobiscroll.com/docs/angular/eventcalendar/api#opt-themeVariant) - option
- [`data`](https://mobiscroll.com/docs/angular/eventcalendar/api#opt-data) - option
- [`view`](https://mobiscroll.com/docs/angular/eventcalendar/api#opt-view) - option

## Code

### Component

```ts
import { CommonModule } from '@angular/common';
import { HttpClient } from '@angular/common/http';
import { Component, OnInit, ViewChild } from '@angular/core';
import {
  MbscCalendarEvent,
  MbscEventcalendar,
  MbscEventcalendarView,
  MbscModule,
  setOptions,
} from '@mobiscroll/angular';
import { print } from '@mobiscroll/print';

setOptions({
  theme: 'ios',
  themeVariant: 'light'
});

@Component({
  selector: 'app-root', 
  templateUrl: './app.component.html',
  standalone: true,
  imports: [CommonModule, MbscModule],
})
export class AppComponent implements OnInit {
  constructor(private http: HttpClient) {}

  @ViewChild('calendar', { static: false })
  calendar!: MbscEventcalendar;

  myEvents: MbscCalendarEvent[] = [];
  myModules = [print];
  myView: MbscEventcalendarView = {
    agenda: { type: 'month' },
  };

  print(): void {
    this.calendar.print();
  }

  ngOnInit(): void {
    this.http.jsonp<MbscCalendarEvent[]>('https://trial.mobiscroll.com/events/?vers=5', 'callback').subscribe((resp) => {
      this.myEvents = resp;
    });
  }
}
```

### Template

```html
<mbsc-page class="mds-full-height">
  <div class="mds-full-height mbsc-flex-col">
    <div class="mbsc-flex-none">
      <mbsc-button (click)="print()" startIcon="print">Print agenda</mbsc-button>
    </div>
    <div class="mds-overflow-hidden mbsc-flex-1-1">
      <mbsc-eventcalendar #calendar [data]="myEvents" [modules]="myModules" [view]="myView"></mbsc-eventcalendar>
    </div>
  </div>
</mbsc-page>
```

### CSS

```css
.mds-full-height {
  height: 100%;
}

.mds-overflow-hidden {
  overflow: hidden;
}
```

## Implementation notes

- Install `@mobiscroll/print` as a separate package. Import `print` from it and pass it to the Eventcalendar via the `modules` option: `modules: [print]`.
- Use `view: { agenda: { type: 'month' } }`. Load events from `https://trial.mobiscroll.com/events/?vers=5` via JSONP using `getJson(url, callback, 'jsonp')`. Angular: use `HttpClient.jsonp()`. For the imperative API, call `inst.setEvents(events)` in the callback.
- Get a reference to the component instance (Angular: use `@ViewChild` to get the `MbscEventcalendar` reference). Calling `inst.print()` extracts the calendar markup into a temporary page and invokes the browser print dialog.
- Wrap the layout in a `Page` component with a flex column: Button in a fixed-height top row, Eventcalendar filling the remaining height (`mbsc-flex-1-1`).

## Run it in your project

Running a demo locally requires a Mobiscroll trial or a license; setup is per framework at https://mobiscroll.com/docs/angular/getting-started/installation

## Related demos

- Previous: [Show Empty Days](https://demo.mobiscroll.com/angular/agenda/show-empty-days.md) - Display day headers for all dates in the Angular Agenda, including days without events — keep the full month visible in the agenda list.
