The WebViewer SDK is expansive, allowing you to do the following with PDFs inside your app:
You can also:
Adding WebViewer to your application allows users to use PDFs, .xlsx, and .docx files without going outside of your application. This reduces reliance on third-party systems, multiple vendors, and file downloads for everyday tasks without compromising control, compliance, or security.
Interact with our showcase demo to test out all of the Apryse WebViewer SDK functionality.
This guide walks you through how to integrate the WebViewer SDK into your Angular application via Angular version 20+ or Angular 19 or earlier. By the end, you'll be able to render a PDF document in the UI.
You can download a ready-to-go sample on GitHub.
Get started with the Apryse WebViewer SDK in an Angular project by viewing our video. This video includes instructions for successfully integrating WebViewer SDK into your Angular version 19 or earlier app. You can also skip the video and follow the steps below to get started.
Video on how integrate the Apryse WebViewer SDK into an Angular version 19 or earlier app.
Before you start:
Angular version 20+ is significantly different then earlier versions, mainly in file naming style. They've modernized the style and don't include redundant suffixes like .component.ts
by default in new projects. Because there is a difference in file names between newer and earlier versions, this get started guide includes instructions for both version(s) 20+ as well as earlier versions so you can get WebViewer SDK up and running quickly, no matter what version of Angular you're using.
If you already have an Angular project, skip to step 3.
Run the following on the command line:
The command installs the Angular CLI so you can use the CLI to scaffold (create) your Angular project. This command installs Angular version 20 or later.
Scaffold your Angular project next.
1. On the command line, cd
to where you want your new project to sit.
2. Run the following on the command line, replacing <project-name>
with whatever project name you choose:
You may be asked a set of questions during installation. Your answers to most of the questions won't matter to be able to get through the instructions below successfully.
For the question 'Do you want to enable Server-Side Rendering (SSR) and Static Site Generation (SSG/Prerendering)?', answer 'No'.
Enter the following on the command line to navigate into your new project:
Enter the following on the command line from within your project directory to install WebViewer into your Angular project:
You'll need to copy the static assets from the webviewer folder required for WebViewer to run using your text editor. The files are located in node_modules/@pdftron/webviewer/public
and must be moved into a location that will be served and publicly accessible. Angular has a built-in mechanism to do this. In Angular, the location of these static assets can be configured in the angular.json
file by updating the assets
array.
Add the following code to the assets
array:
output
value creates a new set of folders and moves the static assets to the lib/webviewer
folder.All default entries in the asset array that exist in the angular.json file should not be deleted. For example, "glob": "**/*", "input": "public".
angular.json
Next, create a WebViewer component that can be used across the app. You'll add code into new folders you create and existing default folders that are part of your Angular project.
Use the tabs below to select the Angular version you're using and follow the instructions based on the version.
1. Create a folder called webviewer
in src/app
.
2. Create a file called src/app/webviewer/webviewer.ts
and add the following code:
path
is the path to the copied static assets.initialDoc
parameter.viewer
.app/webviewer/webviewer.ts
3. Create an HTML file called app/webviewer/webviewer.html
so you can create an element for WebViewer to bind to. Add the following code to the file:
app/webviewer/webviewer.html
The code above adds a div element which contains a reference variable of viewer
that we just used in the TypeScript file. We've also specified some styling.
Now, you can use the component elsewhere in your app.
4. In app/app.ts
(or whatever file you want to use the component in), delete the default code and add the WebViewerComponent
to the imports like this:
<'project-name'>
for the title
in the code below.app/app.ts
5. Delete the existing code in the app/app.html
file. There's lots of code by default in this file and we don't need any of it.
6. In the file, mount WebViewer:
app/app.html
1. Create a folder called webviewer
in src/app
.
2. Create a file called src/app/webviewer/webviewer.component.ts
and add the following code:
path
is the path to the copied static assets.initialDoc
parameter.viewer
.src/app/webviewer/webviewer.component.ts
3. Create an HTML file called app/webviewer/webviewer.component.html
so you can create an element for WebViewer to bind to. Add the following code to the file:
app/webviewer/webviewer.component.html
The code above adds a div element which contains a reference variable of viewer
that we just used in the TypeScript file. We've also specified some styling.
Now, you can use the component elsewhere in your app.
4. In app/app.component.ts
(or whatever file you want to use the component in), delete the default code and add the WebViewerComponent
to the imports like this:
app/app.component.ts
5. Delete the existing code in the app/app.component.html
file. There's lots of code by default in this file and we don't need any of it.
6. In the file, mount WebViewer:
app/app.component.html
After you've saved all of the files, you'll serve the webpage so you can see the WebViewer UI and the PDF you included to open in WebViewer.
1. Run the following command on the command line from your project directory to run the project.
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.
2. Click the localhost link created in your terminal to view the WebViewer UI and PDF file locally.
Did you find this helpful?
Trial setup questions?
Ask experts on DiscordNeed other help?
Contact SupportPricing or product questions?
Contact Sales