react-pdf-render Can we give filename when we show document to user

275 views Asked by At

react-pdf-render Can we give filename when we show document to user. I want to show custom PDF name to user rather than system generated.

I tried Blob option but that is is not what I require.Also worked with PDFViewer but none of them works for filename.

1

There are 1 answers

0
Ahmet Firat Keler On

You can save your document before with a name using https://www.npmjs.com/package/file-saver

import { saveAs } from 'file-saver'

const Page = () => {
  useEffect(() => {
    setTimeout(() => {
      saveAs("https://path/to/ur/pdf/file", "your-desired-pdf-file-name.jpg")
    }, 1000)
  }, [])
}

Tell me if you need more help please