Some test text!

Loading...
Guides

Viewing a Document with Custom Server (XOD)

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

Get Started Samples Download

To run this sample, get started with a free trial of PDFTron SDK.

JavaScript

HTML

WebViewer(
  {
    path: '../../../lib',
    initialDoc: '../../../samples/files/demo-annotated.xod',
  },
  document.getElementById('viewer')
).then(instance => {
  samplesSetup(instance);

  document.getElementById('select').onchange = e => {
    if (e.target.value === 'https://pdftron.s3.amazonaws.com/downloads/pl/encrypted-foobar12.xod') {
      instance.UI.loadDocument(e.target.value, {
        decrypt: instance.Core.Encryption.decrypt,
        decryptOptions: {
          p: 'foobar12',
          type: 'aes',
          error: msg => {
            alert(msg);
          },
        },
      });
    } else {
      instance.UI.loadDocument(e.target.value);
    }
  };

  document.getElementById('file-picker').onchange = e => {
    const file = e.target.files[0];
    if (file) {
      instance.UI.loadDocument(file);
    }
  };

  document.getElementById('url-form').onsubmit = e => {
    e.preventDefault();
    instance.UI.loadDocument(document.getElementById('url').value);
  };
});

UPCOMING WEBINAR: Live tech update and run-through. October 21 @ 11am PDT