Description
Bug description
Issue Summary
SfPdfViewer.network
fails to load a simple, publicly available PDF file on Flutter Web. Even with basic English-only PDF content, the viewer shows a grey screen and triggers the onDocumentLoadFailed
callback.
URL Used
https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf
Observations
-
The PDF is publicly accessible and contains only simple English text.
-
It has valid
Content-Length
andContent-Type: application/pdf
headers. -
There are no CORS restrictions — the PDF opens fine in a browser.
-
On Flutter Web, the viewer fails with the following error:
-
The same PDF works perfectly when used with
SfPdfViewer.network
on Android and iOS.
Expected Behavior
The PDF should render correctly on Flutter Web, especially for such a simple, publicly available document.
Actual Behavior
A grey screen is shown and onDocumentLoadFailed
is triggered with a vague error message.
Versions
syncfusion_flutter_pdfviewer
: ^29.1.41- Flutter: 3.29.3 (Dart 3.7.2)
- Platform: Flutter Web (Chrome)
Note: I also tested with Flutter 3.27.4 and downgraded
syncfusion_flutter_pdfviewer
to 28.1.41, but the issue remained unchanged.
Suggestion
Please investigate why even basic PDFs (like the W3C dummy file) fail to render on Flutter Web with SfPdfViewer.network
. A clearer error message or fallback guidance would also be helpful.
Steps to reproduce
- Create a new Flutter project (or use an existing one).
- Add the following dependency to your
pubspec.yaml
:
dependencies:
syncfusion_flutter_pdfviewer: ^29.1.41
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: Text('PDF Test')),
body: SfPdfViewer.network(
'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf',
onDocumentLoadFailed: (PdfDocumentLoadFailedDetails details) {
print('${details.error}');
print('${details.description}');
},
),
),
);
}
}
Code sample
Code sample
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: Text('PDF Test')),
body: SfPdfViewer.network(
'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf',
onDocumentLoadFailed: (PdfDocumentLoadFailedDetails details) {
print('${details.error}');
print('${details.description}');
},
),
),
);
}
}
Screenshots or Video
Stack Traces
Stack Traces
No stack trace was shown in the console.
The only available output came from the onDocumentLoadFailed
callback of SfPdfViewer
, which returned:
onDocumentLoadFailed: (PdfDocumentLoadFailedDetails details) {
print('error: ${details.error}');
print('description: ${details.description}');
},
print log
error: Error
description: There was an error opening this document.
On which target platforms have you observed this bug?
Web
Flutter Doctor output
Doctor output
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.29.3, on macOS 15.4.1 24E263 darwin-arm64, locale ja-JP)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] VS Code (version 1.98.2)
[✓] Connected device (4 available)
! Error: Browsing on the local area network for tatsuyaの iPhone. Ensure the device is unlocked and attached with a cable or associated
with the same local area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources
• No issues found!