import { OpenFile, Viewer } from '@react-pdf-viewer/core';
import { SelectionMode } from '@react-pdf-viewer/selection-mode';
import { toolbarPlugin } from '@react-pdf-viewer/toolbar';
const toolbarPluginInstance = toolbarPlugin({
getFilePlugin: {
fileNameGenerator: (file: OpenFile) => {
const fileName = file.name.substring(file.name.lastIndexOf('/') + 1);
return `a-copy-of-${fileName}`;
}
},
searchPlugin: {
keyword: 'PDF'
},
selectionModePlugin: {
selectionMode: SelectionMode.Hand
},
});
const { Toolbar } = toolbarPluginInstance;
return (
<div>
{}
<Toolbar />
{}
<Viewer
fileUrl='/assets/pdf-open-parameters.pdf'
plugins={[
toolbarPluginInstance,
]}
/>
</>
);