Как отобразить PDF в <Dialog>DisplayPDFhere</ Dialog> в реагировать?
Нам нужно отобразить pdf в "Диалоге". Мы использовали response-pdf ( https://github.com/wojtekmaj/react-pdf). Этот код не выдавал никакой ошибки и получил обратный вызов onLoadSuccess, однако, pdf не отображается в "Диалоге" и является пустым белым фоном.
Мы можем видеть PDF без "Диалога". Эта проблема возникает только тогда, когда мы пытаемся отобразить PDF в "Диалоге".
Можно ли отобразить pdf в диалоге реакции?
Код: (реакция-pdf пример github)
state = {
file: './sample.pdf',
numPages: null,
}
onFileChange = (event) => {
this.setState({
file: event.target.files[0],
});
}
onDocumentLoadSuccess(numPages) {
}
render() {
const { file, numPages } = this.state;
return (
<div className="Example">
<header>
<h1>react-pdf sample page</h1>
</header>
<div className="Example__container__document">
{/* <Dialog modifier="material" isCancelable={true}> */}//If we want to display pdf inside Dialog, its not showing
<Document
file={file}
onLoadSuccess={this.onDocumentLoadSuccess}
options={options}
>
{
Array.from(
new Array(numPages),
(el, index) => (
<Page
key={`page_${index + 1}`}
pageNumber={index + 1}
/>
),
)
}
</Document>
{/* </Dialog> */}
</div>
</div>
);}