wojtekmaj / react-pdf

Display PDFs in your React app as easily as if they were images.

Home Page:https://projects.wojtekmaj.pl/react-pdf

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flickering issue when scaling the entire pdf

ShashanKV98 opened this issue · comments

Before you start - checklist

  • I followed instructions in documentation written for my React-PDF version
  • I have checked if this bug is not already reported
  • I have checked if an issue is not listed in Known issues
  • If I have a problem with PDF rendering, I checked if my PDF renders properly in PDF.js demo

Description

Hi. I had some issues when dealing with zooming a document with all pages in a column (not just a single page). I browsed the issues in this repo, and found a sandbox link from @wojtekmaj #875 (comment).

This was for a single page in the viewport, so I extended it to include all the pages. The first page seems to render just fine as I use the slider, but the rest of the pages tend to flicker a lot. I've been on this for days but couldn't figure out if this is because of React or page.render refreshing the entire page from scratch at every new scale value or something else that I'm missing.

I'm also curious about the recommended approach for handling zooming with this library. Is it possible to get it close to how pdf.js viewer handles zooming?

Thanks and appreciate the work put into this library.

Steps to reproduce

Attached a codesandbox link showing this behavior.

https://codesandbox.io/p/sandbox/react-pdf-prevent-flash-with-scale-forked-pwcw8z

Expected behavior

Flickering for all pages is supposed to be minimal to none

Actual behavior

The first page doesn't flicker but the subsequent pages do.

Additional information

No response

Environment

  • Browser (if applicable): Edge, Chrome
  • React-PDF version: 7.7.1
  • React version: 18.2.0
  • Webpack version (if applicable):

Has a solution been posted for this? Would love to see a working fix for rendering the whole pdf without flashes. @wojtekmaj