1

I have a PDF file with other PDF files attached to it. Acrobat shows them in "Attachments" tab and allows to open them in turn.

QPDF documentations says something about extracting attachments but I failed to find any particular commands that do that.

Is it possible to extract these attachments and have them stored on the disk as separate PDF files?

UPDATE: Just a notice to explain better what you can see in the UI: "Attachments" tab was present in older versions of Acrobat, as well as a special page of the container document recommending to download newer version of Acrobat (this page seems to be really existing as it is shown in other viewers as well as on preview image). Latest versions of Acrobat (Reader) skip this page and get you to the first attached document, with the list of all attachments shown on the left side of the screen.

greatvovan
  • 2,439
  • 23
  • 43

2 Answers2

2

I found an old GitHub issue which a little bit clarify the possibilities of attachment extraction.

It is possible to extract attachments from PDF files using the qpdf library by understanding the PDF file structure and pulling the attachments out "manually" by knowing which objects to extract. There is nothing in the public API at the moment nor in the command-line tool that enables you to work with attachments as a first-class thing, but there is an item in the TODO list, and there is some private code used internally to detect cases where attachments are encrypted differently from the rest of the file. The main reason, aside from lack of time, that attachments are not more directly supported is because there have been various ways that they are stored in the file, and I don't know whether I have examples of all of them. I'm reluctant to add a feature for attachments that may miss some attachments in some older PDF files.

https://github.com/qpdf/qpdf/issues/24

So, it seems it is possible but you should examine the details of the pdf file.

wiktor
  • 1,605
  • 16
  • 13
1

Starting with qpdf 10.2, you can work with file attachments in PDF files from the command line. The following options are available:

http://qpdf.sourceforge.net/files/qpdf-manual.html#ref.attachments

user2718593
  • 111
  • 8