我在react应用程序中使用react-pdf。我已经使用代码渲染了 pdf
<PDFViewer>
<Document
onContextMenu={(e) => e.preventDefault()}
>
<Page
size="A4">
<Text>This is pdf page</Text>
</Page>
</Document>
</PDFViewer>
它正在渲染 pdf,但 View 宽度和高度太小,当我尝试对 PDFViewer 的高度和宽度进行一些自定义时,它显示 iframe 工具栏,我如何解决此问题或隐藏 iframe 的此工具栏?
最佳答案
除了 Firefox 之外,以下内容在 chrome 和 safari 中对我有用。我们需要明白,显示 pdf 将完全取决于浏览器内部插件和规范。因此,我们不会对在 Firefox 等浏览器中隐藏 iframe 工具栏有更多的控制权。
<PDFViewer width="500" height="500" showToolbar={false}>
<Document onContextMenu={(e) => e.preventDefault()}>
<Page size="A4" width="500" height="500">
<Text>This is pdf page</Text>
</Page>
</Document>
</PDFViewer>
关于reactjs - 使用react-pdf渲染具有自定义高度和宽度的pdf时无法隐藏iframe工具栏菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73776644/