Some .tiff files are not getting viewed from pdf.js

3

I am working on 1 application in which user can upload files and application shows preview of uploaded file using pdf.js. Server side code is:

byte[] content= new BASE64Decoder().decodeBuffer(documentVO.getDocument());
                  outPutStream.write(content, 0, content.length);
                  responseReturn.setContentType("application/pdf");

Problem is for some of the .tiff files preview is not shown and following warning gets displayed on console. Warning: Unhandled rejection: [Exception... "Component is 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: no] 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 some of the .tiff files are getting this warning and preview is not shown.

NOTE: If I convert these .tiff files to pdf from any online tiff to pdf converter then it is getting converted without any error, so no issue with the files I guess.

java
javascript
pdf.js
asked on Stack Overflow Nov 26, 2014 by pan1490

1 Answer

0

PDF.js can not render a tiff. It needs a PDF as input file. In case you have a "real pdf" which produces the problem, please report it at https://github.com/mozilla/pdf.js/issues/new and make sure to provide the pdf which is not working.

answered on Stack Overflow Jun 2, 2015 by Fabian Lange

User contributions licensed under CC BY-SA 3.0