Integrate Apryse WebViewer into Sharepoint
In this guide, you'll integrate Apryse WebViewer into SharePoint Online as a web part. You'll do this by cloning the SharePoint sample repository, then integrating WebViewer with the clone.
Prerequisites
You'll need to do the following before you start:
Install SPFx: v1.21.1.
Install Node Version Manager (optional, but recommended).
Get your Apryse trial key.
Set up your Sharepoint dev environment. You'll also need to be familiar with using the Sharepoint dev environment. If you're not familiar with using the environment, create some sample projects using the environment first.
For step-by-step help on setting up a SharePoint development environment, see the following:
Sharepoint web part setup, development, and deployment
1. Initial Setup
Ensure you're running Node.js version
v22.21.0. You can check by running the following in the console:
Enable the custom scripts by following the Microsoft Guide and configuration guide. It may take up to 24hrs for the configuration to to complete.
If you are on a Windows machine, you can achieve this using the SharePoint Online Management Shell and the following commands:
If you are on a MacOS machine, you can achieve this with the PnP Powershell by using the following commands:
In the Document Library of your SharePoint site, create a Webviewer folder.

Create a child folder, js, inside the Webviewer folder.

Upload the lib folder extracted from the
WebViewer.zipto the js folder.


The webviewer lib folder is now available from the url https://.sharepoint.com/sites//Shared Documents/Webviewer/js/lib.
Development
Clone the
sharepoint-integration-examplessample from github:
Enter the sharepoint-web-part folder and use
npmto installgulp,yeomanandMicrosoft SharePoint Generator:
Install all the packages through the following command:
Create a
.envfile in the sharepoint-web-part folder and include the following parameters in the.envfile:
Change the
initialPageproperty insharepoint-web-part/config/serve.jsonby replacing it with your tenant id and SharePoint site name.
Run the following to start the web part in the workbench:
If this is your first time setting up the SharePoint Framework, you must call the following:
After your local SharePoint instance is running, you should see a blank SharePoint canvas like in the screenshot below. You can add an Apryse WebViewer web part by adding a new web part to the page and selecting the webviewer web part.



You can now open a local file in the Webviewer.


Deployment
Run the folllowing to generate the
webviewer.sppkgfile in the sharepoint-web-part/sharepoint folder:
Navigate to the SharePoint admin center, then go to the More features page. It should be
https://<your-tenant-id>-admin.sharepoint.com/_layouts/15/online/AdminHome.aspx#/classicFeatures.Click the Open button under the App section.


Click the Upload button to upload the
webviewer.sppkgfile, then select thewebviewer.sppkgfile.

After uploading, enable the app by selecting Only enable this app.

Click the Settings button on the top right in the SharePoint site, then click Add an app.
Enable the
webviewer-client-side-solutionin My Apps.

Click + New button, then select Site Page to create a new site page in the SharePoint site.


Rename the page to Webviewer, then add a one column section.

Click the + button in the new section, select the webviewer web part, then publish the page.





Integrate with SharePoint extension
To open files in SharePoint Documents Library, you must integrate with SharePoint extension. This extension allows you to add a button to any List View in SharePoint, such as your document libraries. You'll be adding a Open in Apryse Button as a menu option to open and process any documents in Webviewer.
Get started
Create a
.envfile within the sharepoint-extension folder in the sharepoint-integration-examples repository. Add the following parameters in the.envfile:
In the sharepoint-extension in the terminal, Run the following:
Change the
pageUrlin theserve.jsonin the sharepoint-extension/config folder by replacing the tenant id and site name:
Run the following command:
This will generate a new window in the Document Library, and, a popup and warning for you to allow debug scripts.
Select the
Load debug scriptsoption in the popup.

You should be able to see the
Open in Aprysebutton after right click on a document in the Document Library.

Click the
Open in Aprysebutton and it will direct you to the page, by default, that you specified in the.envfile. In this case, it should be thehttps://<your-tenant-id>.sharepoint.com/sites/<site-name>/SitePages/<site-page>.aspxpage that has the webviewer web part.
Deploy the extension
Use the following commands, similar to deploying the SharePoint Web Part, to generate the
sharepoint-extension.sppkgfile in the sharepoint-extension/sharepoint/solution folder:
Upload the
sharepoint-extension.sppkgfile to the Apps in SharePoint Admin center and enable it for the website.
Next step
Last updated
Was this helpful?