espresso3389 / pdfrx

pdfrx is yet another PDF viewer implementation that built on the top of PDFium. The plugin currently supports Android, iOS, Windows, macOS, Linux, and Web.
MIT License
113 stars 54 forks source link

PDF Loading time too much long for big size pdf #161

Open 90tamal90 opened 5 months ago

90tamal90 commented 5 months ago

When open a big size pdfs , like 500 pages pdf ....then the pdf loading time of too much ...... and memory consumption is too much ....please help me 🙏....

  1. I think here all pages are rendered at same time .....if per page render when scrolling ....
  2. How to implement the loading indicator per page ??
espresso3389 commented 5 months ago

I think here all pages are rendered at same time .....if per page render when scrolling ....

No, the rendering is per-page basis. The problem seems in the page layout logic. It firstly calculates the width/height of all the pages.

I've tested pdfrx with large documents like PDF Reference and the loading speed is acceptable even if we dynamically download it.

So if your 500-page document takes so long time, the PDF file's structure is too much complicated. Without the file, we cannot check the actual issue.

If you're just talking about download progress, here it is.

And, the memory consumption is already optimized on the latest version. I think there's already no room to optimize the memory usage on pdfrx. If you need more optimization, we should do some in pdfium.

lin1270 commented 5 months ago

300 pages... 3-5seconds.

espresso3389 commented 5 months ago

Please don't reuse a single issue for many things. I ignore all your questions on the issue.

espresso3389 commented 5 months ago

I think it's quite normal to load 300 pages in 3-5 seconds. Only your issue is it just freezing before showing the pages. I understand your pain. But I'm still thinking how to do that...

letrungdo commented 4 months ago

@espresso3389 I think this could be the solution: https://apryse.com/blog/pdf-format/what-is-pdf-linearization https://github.com/mozilla/pdf.js/issues/8897

espresso3389 commented 4 months ago

@letrungdo pdfrx uses pdf.js for web version so PDFJS.disableAutoFetch might be an option though I think it does not work for the case.

By the way, why are you referencing PDF linearization here?

letrungdo commented 4 months ago

@espresso3389 PDF linearization I think for pdf files downloaded from url it will be necessary to download the first pages to display first, not having to wait for the file to finish downloading to display.

espresso3389 commented 4 months ago

@letrungdo PDF linearization is how PDF content should be and it has nothing to do with PDF viewer.