Example: 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 renderPage = (props: RenderPageProps) => {
    return (
        <>
            {props.svgLayer.children}
            {props.textLayer.children}
            {props.annotationLayer.children}
        </Layout>
    );
};

export default Index;

<Viewer
    fileUrl="/path/to/document.pdf"
    renderPage={renderPage}
/>

(The sample code)