This guide shows how to build an Angular PDF viewer using the Apryse WebViewer SDK. You'll learn how to integrate the SDK into an Angular application to render, view, and interact with PDF documents using the WebViewer UI.
You can also download a ready-to-use GitHub sample to get started quickly, or explore the interactive Showcase demo to see WebViewer's full capabilities in action.
This guide assumes basic familiarity with Angular development. Before you start:
Apryse collects some data regarding your usage of the SDK for product improvement.
If you wish to continue without data collection, contact us and we will email you a no-tracking trial key for you to get started.
In this section, you’ll create a new Angular application using npm. This project provides the foundation for integrating Apryse WebViewer. If you already have an Angular app, skip this and continue to Install WebViewer.
2. Navigate to the directory where you want to create the project.
3. Create a new webviewer-angular project using a minimal setup:
Flags are used to skip prompts during project configuration. The setup sets the CSS stylesheet format, disables server-side rendering (SSR) and prerendering, and accepts all defaults. Select different options if preferred.
4. Navigate to your new Angular project directory and install dependencies:
Next, install the Apryse WebViewer SDK using npm. This command adds the WebViewer package to your project, allowing you to integrate the PDF viewer and editor into your Angular application.
After navigating to your webviewer-angular project directory, run the following command to install WebViewer:
WebViewer requires access to its static assets at runtime, including WebAssembly modules, HTML, and CSS files. These assets are located in node_modules/@pdftron/webviewer/public. To ensure they’re served correctly, make them publicly accessible in your Angular application by configuring the assets array in angular.json. In this section, you’ll copy the required WebViewer assets to a location that Angular serves automatically. For more, see Copying WebViewer static assets.
angular.json file.angular.json file, update the assets array to include the following and save:angular.json
The output value creates a new set of folders and moves the static assets to the lib/webviewer folder.
You can add multiple entries to the assets array, each with its own input path. Don't modify or remove the default entries in angular.json. For example, keep entries such as {"glob": "**/*", "input": "public"}.
In this section, you'll add WebViewer to your Angular app by creating a component and initializing the viewer. This mounts the WebViewer UI and loads a document in your application.
webviewer folder in your project's src directory:2. Create webviewer.ts and webviewer.html files in the webviewer folder:
3. In Visual Studio Code, add this code to the webviewer.ts file and save:
src/webviewer/webviewer.ts
4. Add this code to the webviewer.html file and save:
src/webviewer/webviewer.html
5. Replace the src/app/app.ts file with the following and save:
src/app/app.ts
6. Replace the src/app/app.html file with the following and save:
src/app/app.html
You can now load and display a PDF document in the WebViewer UI. Run your Angular application to launch WebViewer and see the PDF in your browser.
1. From your project directory, run the following command to start the application:
You may get a warning message in the command line, as the project runs, that you're not using RouterOutlet correctly. You can ignore the warning.
A successful output looks similar to:
2. Open the localhost URL from your terminal to view the WebViewer UI and PDF document.
In this 5-minute video, learn how to install and integrate the Apryse WebViewer SDK into an Angular project.
Integrate the WebViewer SDK in an Angular (v20+) application.
Did you find this helpful?
Trial setup questions?
Ask experts on DiscordNeed other help?
Contact SupportPricing or product questions?
Contact Sales