I'm trying to compile a bunch of PDFs into a single document. ls
shows the files are in the directory that I'm in and they're readable (-rw-r--r--
). But when I try to run pdftk 2017.pdf cat output test.pdf
I get an error:
Error: Unexpected Exception in open_reader()
java.io.FileNotFoundException: 2017.pdf (Permission denied)
at gnu.java.nio.channels.FileChannelImpl.open(libgcj.so.16)
at gnu.java.nio.channels.FileChannelImpl.<init>(libgcj.so.16)
at gnu.java.nio.channels.FileChannelImpl.create(libgcj.so.16)
at java.io.RandomAccessFile.<init>(libgcj.so.16)
at pdftk.com.lowagie.text.pdf.RandomAccessFileOrArray.<init>(pdftk)
at pdftk.com.lowagie.text.pdf.PRTokeniser.<init>(pdftk)
at pdftk.com.lowagie.text.pdf.PdfReader.<init>(pdftk)
at pdftk.com.lowagie.text.pdf.PdfReader.<init>(pdftk)
Error: Failed to open PDF file:
2017.pdf
Errors encountered. No output created.
Done. Input errors, so no output created.
If I add more files to that operation I just get the error for each of them.
I can rename the PDFs from the command line mv 2017.pdf foo.pdf
and I get the same error. Error: Unexpected Exception in open_reader()
java.io.FileNotFoundException: foo.pdf (Permission denied)
If I try to call a non-existent file, eg. pdftk 123.pdf cat output test.pdf
I get a different error:
Error: Unable to find file.
Error: Failed to open PDF file:
123.pdf
Errors encountered. No output created.
Done. Input errors, so no output created.
Even tail 2017.pdf
shows the last few lines of 2017.pdf:
<<
/Info 63 0 R
/ID [<cc59759cedaf07420bbe3250ba5d8971><f259ad128310d106c7aa80b673c4bd70>]
/Root 62 0 R
/Size 64
>>
startxref
42883
%%EOF
If I can see the file and read it with tail
, why would pdftk
not be able to read it?
foo.pdf
or something, just in case there's a weird bug in pdftk that makes it fail on that filename? I really doubt it will help, but you never know... – terdon♦ Aug 4 '19 at 17:32cd
ed into the target dir? Do you get the same issue if you copy your file to your$HOME
? – terdon♦ Aug 4 '19 at 17:43pdftk
and the Java libraries it uses. Try to update both to the newest versions with your package manager. If you have multiple versions of Java installed, try to get rid of the oldest ones. – dirkt Aug 4 '19 at 17:45