Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

314
Views
Add pinch to zoom to pdf js implemented in reactjs

I have already implemented pdfjs in react, and it is working normally. But my issue is that i can't pinch to zoom in, and i couldn't find any resources that can help with my current code.

Please find my code below

JS

  const renderPage = useCallback(
    (pageNum, pdf = pdfRef) => {
      pdf &&
        pdf.getPage(pageNum).then(async (page) => {
          const canvas = canvasRef.current;
          const viewport = page.getViewport({ scale: 1 });
          canvas.height = viewport.height;
          canvas.width = viewport.width;
          const renderContext = {
            canvasContext: canvas.getContext('2d'),
            viewport,
          };
          updatePageLoadingStatus(true);
          await page.render(renderContext);
          updatePageLoadingStatus(false);
        });
    },
    [pdfRef],
  );

HTML

<canvas ref={canvasRef} />

I appreciate any help with solving the pinch to zoom issue.

pdf js examples https://mozilla.github.io/pdf.js/examples/

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!