The following patches make pdfinfo indicate if the pdf contains javascript and provide the option of printing all the javascript code in the pdf.
Created attachment 83560 [details] [review] Indicate of pdf contains javascript This patch adds an extra line to the pdfinfo output indicating if the pdf contains JavaScript.
Created attachment 83561 [details] [review] print out javascript This patch adds a "-js" option to pdfinfo that makes it print out all the JavaScript code in the pdf. You can test it with these files: 09_r100pdf_a.pdf animated-definite-integral.pdf bug161327-2.pdf bug230210.pdf bug263803.pdf bug302334_2.pdf bug-poppler16762.pdf bug-poppler17444.pdf bug-poppler17901.pdf bug-poppler18003.pdf bug-poppler19915.pdf bug-poppler20009.pdf bug-poppler24036.pdf bug-poppler9203.pdf example_054.pdf
Created attachment 83562 [details] [review] print out javascript updated to fix a bug
Created attachment 83563 [details] [review] indicate of pdf contains embedded files It is also useful for pdfinfo to indicate of the pdf contains embedded files.
The JSInfo object/api looks a bit weird, for example we parse the "WC" entry in actions there but nowhere else in our code. I would sincerely prefer if the parsing of stuff was in the objects it belongs to. Do you think that's doable?
Created attachment 83662 [details] [review] indicate if pdf contains javascript Updated to move parsing out of JSInfo.
Created attachment 83663 [details] [review] print out javascript Updated to move parsing out of JSInfo.
I think you "deprecated" the 'indicate of pdf contains embedded files' patch by mistake and then named one of the js patches as embedded files. Want to fix that? Or maybe add the "embedded files" one to a different bug?
After a review of the code i can't find anything wrong. The JSUtil* files seem like they belong more to utils/ than to poppler/ specially after the addition of the "Field Activated" things, that would not be much useful to an external program as they are untranslatable (maybe an enum and then the char * in pdfinfo makes more sense and then keep JSUtil* in poppler/) Also, I understand you've run the new code over all the files and got no crashes because of the new code?
Created attachment 84163 [details] [review] indicate if pdf contains javascript I've updated the patches to move JSInfo.* into utils and checked that it runs on all the regtest files.
Created attachment 84164 [details] [review] print out javascript
Looks good to me. You have commiting rights, right? Maybe you can way a few days and if noone complains commit to master. Ah, and for the files make sure you add the line "this file is under gpl 2 or later" like we have on some other files that we have created from scratch.
I've added the GPL line and pushed to master.
I only today discovered this new feature -- very useful, thank you very much. Will be using it quite frequently from now, so thanks again.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.