Some .tiff files are not viewable from pdf.js
I am working on one application where the user can upload files and the application shows a preview of the uploaded file using pdf.js. Server side code:
byte[] content= new BASE64Decoder().decodeBuffer(documentVO.getDocument());
outPutStream.write(content, 0, content.length);
responseReturn.setContentType("application/pdf");
The problem is that some of the .tiff files are not showing and the following warning is displayed on the console. Warning: Unhandled Rejection: [Exception ... "Component not available" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: http://tmc.pw.com:8080/dpg2/Viewer.js/pdf.js :: CanvasGraphics_paintJpegXObject :: line 6511 "data: none] CanvasGraphics_paintJpegXObject @ http://tmc.pw.com:8080/dpg2/Viewer.js/pdf.js:6511 0 CanvasGraphics_executeOperatorList @ http://tmc.pw.com : 8080 / dpg2 / Viewer.js / pdf.js: 5467: 10 InternalRenderTask__next @ http://tmc.pw.com:8080/dpg2/Viewer.js/pdf.js:4846:29 InternalRenderTask__continue @ http: // tmc .pw.com: 8080 / dpg2 / Viewer.js / pdf.js:4838: 8 InternalRenderTask_operatorListChanged @ http://tmc.pw.com:8080/dpg2/Viewer.js/pdf.js:4827:6 pageDisplayReadyPromise @ http://tmc.pw.com:8080/dpg2/Viewer.js/pdf.js : 4154: 10 runHandlers @ http://tmc.pw.com:8080/dpg2/Viewer.js/pdf.js:810:26
Only a few of the .tiff files receive this warning and no preview is displayed.
NOTE . If I convert these .tiff files to pdf from any online tiff to pdf converter, then it converts without any errors, so no problem with the files I assume.
source to share
PDF.js cannot display tiff. PDF is required as input file. If you have a "real pdf" that is creating an issue, please report it at https://github.com/mozilla/pdf.js/issues/new and be sure to provide a pdf that is not work.
source to share