Giter Site home page Giter Site logo

Comments (12)

emreesen27 avatar emreesen27 commented on June 14, 2024

Do you use FutureBuilder ?

from packages.flutter.

Fethi-Hamdani avatar Fethi-Hamdani commented on June 14, 2024

yes, i copied the example

from packages.flutter.

Fethi-Hamdani avatar Fethi-Hamdani commented on June 14, 2024

the pdf file i'm trying to display is from device's storage not assets, can that be the issue?

from packages.flutter.

emreesen27 avatar emreesen27 commented on June 14, 2024

I don't think there is a problem with this. I use a similar method and I have no performance issues. I must mention that I am working on large pdf files.

!!! You should try the release version for full performance.

PDFDocument _document;

Future<PDFDocument> _getDocument() async {
return _document = await PDFDocument.openFile(your path+ "/file.pdf");
}

FutureBuilder<PDFDocument>(
future: _getDocument(),
builder: (_, snapshot) {
if(snapshot.hasdata) {
return PDFView()... }
}
)

from packages.flutter.

SergeShkurko avatar SergeShkurko commented on June 14, 2024

@Fethi1 where you run project? On real device in debug mod or emulator in debug mode?

from packages.flutter.

Fethi-Hamdani avatar Fethi-Hamdani commented on June 14, 2024

i run it on a real device, i have tried it on both debug and release and in different phones and the same thing happen, especially for pages that has images, it takes some time to load.
the app i'm developing is supposed to fetch pdf files on device and display each file on a new Route

from packages.flutter.

SergeShkurko avatar SergeShkurko commented on June 14, 2024

You can play with render option (render docs)

PDFView(
  controller: pageController,
  renderer: (PDFPage page) => page.render(
    // for example set to 1.25-1.5
    // the quality of the final result may decrease
    width: page.width * 2,
    height: page.height * 2,
    format: PDFPageFormat.JPEG,
    backgroundColor: '#FFFFFF',
  ),
);

pages are converted to an image and part of the time is spent on transfer from dart side to platform and back

from packages.flutter.

atheist1 avatar atheist1 commented on June 14, 2024

@SergeShkurko it seems converted page to an image spent lots of time when i use animateToPage or other animation api .There is a black area on the bottom.what should i do to solve the problem?

from packages.flutter.

deakjahn avatar deakjahn commented on June 14, 2024

@SergeShkurko please change the example as I described in #46 (comment)

You shouldn't load the PDF this way into a FutureBuilder. This results in many repeated calls to the function and is discouraged in the Flutter documentation (yes, I know it's cached in a variable but still, this is not the suggested way of handling it).

from packages.flutter.

SergeShkurko avatar SergeShkurko commented on June 14, 2024

@atheist1 usage jumpTo or minimize delay

from packages.flutter.

SergeShkurko avatar SergeShkurko commented on June 14, 2024

@deakjahn i change api un 3.0.0, it is no longer required

from packages.flutter.

SergeShkurko avatar SergeShkurko commented on June 14, 2024

option renderer was not working until 3.0.0, now fixed

from packages.flutter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.