Skip to content

移动端预览PDF报错 pattern.at is not a function #728

@CYF0108

Description

@CYF0108

Issue Type / 问题类型

Bug / 缺陷

kkFileView Version / kkFileView 版本

4.4.0

Deployment Mode / 部署方式

jar

Environment / 环境信息

windows
java21
移动端

Steps to Reproduce / 复现步骤

手机上预览pdf,一直无响应

Image

Expected Result / 期望结果

正确预览

Actual Result / 实际结果

控制台报错,一直不显示

Logs & Screenshots / 日志与截图

operator_list.js:24 Uncaught TypeError: pattern.at is not a function
    at addState (operator_list.js:24)
    at Object.defineProperty.value (operator_list.js:35)
    at __w_pdfjs_require__ (bootstrap:19)
    at Object.defineProperty.value (evaluator.js:79)
    at __w_pdfjs_require__ (bootstrap:19)
    at Object.defineProperty.value (default_appearance.js:31)
    at __w_pdfjs_require__ (bootstrap:19)
    at Object.<anonymous> (annotation.js:48)
    at __w_pdfjs_require__ (bootstrap:19)
    at Object.defineProperty.value (document.js:33)
addState @ operator_list.js:24
Object.defineProperty.value @ operator_list.js:35
__w_pdfjs_require__ @ bootstrap:19
Object.defineProperty.value @ evaluator.js:79
__w_pdfjs_require__ @ bootstrap:19
Object.defineProperty.value @ default_appearance.js:31
__w_pdfjs_require__ @ bootstrap:19
(anonymous) @ annotation.js:48
__w_pdfjs_require__ @ bootstrap:19
Object.defineProperty.value @ document.js:33
__w_pdfjs_require__ @ bootstrap:19
Object.defineProperty.value @ pdf_manager.js:25
__w_pdfjs_require__ @ bootstrap:19
(anonymous) @ worker.js:39
__w_pdfjs_require__ @ bootstrap:19
(anonymous) @ pdf.worker.js:16
(anonymous) @ pdf.worker.js:22
(anonymous) @ pdf.worker.js:22
webpackUniversalModuleDefinition @ universalModuleDefinition:9
(anonymous) @ universalModuleDefinition:10
app.js:1313 加载 PDF 时发生错误。

PDF.js v3.9.179 (build: 1ef6fbc52)
Message: Setting up fake worker failed: "Cannot read property 'WorkerMessageHandler' of undefined".
_otherError @ app.js:1313
_documentError @ app.js:1273
(anonymous) @ app.js:1165
Promise.then (async)
(anonymous) @ app.js:1164
Promise.then (async)
open @ app.js:1148
run @ app.js:159
async function (async)
run @ app.js:694
webViewerLoad @ viewer.js:211
error-stack-install.js:10 Uncaught (in promise) Error: Setting up fake worker failed: "Cannot read property 'WorkerMessageHandler' of undefined".
    at api.js:2252

Sample File / 样例文件(可选)

添加以下可解决

<script> (function() { if (!Array.prototype.at) { Object.defineProperty(Array.prototype, 'at', { value: function(index) { if (index < 0) index += this.length; if (index < 0 || index >= this.length) return undefined; return this[index]; }, writable: true, configurable: true, enumerable: false }); } })(); </script>

viewer.html

Checklist / 提交前检查

  • I have searched existing issues and did not find a duplicate. / 我已搜索现有 issue,未发现重复问题
  • I can reproduce this issue on the stated version/environment. / 我可在上述版本与环境复现该问题
  • I have masked sensitive information in logs/screenshots. / 我已对日志与截图中的敏感信息做脱敏处理

Metadata

Metadata

Assignees

Labels

status/needs-infoWaiting for reporter feedback or reproduction details

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions