diff --git a/package.json b/package.json index 3fadd7d..00fa4b9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@omarefg/react-file-preview", - "version": "0.1.15", + "version": "0.1.17", "description": "Component to render and preview some kind of documents", "main": "lib/index.js", "private": false, diff --git a/src/components/Pdf.jsx b/src/components/Pdf.jsx index f191162..b50fa76 100644 --- a/src/components/Pdf.jsx +++ b/src/components/Pdf.jsx @@ -6,7 +6,7 @@ import { ErrorBoundary } from './ErrorBoundary' import { PdfMenu } from './PdfMenu' import { INCREASE_PERCENTAGE } from '../utils' -export const Pdf = ({ path, ErrorComponent, onError, showPdfMenu, style, onPrint }) => { +export const Pdf = ({ path, ErrorComponent, onError, showPdfMenu, style, onPrint, allowPrint, allowDownload, onDownload }) => { const { state, container, @@ -39,6 +39,10 @@ export const Pdf = ({ path, ErrorComponent, onError, showPdfMenu, style, onPrint print={print} page={page} onPrint={onPrint} + pdf={pdf} + allowDownload={allowDownload} + allowPrint={allowPrint} + onDownload={onDownload} /> )} {!pdf && ( diff --git a/src/components/PdfMenu.jsx b/src/components/PdfMenu.jsx index da292fd..abef52d 100644 --- a/src/components/PdfMenu.jsx +++ b/src/components/PdfMenu.jsx @@ -7,6 +7,7 @@ import { faChevronLeft, faChevronRight, faPrint, + faDownload, } from '@fortawesome/free-solid-svg-icons' import styles from '../styles/PdfMenu.module.scss' @@ -21,8 +22,14 @@ export const PdfMenu = props => { print, page, onPrint, + pdf, + allowPrint, + allowDownload, + onDownload, } = props + const printHandler = () => (onPrint ? onPrint(pdf) : print()) + return (