diff --git a/packages/renderer/index.d.ts b/packages/renderer/index.d.ts index f1151fa72..85d831f3b 100644 --- a/packages/renderer/index.d.ts +++ b/packages/renderer/index.d.ts @@ -459,15 +459,14 @@ declare namespace ReactPDF { */ class PDFViewer extends React.Component {} - interface PDFDownloadLinkProps { - document: React.ReactElement; + interface PDFDownloadLinkProps extends Omit, "href"> { + /** PDF filename. Alias for anchor tag `download` attribute. */ fileName?: string; - style?: Style | Style[]; - className?: string; + document: React.ReactElement; children?: | React.ReactNode | ((params: BlobProviderParams) => React.ReactNode); - onClick?: () => void; + onClick?(event: React.MouseEvent, instance: UsePDFInstance): void; } /** diff --git a/packages/renderer/src/dom/PDFDownloadLink.js b/packages/renderer/src/dom/PDFDownloadLink.js index 3f20e5111..1fe54cb31 100644 --- a/packages/renderer/src/dom/PDFDownloadLink.js +++ b/packages/renderer/src/dom/PDFDownloadLink.js @@ -5,12 +5,12 @@ import { useEffect } from 'react'; import usePDF from './usePDF'; export const PDFDownloadLink = ({ - style, - children, - className, - document: doc, fileName = 'document.pdf', + document: doc, + children, onClick, + href: _filteredOutHref, + ...rest }) => { const [instance, updateInstance] = usePDF(); @@ -35,11 +35,10 @@ export const PDFDownloadLink = ({ return ( {typeof children === 'function' ? children(instance) : children}