onedrive/components/previews/PDFPreview.tsx

23 lines
803 B
TypeScript
Raw Normal View History

import DownloadButtonGroup from '../DownloadBtnGtoup'
import { DownloadBtnContainer } from './Containers'
2021-12-28 18:13:17 +00:00
2022-01-06 11:25:10 +00:00
const PDFEmbedPreview: React.FC<{ file: any }> = ({ file }) => {
2021-12-28 18:13:17 +00:00
// const url = `/api/proxy?url=${encodeURIComponent(file['@microsoft.graph.downloadUrl'])}&inline=true`
const url = `https://mozilla.github.io/pdf.js/web/viewer.html?file=${encodeURIComponent(
file['@microsoft.graph.downloadUrl']
)}`
return (
<div>
<div className="w-full overflow-hidden rounded" style={{ height: '90vh' }}>
2021-12-28 18:13:17 +00:00
<iframe src={url} frameBorder="0" width="100%" height="100%"></iframe>
</div>
<DownloadBtnContainer>
<DownloadButtonGroup downloadUrl={file['@microsoft.graph.downloadUrl']} />
</DownloadBtnContainer>
</div>
2021-12-28 18:13:17 +00:00
)
}
export default PDFEmbedPreview