diegomura / react-pdf

📄 Create PDF files using React
https://react-pdf.org
MIT License
14.94k stars 1.18k forks source link

Embedded Files and Attachments #1985

Open taranda opened 2 years ago

taranda commented 2 years ago

Is your feature request related to a problem? Please describe. We would like to embed files into a PDF that is generated by this package.

Describe the solution you'd like We would like the capability to add embedded files and file annotations to PDFs created by this package.

A potential design:

<File
  style={...}                        // Functions similar to this package's Image component
  fixed={true}                       // Functions similar to this package's Image component
  name="filename.txt"
  description="The file description"
  options={...}                      // options for file annotations (see PDF Kit fileAnnotations method)
  annotation={true}                  // set to false to embed file without an accompanying annotation.
  src=...                            // a valid source for the embedded file (see PDF kit and this package's Image component)
/>

Describe alternatives you've considered I do not know of a way of embedding files in PDFs generated by @react-pdf, but I am open to suggestions. I know pdfkit is included in this package, so maybe there is a way to use the pdfkit file and fileAnnotation methods to do this with the current version of react-pdf.

Additional context No other context.

taranda commented 2 years ago

I just noticed that a similar feature was requested in #1751. This feature request has a different design, but both would achieve the requirement of attaching files to PDFs.