【问题标题】:Some .tiff files are not getting viewed from pdf.js某些 .tiff 文件未从 pdf.js 查看
【发布时间】:2015-01-24 10:44:48
【问题描述】:

我正在开发 1 个应用程序,用户可以在其中上传文件,并且应用程序使用 pdf.js 显示上传文件的预览。服务器端代码为:

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

问题是某些 .tiff 文件预览未显示,并且控制台上显示以下警告。 警告:未处理的拒绝:[异常...“组件不可用”nsresult:“0x80040111(NS_ERROR_NOT_AVAILABLE)”位置:“JS 框架 :: http://tmc.pw.com:8080/dpg2/Viewer.js/pdf.js :: CanvasGraphics_paintJpegXObject :: line 6511”数据:否] 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

只有部分 .tiff 文件收到此警告且不显示预览。

注意:如果我将这些 .tiff 文件从任何在线 tiff 到 pdf 转换器转换为 pdf,那么它会在没有任何错误的情况下进行转换,所以我猜这些文件没有问题。

【问题讨论】:

  • pdf.js中存在open bug:github.com/mozilla/pdf.js/issues/2802
  • 您的意思是您的 tiff-to-pdf 转换器生成无效的 PDF,而其他在线转换器生成好的 PDF?您联系 viewer.js 支持了吗?
  • @async5 我真的不知道问题出在 viewer.js 还是在将 tiff 转换为 pdf 时。但从后端没有例外,在 UI 上显示上述错误
  • 我认为问题是在将 .tiff 转换为 pdf 时,但没有例外

标签: java javascript pdf.js


【解决方案1】:

PDF.js 无法呈现 tiff。它需要一个 PDF 作为输入文件。 如果您有一个产生问题的“真正的 pdf”,请在https://github.com/mozilla/pdf.js/issues/new 报告它,并确保提供不工作的 pdf。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-09-30
    • 2013-12-09
    • 2019-11-06
    • 2013-11-06
    • 1970-01-01
    • 1970-01-01
    • 2014-10-04
    • 2014-11-07
    相关资源
    最近更新 更多