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

[native_pdf_view] get pdf page count #37

Closed
Nomy1 opened this issue Mar 5, 2020 · 2 comments
Closed

[native_pdf_view] get pdf page count #37

Nomy1 opened this issue Mar 5, 2020 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@Nomy1
Copy link

Nomy1 commented Mar 5, 2020

It would be helpful if there was a way to get the currently opened pdf's page count.

At this moment, i'm not sure how one can get this number other than brute forcing by jumping to a page and seeing if the onPageChanged callback is fired or not.

@Nomy1 Nomy1 added the enhancement New feature or request label Mar 5, 2020
@SergeShkurko
Copy link
Member

to render the next page the current one is closed. this is native api rendering. PageView stores in memory 3 or 4 page widgets

@PrismaSoftGC
Copy link

PrismaSoftGC commented Mar 10, 2020

  Widget _pdfView(String path) => FutureBuilder<PDFDocument>(
        // Open document
        future: PDFDocument.openAsset(path),
        builder: (_, snapshot) {
          if (snapshot.hasData) {
            qtdPages = snapshot.data.pagesCount;
            return PDFView(
              document: snapshot.data,
              controller: pdfPageController,
              onPageChanged: _onPdfPageChanged,
            );
          }

          if (snapshot.hasError) {
            // Catch
            return Center(
              child: Text(
                'PDF Rendering does not '
                'support on the system of this version',
              ),
            );
          }

          return Center(child: CircularProgressIndicator());
        },
      );

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

No branches or pull requests

3 participants