Replace the canvas with SVG layer

By default, each page is constructed by canvas, text, and annotation layers.
The sample code below replace the canvas with SVG layer:
import { RenderPageProps, Viewer } from '@react-pdf-viewer/core';
const CustomPageLayer: React.FC<{
renderPageProps: RenderPageProps
}> = ({ renderPageProps }) => {
React.useEffect(() => {
// Mark the page as rendered completely when the text layer is rendered
// So the next page in the document will be rendered
if (renderPageProps.textLayerRendered) {
}, [renderPageProps.textLayerRendered]);
return (
renderPage={(renderPageProps) => <CustomPageLayer renderPageProps={renderPageProps} />}
The SVG renderer is not stable, and it is not recommended to use it