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/