WebViewer Version:8.8.0
I fetched the byte array of tiff file from server. I wanted to load that file in web viewer. But I couldn’t load it.
Angular code I used is:
const imgByteArray = await this.getImage() //fetch the tiff file byte array from server.
const blob = new Blob([new Uint8Array(imgByteArray )], { type: ‘image/tiff’ }) //convert the byte array to blob
instance.UI.loadDocument(blob) //load the blob
Above code didn’t work so i tried with following code:
const img: any = await this.getImage()
const blob = new Blob([new Uint8Array(img)], { type: ‘image/tiff’ })
const url = URL.createObjectURL(blob)
await instance.Core.PDFNet.runWithoutCleanup(async () => {
//create an empty document
doc = await instance.Core.PDFNet.PDFDoc.create();
doc.initSecurityHandler();
doc.lock();
const tiffFile = await instance.Core.PDFNet.Filter.createURLFilter(url);
await instance.Core.PDFNet.Convert.fromTiff(doc, tiffFile);
const buffer = await doc.saveMemoryBuffer(instance.Core.PDFNet.SDFDoc.SaveOptions.e_linearized);
doc.unlock();
}, '');
instance.UI.loadDocument(doc)
With this code, i got the following error:
Message: An error occurred while converting the TIFF.
Detailed error:
Exception:
Message: filter does not contain enough image data
Conditional expression: flt->Size() > 8
Version : 9.3.0-64b49865f
Platform : Emscripten
Architecture : Emscripten
Filename : Image.cpp
Function : CreateImagesFromMultipageTIFF
Linenumber : 1683
Filename: Convert.cpp
Function: FromTiff
Linenumber: Ϳ��>ڂa�?
Error: Uncaught (in promise): Exception:
Message: An error occurred while converting the TIFF.
Detailed error:
Exception:
Message: filter does not contain enough image data
Conditional expression: flt->Size() > 8
Version : 9.3.0-64b49865f
Platform : Emscripten
Architecture : Emscripten
Filename : Image.cpp
Function : CreateImagesFromMultipageTIFF
Linenumber : 1683
Filename: Convert.cpp
Function: FromTiff
Linenumber: Ϳ��>ڂa�?
Pls suggest how can we load the tiff file when we have byte array of the tiff.