React-to-print: Is it possible to generate a PDF and download it without Preview?

Created on 13 Feb 2020  路  4Comments  路  Source: gregnb/react-to-print

I really love this package, it's making a beautiful PDF for me -- I had one question, my client assumed that after clicking the button the PDF would just trigger a download of a PDF file. Is thiis possible with this package? Or can I combine the PDF generated from this package to trigger a download somehow?

enhancement good first issue help wanted

Most helpful comment

This would be a great feature.

All 4 comments

Hello. Hmm. That's not currently possible, though I think it would be somewhat easy to add. I'm not sure when I might have the time to look at adding it, however, I would be happy to review a PR if you want to give it a shot. Basically, you just need to open a data uri in the JavaScript. The hard part might be generating that uri, but I think it might be easy, I'm not sure.

This would be a great feature.

Is someone working on this issue?

YES ? "how to track the status" : NO ? "Can I try working on this" : "would love to have this feature"

@MatthewHerbst

@sunilb0575 There was some work done in #230 to try and do this but it ended up not working out. You are more than welcome to make a PR that attempts to do this. Things to keep in mind:

  • It needs to work across browsers
  • If it brings in an external dependency

    • We need to be able to justify the size increase

    • The dependency should be highly used and well maintained

Considering any PDF download library is likely to be large, I think ideally we should be able to add it to peerDependencies, and then only make the user specify it if the feature is used (so, call const PDFDownloader = require('<some-pdf-library'>) inside the code instead of at the top of the file.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sprietNathanael picture sprietNathanael  路  4Comments

404sand808s picture 404sand808s  路  7Comments

MikeSha picture MikeSha  路  4Comments

hoangdoan267 picture hoangdoan267  路  8Comments

Dastnbek picture Dastnbek  路  4Comments