This guide will show you how to integrate WebViewer Document Viewer & Editor into a NuxtJS application.
You can also download a ready-to-go sample on GitHub.
Prior to starting, you should have already installed Node and npm.
Get your Apryse trial key.
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.
This video teaches you the fundamentals of installing and initializing WebViewer in any web application. If you wish, you may skip this section and proceed to the steps below.
If you already have a NuxtJS app, skip to step 2.
To scaffold our project, we still start by running the following command (replacing <project-name>
with your desired project name)
You may be asked to install create-nuxt
, enter y
when prompted.
You will then be asked a set of questions - you can select whichever options you prefer for this step (your selections won't impact the rest of this guide).
After the project has been set up, navigate into your new project by running:
Next, we can install WebViewer by running:
In addition to installing WebViewer, we will need to set up a script to copy the static WebViewer dependencies into statically served folder in your project (in NuxtJS it's the public
folder). The reason for this is because WebViewer contains many assets that cannot be bundled by the build system. Instead, these assets need to be served statically.
In package.json
we will add a command that copies these static assets to our public
folder. You'll also notice that we run this new command before any of the Nuxt tools to ensure the files are always in the proper place when running our app.
package.json
Read more about copying WebViewer static assets.
Now we are ready to implement WebViewer into our app.
Create a file called components/WebViewer.vue
(create the components
folder if it doesn't exist) and add the following code.
components/WebViewer.vue
This code imports WebViewer and mounts it to a div that we set up in the template section.
Now we can use this component anywhere else in our app. For example, in app.vue
we can use this new component like so:
app.vue
Now if we run our dev server with npm run dev
, you should see WebViewer mounted with the default file loaded.
Did you find this helpful?
Trial setup questions?
Ask experts on DiscordNeed other help?
Contact SupportPricing or product questions?
Contact Sales