fix(data-process): 优化预览分页与PDF兼容

This commit is contained in:
caoxiaozhu
2026-07-24 14:23:20 +08:00
parent 93373bc61f
commit 975f55d06c
3 changed files with 8 additions and 4 deletions

View File

@@ -220,10 +220,12 @@ async function renderCurrentPage(force = false) {
) return
throw error
})
const textContent = await page.getTextContent()
// WebKit 兼容PDF.js 的 getTextContent() 依赖 ReadableStream 异步迭代,
// 部分 Safari/WKWebView 未实现该接口。TextLayer 可直接通过 getReader() 消费文本流。
const textContentSource = page.streamTextContent()
if (sequence !== renderSequence) return
const activeTextLayer = new TextLayer({
textContentSource: textContent,
textContentSource,
container: layerContainer,
viewport,
})