Unable to view pdf attachments

Ok I found mutool (from the mupdf-tools package) which seems to be helping with parsing via mutool show /path/to/file.pdf grep.

The good file has, among other things, clearly defined references to the embedded file.

example_041.pdf:7: <</Border[0 0 0]/Contents<FEFF0074006500780074002000660069006C0065>/CreationDate(D:20150802122217+00'00')/F 4/FS 8 0 R/M(D:20150802122217+00'00')/NM(0001-0000)/Name/PushPin/P 11 0 R/Rect[240.94489 751.18136 255.1181 765.35458]/Subtype/FileAttachment/Type/Annot>>
example_041.pdf:8: <</EF<</F 9 0 R>>/F(utf8test.txt)/Type/Filespec>>
example_041.pdf:9: <</Filter/FlateDecode/Length 2649/Params<</Size 4384>>/Type/EmbeddedFile>>
⋮
example_041.pdf:16: <</Lang<FEFF0065006E>/Metadata 15 0 R/Names<</EmbeddedFiles<</Names[(utf8test.txt)8 0 R]>>>>/OpenAction[11 0 R/FitH null]/PageLayout/SinglePage/PageMode/UseNone/Pages 1 0 R/Type/Catalog/Version/1.7/ViewerPreferences<</Direction/L2R>>>>

Looking at our problem child it doesn’t look so problematic after all, though the definitions are different and there’s JavaScript, which is odd, but it seems to be the thing that warns about the embedded files (e.g. in okular):

ITA-560-2005.pdf:97: <</Desc<>/EF<</F 29 0 R>>/F(001. INDEX SHEET.pdf)/Thumb 34 0 R/Type/Filespec/UF(001. INDEX SHEET.pdf)>>
ITA-560-2005.pdf:98: <</Desc<>/EF<</F 30 0 R>>/F(002. PLEADING.pdf)/Thumb 33 0 R/Type/Filespec/UF(002. PLEADING.pdf)>>
⋮
ITA-560-2005.pdf:136: <</EmbeddedFiles 68 0 R/JavaScript 137 0 R>>
ITA-560-2005.pdf:137: <</Names[(ADBE::FileAttachmentsCompatibility\000)138 0 R]>>
ITA-560-2005.pdf:138: <</JS(var v = app.viewerVersion;\nif \(v < 7\)\n{\n\tvar n = 0;\n\tif \(this.dataObjects != null\)\n\t\tn = this.dataObjects.length;\n\tif \(v >= 5 && v < 6 && n > 0 && \(app.viewerVariation == "Full" || app.viewerVariation == "Fill-In"\)\)\n\t{\n\t\tif \(this.external\)\n\t\t\tapp.alert\("This document has file attachments. To view the attachments, click the Save button to save a copy of the document, open the copy in Acrobat, and use the File > Document Properties > Embedded Data Objects menu.", 3, 0\);\n\t\telse\n\t\t\tapp.alert\("This document has file attachments. Use the File > Document Properties > Embedded Data Objects menu to view the attachments.", 3, 0\);\n\t}\n\telse if \(v >= 6 && v < 7\)\n\t{\n\t\tif \(n == 0\)\n\t\t{\n\t\t\tvar np = this.numPages;\n\t\t\tsyncAnnotScan\(\);\n\t\t\tfor \(var p = 0; p < np && n == 0; ++p\)\n\t\t\t{\n\t\t\t\tvar annots = this.getAnnots\(p\);\n\t\t\t\tif \(annots != null\)\n\t\t\t\t{\n\t\t\t\t\tfor \(var i = 0; i < annots.length; ++i\)\n\t\t\t\t\t{\n\t\t\t\t\t\tif \(annots[i].type == "FileAttachment"\)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tn = 1;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif \(n > 0\)\n\t\t{\n\t\t\tif \(this.external\)\n\t\t\t\tapp.alert\("This document has file attachments. To view the attachments, click the black triangle at the top of the document window's vertical scrollbar and choose File Attachments.", 3, 0\);\n\t\t\telse\n\t\t\t\tapp.alert\("This document has file attachments. Use the Document > File Attachments menu to view the attachments.", 3, 0\);\n\t\t}\n\t}\n}\n)/S/JavaScript>>

Using pdfinfo from the poppler-utils package (qpdfview uses Poppler libraries for PDF processes), it seems that there aren’t any other glaring differences and they are indeed using the same PDF version (1.7). Finally using pdfdetach -list on both files shows the correct filenames as being attached to the PDF.

1 Like

I also tested further and as far as I can see the big difference in the OP file (ITA-560-2005.pdf) is that it is an Adobe Portfolio created file. I do not know if this significant but I created several pdf files with added attachments (made in Adobe Reader) and not Portfolio files and I could open them in both qpdfview version 04.17.99 and 04.18.00.

@leok I think you mean Pro not Portfolio (see “Creator” in pdfinfo). Anyways I wouldn’t expect THE canonical PDF tool to create non-standard PDFs.

I found some other example files mentioned here. I actually looked at the containing folder of the example files and found a few more. They’re almost all made in Acrobat PDFMaker for Word (again, canonical tool) and except for the one with the file hidden in the annotation, none of them work in qpdfview (well the embedded videos show but they don’t play; that might be a different issue).

Long story short, I think we can safely conclude that embedded files are not working properly in qpdfview unless they are defined to somehow show in the PDF itself. So I think we have a well defined bug report. You want to file it @leok or should I?

@wxl - Actually I was referring to Adobe PDF Portfolio (created by Adobe Pro ) which are according to Adobe “multiple files assembled into an integrated PDF unit” as opposed to a pdf file containing an attachment (independant pdf file).
I will file the bug report in the morning. :smiley:

Cool, thanks! Please post a link here.

Bug report link here:
https://bugs.launchpad.net/ubuntu/+source/qpdfview/+bug/1859399

1 Like

@leok in what way (given the likes of pdfinfo, mutool, or some other tool) can someone verify that a particular PDF is in this Portfolio format? I mean besides that image that gets displayed, which might actually be a false positive.

@wxl - I am not sure but will look into it. I notice that if the files in my example in the bug report are opened in Adobe Reader - selecting “view” from the drop down menu includes the selection"portfolio" for the file ITA-560 but not in the file “test1.pdf” .
Maybe we should take a good look at this info from Adobe:
(http://www.adobepress.com/articles/article.asp?p=1688701)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.