Some test text!

Search
Hamburger Icon

Web / FAQ / How to load a tiff file?

How to load a TIFF file in WebViewer?

WebViewer requires the Full API to load a TIFF file. See this guide for how to setup full API.

You can then use the full API to manually create a document, add the TIFF image to the document and load the document in WebViewer:

WebViewer({
    path: 'lib',
    fullAPI: true,
  }, document.getElementById('viewer'))
.then(function(instance) {
  var PDFNet = instance.PDFNet;

  var newDoc;
  
  PDFNet.runWithoutCleanup(function() {
    //create an empty document
    return PDFNet.PDFDoc.create()
      .then(function(doc) {
        newDoc = doc;
        newDoc.initSecurityHandler();
        newDoc.lock();
        return PDFNet.Filter.createURLFilter("./files/test.tif");
      })
      .then(function(tiffFile) {
        return PDFNet.Convert.fromTiff(newDoc, tiffFile);
      }).then(function() {
        newDoc.unlock();
        instance.loadDocument(newDoc);
      });
  });
});

Get the answers you need: Chat with us