Syncfusion AI Assistant

How can I help you?

Enable print rotation in Angular PDF Viewer

13 Apr 20262 minutes to read

This guide shows how to enable automatic rotation of landscape pages during printing so they match the paper orientation and reduce clipping. Use enablePrintRotation when printing documents that include landscape pages and you want them rotated to match the printer paper orientation.

Prerequisites

Steps to enable print rotation

  1. Inject the required modules (including Print) into PdfViewerComponent.
  2. Set enablePrintRotation to true in the PDF Viewer during initialization.

Example

import { Component, ViewChild, OnInit } from '@angular/core';
import {
  PdfViewerComponent,
  PdfViewerModule,
  LinkAnnotationService,
  BookmarkViewService,
  MagnificationService,
  ThumbnailViewService,
  ToolbarService,
  NavigationService,
  TextSearchService,
  TextSelectionService,
  PrintService,
  AnnotationService,
  FormFieldsService,
  FormDesignerService,
  PageOrganizerService,
} from '@syncfusion/ej2-angular-pdfviewer';

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [PdfViewerModule],
  providers: [
    LinkAnnotationService,
    BookmarkViewService,
    MagnificationService,
    ThumbnailViewService,
    ToolbarService,
    NavigationService,
    TextSearchService,
    TextSelectionService,
    PrintService,
    AnnotationService,
    FormFieldsService,
    FormDesignerService,
    PageOrganizerService,
  ],
  template: `
      <ejs-pdfviewer
        #pdfviewer
        id="PdfViewer"
        [documentPath]="document"
        [resourceUrl]="resource"
        [enablePrintRotation]="true"
        style="height: 100vh; width: 100%; display: block"
      >
      </ejs-pdfviewer>
    `,
})
export class AppComponent implements OnInit {
  @ViewChild('pdfviewer')
  public pdfviewerControl!: PdfViewerComponent;

  public document: string =
    'https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf';

  public resource: string =
    'https://cdn.syncfusion.com/ej2/23.2.6/dist/ej2-pdfviewer-lib';

  ngOnInit(): void {
    // Initialization logic (if needed)
  }
}

Print rotation demo showing landscape pages rotated for printing

View sample on GitHub

Troubleshooting

  • If you need to preserve original page orientation for archival printing, set enablePrintRotation to false.
  • Confirm that injected modules include Print or the property will have no effect.

See also