mirror of
https://github.com/open-webui/open-webui.git
synced 2026-11-22 21:50:42 -05:00
fix: PDF preview shows blank pages for scanned PDFs with JPEG2000 images (#33906)
Scanned PDFs often store their pages as JPEG2000 images, which many scanning and OCR tools do by default. Opening such a file showed those pages and their thumbnails as blank white pages. The app now ships the image decoder the PDF viewer needs for that format, so those pages show up as they should. Fixes #33905
This commit is contained in:
1 parent
c070c61084
commit
8eb1af85a3
3 files changed
+6
-2
No files matched your search
@@ -630,7 +630,7 @@
|
||||
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
||||
pdfData = await res.arrayBuffer();
|
||||
}
|
||||
pdfDoc = await pdfjs.getDocument({ data: pdfData }).promise;
|
||||
pdfDoc = await pdfjs.getDocument({ data: pdfData, wasmUrl: '/wasm/' }).promise;
|
||||
if (token !== loadToken) return;
|
||||
pageCount = pdfDoc.numPages;
|
||||
if (onComments) {
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
pdfjs.GlobalWorkerOptions.workerSrc = pdfWorkerUrl;
|
||||
|
||||
pdfDoc?.destroy();
|
||||
pdfDoc = await pdfjs.getDocument({ data: pdfData }).promise;
|
||||
pdfDoc = await pdfjs.getDocument({ data: pdfData, wasmUrl: '/wasm/' }).promise;
|
||||
|
||||
const rendered: string[] = [];
|
||||
for (let i = 1; i <= pdfDoc.numPages; i++) {
|
||||
|
||||
@@ -26,6 +26,10 @@ export default defineConfig({
|
||||
{
|
||||
src: 'node_modules/onnxruntime-web/dist/*.jsep.*',
|
||||
|
||||
dest: 'wasm'
|
||||
},
|
||||
{
|
||||
src: 'node_modules/pdfjs-dist/wasm/*',
|
||||
dest: 'wasm'
|
||||
}
|
||||
]
|
||||
|
||||
Reference in new issue
Block a user