From d6277f5469e2cb603316a70caac77a0dc0999190 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20B=C3=B6sche?= Date: Sun, 11 Jan 2026 18:13:36 +0100 Subject: [PATCH] FIX: Add PDF.js library to web/index.html for SfPdfViewer web support --- b0esche_cloud/lib/pages/document_viewer.dart | 13 ++++++++++--- b0esche_cloud/web/index.html | 7 +++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/b0esche_cloud/lib/pages/document_viewer.dart b/b0esche_cloud/lib/pages/document_viewer.dart index e4c64ac..0305607 100644 --- a/b0esche_cloud/lib/pages/document_viewer.dart +++ b/b0esche_cloud/lib/pages/document_viewer.dart @@ -178,8 +178,10 @@ class _DocumentViewerModalState extends State { } if (state is DocumentViewerReady) { if (state.caps.isPdf) { - // Log the URL being used for debugging + // Log the URL and auth being used for debugging print('Loading PDF from: ${state.viewUrl}'); + print('Token: ${state.token.substring(0, 20)}...'); + print('Headers being passed: Authorization: Bearer ${state.token.substring(0, 20)}...'); // Pass token via Authorization header - SfPdfViewer supports headers parameter return SfPdfViewer.network( state.viewUrl.toString(), @@ -187,8 +189,13 @@ class _DocumentViewerModalState extends State { 'Authorization': 'Bearer ${state.token}', }, onDocumentLoadFailed: (details) { - print('PDF load failed: ${details.error}'); - print('Description: ${details.description}'); + print('❌ PDF load FAILED'); + print(' Error: ${details.error}'); + print(' Description: ${details.description}'); + }, + onDocumentLoaded: (PdfDocumentLoadedDetails details) { + print('✅ PDF loaded successfully'); + print(' Pages: ${details.document.pages.count}'); }, ); } else { diff --git a/b0esche_cloud/web/index.html b/b0esche_cloud/web/index.html index 564911d..ef81bcb 100644 --- a/b0esche_cloud/web/index.html +++ b/b0esche_cloud/web/index.html @@ -55,6 +55,13 @@ b0esche_cloud + + +