syncfusion / flutter-widgets

Syncfusion Flutter widgets libraries include high quality UI widgets and file-format packages to help you create rich, high-quality applications for iOS, Android, and web from a single code base.
1.44k stars 672 forks source link

PDF viewer is not working with SfPdfViewer.network #1837

Closed talhaarshad64 closed 2 weeks ago

talhaarshad64 commented 2 weeks ago

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 commented 2 weeks ago

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 commented 2 weeks ago

Thanks for the help. Yesterday, when I tried in production mode app it works for me. Don't know what was the issue before maybe some kind of internet disturbance or something.

On Tue, Apr 30, 2024, 12:47 PM Imman Kumar @.***> wrote:

Hi @Talhach64 https://github.com/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).

image.png (view on web) https://github.com/syncfusion/flutter-widgets/assets/93641486/80700eb6-8c19-437b-996b-e95445620285

pdfviewer_app.zip https://github.com/syncfusion/flutter-widgets/files/15160047/pdfviewer_app.zip

— Reply to this email directly, view it on GitHub https://github.com/syncfusion/flutter-widgets/issues/1837#issuecomment-2084615584, or unsubscribe https://github.com/notifications/unsubscribe-auth/AV2NQDSK7QBPSWDYGCFMS4TY75D7LAVCNFSM6AAAAABG6GWKJKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBUGYYTKNJYGQ . You are receiving this because you were mentioned.Message ID: @.***>