Bug 138793 - Add file attachments to pdf when exporting
Summary: Add file attachments to pdf when exporting
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Printing and PDF export (show other bugs)
(earliest affected)
Hardware: All All
: medium enhancement
Assignee: Not Assigned
Keywords: needsUXEval
Depends on:
Blocks: PDF-Export-Invalid
  Show dependency treegraph
Reported: 2020-12-10 08:41 UTC by udgrafdes
Modified: 2021-11-16 09:27 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:

Example of attach dialog for PDF export (20.70 KB, image/png)
2020-12-10 09:12 UTC, udgrafdes

Note You need to log in before you can comment on or make changes to this bug.
Description udgrafdes 2020-12-10 08:41:12 UTC
Often I prefer to output various tutorials and other documents as PDF for easier reading and printing, and often these tutorials come with source code. If I export the pdf as a hybrid pdf, attaching the files using pdftk destroys the hybrid portion. I would often prefer to have the source document bundled into the pdf as well as having the associated extra files.

I would imagine a reasonable implementation would just involve adding an extra tab to the pdf export dialog, and under that tab would be an "browse/choose" button that opens a file open modal dialog, a remove button, an okay button, and a cancel button. In addition, a multiline control list that shows which files will be attached and allow them to be selected and removed from the list.

Actual Results:
Should be able to attach files to hybrid pdf.

Expected Results:
Should be able to attach files to hybrid pdf.

Reproducible: Always

User Profile Reset: No

Additional Info:
Should be able to attach files to hybrid pdf.
Comment 1 udgrafdes 2020-12-10 09:12:41 UTC
Created attachment 168029 [details]
Example of attach dialog for PDF export

Adding example as described by feature request.
Comment 2 udgrafdes 2020-12-10 09:28:37 UTC
The thought occurs to me that the "Ok" and "Cancel" buttons aren't really necessary, since the files in the list should automagically be attached when the used finalizes their export.
Comment 3 V Stuart Foote 2021-11-11 16:38:30 UTC
While PDF 1.4 may allow our Hybrid PDF to show its embedded file attachments, see bug 95328 or bug 66580, instead of our current non-compliant and hidden LO Hybrid stream embedding--adding additional embedded file attachments to the LO Hybrid PDF seems out of scope.

Comment 4 Heiko Tietze 2021-11-16 08:10:21 UTC
The Hybrid PDF is, to my knowledge, a proprietary enhancement aiming to not only share a portable document but also its source. It is not intended to be a container for random files. And besides the UI to select the files to be included you would need to access it, somehow. You also have to consider security issues with attached content.

Putting all together I think a ZIP file or just URLs to download the code snippets is better suited for your workflow.

Any other opinion, Miklos, Simon?
Comment 5 Simon Phipps 2021-11-16 09:26:09 UTC
I would be very concerned by the ability to add arbitrary files to a hybrid PDF as it would become a vector for malware. I would thus treat the request as out-of-scope for LibreOffice.
Comment 6 Heiko Tietze 2021-11-16 09:27:26 UTC
So let's resolve WF.