Viewing with Custom Server (XOD)

Shows how to load XOD files, which are generated from a custom server.

1WebViewer(
2 {
3 path: '../../../lib',
4 initialDoc: '../../../samples/files/demo-annotated.xod',
5 },
6 document.getElementById('viewer')
7).then(instance => {
8 samplesSetup(instance);
9
10 document.getElementById('select').onchange = e => {
11 if (e.target.value === 'https://pdftron.s3.amazonaws.com/downloads/pl/encrypted-foobar12.xod') {
12 instance.UI.loadDocument(e.target.value, {
13 decrypt: instance.Core.Encryption.decrypt,
14 decryptOptions: {
15 p: 'foobar12',
16 type: 'aes',
17 error: msg => {
18 alert(msg);
19 },
20 },
21 });
22 } else {
23 instance.UI.loadDocument(e.target.value);
24 }
25 };
26
27 document.getElementById('file-picker').onchange = e => {
28 const file = e.target.files[0];
29 if (file) {
30 instance.UI.loadDocument(file);
31 }
32 };
33
34 document.getElementById('url-form').onsubmit = e => {
35 e.preventDefault();
36 instance.UI.loadDocument(document.getElementById('url').value);
37 };
38});

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales