question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PDF scale 3.5 taking longer to load in 4K responsive screen

See original GitHub issue

I would like to zoom (scale 3.5) to a particular coordinate on the click of a button. It works fine on the laptop but it takes really long time in bigger screens like 4k responsive (2560 x 950). It’s taking up a lot of system memory too.

onButtonClick = () => {
    this.setState({ scale: 3.5, pageNumber: 3, pdfLoader: true },
        () => {
            setTimeout(function () {
                var canvasHolder = document.querySelector('.document-holder');
                canvasHolder.style.overflow = 'auto';
                canvasHolder.scroll({
                    top: 600,
                    left: 500,
                    behavior: 'smooth'
                })
            }, 800)
        }
    )

}

renderSuccess = (page) => {
    if (page.pageIndex === this.state.pageNumber - 1) {
        this.setState({
            pdfLoader: false
        })
    }
}
render() {
    var { pageNumber, scale, url } = this.state;
    const override = css` display: block; margin: 0 auto; top:250px;z-index:100; height:0 !important`;
    return (
        <div>
            <button onClick={this.onButtonClick}>test</button>
            <FadeLoader css={override} height={15} width={5} radius={2} margin={2} color={"#4183C5"} loading={this.state.pdfLoader} />
            <div id="doc-holder" className="document-holder" >

                <Document file={url}>
                    <Page key={pageNumber} pageNumber={pageNumber} renderAnnotationLayer={false}
                        renderTextLayer={false}
                        noData='No file found'
                        className="canvas-pdf-page"
                        scale={scale}
                        width={window.innerWidth * 0.9}
                        onRenderSuccess={(page) => this.renderSuccess(page)}
                    />
                </Document>

            </div>
        </div>
    )
}

Environment

  • React-PDF version: 4.1.0
  • React version: 16.12.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
NethraRaghucommented, Oct 25, 2021

But it doesn’t take long in https://mozilla.github.io/pdf.js/web/viewer.html (pdf.js) when I view in 4K screen and change pages

0reactions
github-actions[bot]commented, Mar 7, 2022

This issue was closed because it has been stalled for 14 days with no activity.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Responsive resize and constraints - Adobe Support
Learn how to use responsive resize and constraints for multiple screen sizes and layouts.
Read more >
Adobe App Scaling on High DPI Displays (FIX) - Dan Antonielli
Long answer: When the apps load, Windows asks if the app is High DPI aware and these apps answer “yes”. Which is why...
Read more >
Poly Video Mode (G7500, Studio X50, and Studio X30)
On the screen, long press the preset and choose Save. ▫ On the remote control, press a number to select a preset. Select...
Read more >
Take a high resolution screenshot of a website - Super User
Magnify the webpage by zooming in (big enough till you want it), then make firefox into full screen mode. Press Print Screen button...
Read more >
Photo Resolution: Sizes Needed for Printing Your Images
Here we discuss size, resolution, PPI, DPI, file formats and megapixels to ... of individual digital dots of color it takes to build...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found