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:

1WebViewer({
2 path: 'lib',
3 fullAPI: true,
4 }, document.getElementById('viewer'))
5.then(function(instance) {
6 var PDFNet = instance.PDFNet;
7
8 var newDoc;
9
10 PDFNet.runWithoutCleanup(function() {
11 //create an empty document
12 return PDFNet.PDFDoc.create()
13 .then(function(doc) {
14 newDoc = doc;
15 newDoc.initSecurityHandler();
16 newDoc.lock();
17 return PDFNet.Filter.createURLFilter("./files/test.tif");
18 })
19 .then(function(tiffFile) {
20 return PDFNet.Convert.fromTiff(newDoc, tiffFile);
21 }).then(function() {
22 newDoc.unlock();
23 instance.loadDocument(newDoc);
24 });
25 });
26});

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales