Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDF viewer is not working with SfPdfViewer.network #1837

Closed
talhaarshad64 opened this issue Apr 29, 2024 · 2 comments
Closed

PDF viewer is not working with SfPdfViewer.network #1837

talhaarshad64 opened this issue Apr 29, 2024 · 2 comments

Comments

@talhaarshad64
Copy link

Bug description

I am using syncfusion_flutter_pdfviewer: ^25.1.41.
2 days ago I checked and it was working fine with the given example in package but now the package example is not working as well.
Moreover back when I tried it was showing loading but now its not even showing the loading bar.

Steps to reproduce

I just copied package example and tested.

Code sample

import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart';

class HomePage extends StatefulWidget {
@OverRide
_HomePage createState() => _HomePage();
}

class _HomePage extends State {
final GlobalKey _pdfViewerKey = GlobalKey();

@OverRide
void initState() {
super.initState();
}

@OverRide
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Syncfusion Flutter PDF Viewer'),
actions: [
IconButton(
icon: const Icon(
Icons.bookmark,
color: Colors.white,
semanticLabel: 'Bookmark',
),
onPressed: () {
_pdfViewerKey.currentState?.openBookmarkView();
},
),
],
),
body: SfPdfViewer.network(
'https://cdn.syncfusion.com/content/PDFViewer/flutter-succinctly.pdf',
key: _pdfViewerKey,
),
);
}
}

Screenshots or Video

WhatsApp Image 2024-04-29 at 05 13 49_b41c0f95

Stack Traces

E/flutter (25377): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: ClientException with SocketException: Failed host lookup: 'cdn.syncfusion.com' (OS Error: No address associated with hostname, errno = 7), uri=https://cdn.syncfusion.com/content/PDFViewer/flutter-succinctly.pdf
E/flutter (25377): #0 NetworkPdf.getPdfBytes (package:syncfusion_flutter_pdfviewer/src/common/pdf_provider.dart:55:9)
E/flutter (25377):
E/flutter (25377): #1 SfPdfViewerState._compareDocument (package:syncfusion_flutter_pdfviewer/src/pdfviewer.dart:1318:32)
E/flutter (25377):
E/flutter (25377):
E/flutter (25377): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: ClientException with SocketException: Failed host lookup: 'cdn.syncfusion.com' (OS Error: No address associated with hostname, errno = 7), uri=https://cdn.syncfusion.com/content/PDFViewer/flutter-succinctly.pdf
E/flutter (25377): #0 NetworkPdf.getPdfBytes (package:syncfusion_flutter_pdfviewer/src/common/pdf_provider.dart:55:9)
E/flutter (25377):

On which target platforms have you observed this bug?

Android

Flutter Doctor output

Microsoft Windows [Version 10.0.19045.4291]
(c) Microsoft Corporation. All rights reserved.

C:\Users\M.Computer>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.19.4, on Microsoft Windows [Version 10.0.19045.4291], locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[√] Chrome - develop for the web
[X] Visual Studio - develop Windows apps
X Visual Studio not installed; this is necessary to develop Windows apps.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2023.2)
[√] Connected device (4 available)
[√] Network resources

! Doctor found issues in 1 category.

C:\Users\M.Computer>

@immankumarsync
Copy link

Hi @Talhach64,
We tried to replicate the issue, and the PDF document was loaded properly from the network. Please find the sample that we used to replicate the issue in the attachments. Kindly check whether the document is loaded properly with that sample.

If the PDF document is loaded from the network, it is necessary that the device be connected to the internet.

Also ensure that the Network permission is enabled in all the AndroidManifest.xml files (debug, main, profile).

<uses-permission android:name="android.permission.INTERNET"/>

image

pdfviewer_app.zip

@talhaarshad64
Copy link
Author

talhaarshad64 commented Apr 30, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants