Frameworks
Integrations
Mendix
SharePoint
Modular UI
Legacy UI
AnnotationManager
Annotation Types
Customize
Version 11
Version 10
v10.12
v10.11
v10.10
v10.9
v10.8
v10.7
v10.6
v10.5
v10.4
v10.3
v10.2
v10.1
v10.0
Version 8
v8.12
v8.11
v8.10
v8.9
v8.8
v8.7
v8.6
v8.5
v8.4
v8.3
v8.2
v8.1
v8.0
Version 7
Version 6
v6.3
v6.2
v6.1
v6.0
Version 5
Version 4
Version 3
Version 2
WebViewer Server
WebViewer BIM
This guide will help you integrate a free trial of WebViewer into Mendix application on the browser.
Prior to starting, you should have already installed Node and npm.
Get your Apryse trial key.
Download WebViewer Mendix Web Widget and extract it.
Open Mendix Studio Pro and create a new project by selecting File > New Project
from the top menu bar, and choose the Blank
app.
After creating a new app, or inside of the existing app navigate to the app's directory and create a new folder called CustomWidgets/webViewer
and place the extracted contents from WebViewer Mendix Web Widget.
By default, Mendix projects are stored in:
In terminal or command line navigate to CustomWidgets/webViewer
and run:
After the command completes, run:
This will make a build of the Mendix Web Widget with the latest version of WebViewer, and it will be complete when you see something like this in your terminal:
Next, we must copy the static assets required for WebViewer to run. The files are located in CustomWidgets/webViewer/node_modules/@pdftron/webviewer/public
and must be moved into a location that will be served and publicly accessible. In Mendix, we can place it into theme/resources
. Create a new folder called lib
and place the contents from node_modules/@pdftron/webviewer/public
there. theme/resources
should have a directory structure like so:
Domain Model
of the module where the viewer will be integrated, and create a new Entity
.Entity
, click Add > Attribute
. Leave everything as is, and ensure its Type
is set to String
.Data view
widget by dragging it from the Toolbox. If you do not have a the Toolbox
window open on the right, the bottom right corner of the window should have the Toolbox
tab as an option. Double-click the widget, and give it a data source microflow by selecting Data source > Type > Microflow
.Select
button and press New
.parameter
object (the object that has has U
and (Not set)
underneath) and drag Create object
from the toolbox onto the arrow. Open the object by double-clicking on it and select the entity we created earlier.Create Entity
activity, then click Set $NewEntity as Return Value
.data view
, and drag Text box
into data view
. Open the textbox's properties, find the Data source
panel, and change the Attribute
(path) to the string attribute you created in Steps 1 and 2.Project > Synchronize Project Directory
.data view
, in the Toolbar
, under Add-on widgets
you should now see Web Viewer
. Drag into the data view
. Right-click on Web Viewer
widget and select Attribute by selecting Attribute string you have created.Run Locally
at the top.The WebViewer now loads inside of your page with the default file. Now let's connect the Attribute parameter to be accessible by the WebViewer. Attribute parameter can be used to pass a URL to open specific document.
App/CustomWidgets/webViewer
and open it in your favourite code editor.src/components/PDFViewer.tsx
. Inside of it, you can see WebViewer constructor where you can pass various customization options and call APIs on the instance object. The Attribute that you have created in previous steps is passed in props.value
:In the code snippet, we are listening for any of the changes in props
and then calling loadDocument
API to load a new document. You can connect it with your existing flows or pass URLs from your file storage. Make sure you have the CORS configured in case you run into any errors.
You can now customize the widget by checking out other guides we have available. Perform your customizations inside of src/components/PDFViewer.tsx
. Do not forget to run npm run dev
within the Widget's console or terminal and update the files in your App by pressing F4, or from the top menu bar selecting Project > Synchronize Project Directory
.
You can now checkout other guides like how to open your own documents or how to disable certain features.
Did you find this helpful?
Trial setup questions?
Ask experts on DiscordNeed other help?
Contact SupportPricing or product questions?
Contact Sales