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

Exception has occurred. _Exception (Exception: Error reading PDF!) #81

Open
7Eltantawy opened this issue Aug 12, 2020 · 2 comments
Open

Comments

@7Eltantawy
Copy link

Exception has occurred. _Exception (Exception: Error reading PDF!)

I'm facing this error on loading pdf from url
This is myCode

import 'package:flutter/material.dart';
import 'package:flutter_plugin_pdf_viewer/flutter_plugin_pdf_viewer.dart';

class PdfViwer extends StatefulWidget {
  PdfViwer(this.urlPath);
  final urlPath;

  @override
  _PdfViwerState createState() => _PdfViwerState();
}

class _PdfViwerState extends State<PdfViwer> {
  bool nighmode = false;
  bool pageSnapping = false;
  bool isloading = false;

  PDFDocument document;

  @override
  void initState() {
    super.initState();

    loadfile();
  }

  loadfile() async {
    document = await PDFDocument.fromURL(
        'http://www.africau.edu/images/default/sample.pdf');

    setState(() {
      document = document;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        centerTitle: true,
        title: Text('PDF'),
      ),
      body: Center(child: PDFViewer(document: document)),
    );
  }
}
@Ahmedhassan50
Copy link

Ahmedhassan50 commented Sep 25, 2020

did you find solve ?

@7Eltantawy
Copy link
Author

No, I used URL launcher instead but I hope to find a solution

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