nani
nani

Reputation: 203

Flutter, open Hyperlink in PDF in Browser

I have a Problem with Links in PDF's. When clicking on them in the App, the App open the Website in the App itself. I want them to open in the browser instead. Anyone knows a lib that is handling this the way I want? I used different PDF libs and in Both I had this issue. Libs I Used are:

flutter_full_pdf_viewer

pdf_flutter

This is the Code Example for PDF_Flutter. I also tried to download the PDF itself and reading it via Network.assets instead of Network, same Issue clicking on links opens the website in the same View. Are PDF_flutter and flutter_full_pdf_viewer working on Webviews or how is that even a thing??

Scaffold(
        appBar: CustomAppBar("", false, ""),
        body: Stack(
          children: <Widget>[
            PDF.network(
              widget.url,
              width: MediaQuery.of(context).size.width,
              height: MediaQuery.of(context).size.height,
              placeHolder: Center(
                child: CircularProgressIndicator(
                  valueColor: AlwaysStoppedAnimation(
                    Color(0xFFE41B13),
                  ),
                ),
              ),
            ),
          ],
        ),
      );

Upvotes: 0

Views: 2249

Answers (1)

nani
nani

Reputation: 203

So after testing like 6 Flutter Plugin for PDF's I found one that open links in the Browser. Flutter_pdfview

You just need to set "preventLinkNavigation" to false and that's it.

PDFView(
        filePath: widget.path,
        preventLinkNavigation: false, <----
        ...
      )

Upvotes: 2

Related Questions