Andrey Epifancev 0aa73f2289 fix(review): legacy-сборка pdf.js — «Не удалось открыть PDF» в Яндекс Браузере (#22)
Обычная сборка pdfjs-dist 5.7 в воркере вызывает Uint8Array.prototype.toHex (отпечаток документа) —
метод есть только в Chromium 140+, в Яндекс Браузере getDocument падает «a.toHex is not a function».
PdfPages берёт модуль и воркер из pdfjs-dist/legacy/build (с полифиллами core-js) через новый
widgets/DocumentReview/pdfjs.ts; регрессионный тест открывает PDF без Uint8Array.prototype.toHex.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-09 19:41:16 +04:00

9 lines
634 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Legacy-сборка pdf.js: несёт полифиллы (в т. ч. Uint8Array.prototype.toHex, Chromium 140+), без которых обычная
// сборка падает при открытии документа в Яндекс Браузере — «a.toHex is not a function» (arm-web #22). Воркер — та же
// сборка, собирается вместе с приложением (без CDN).
import * as pdfjsLib from 'pdfjs-dist/legacy/build/pdf.mjs';
pdfjsLib.GlobalWorkerOptions.workerSrc = new URL('pdfjs-dist/legacy/build/pdf.worker.min.mjs', import.meta.url).toString();
export { pdfjsLib };