2

Since some time (possibly a month or two), pdftk stopped working on my system (Ubuntu 18.04, AFAIK all latest updates applied).

I now unconditionally get the error Error: Unable to find file:

pdftk A=file1.pdf B=file2.pdf cat A1 B2 output file3.pdf
Error: Unable to find file.
Error: Failed to open PDF file: 
   file1.pdf
Error: Unable to find file.
Error: Failed to open PDF file: 
   file2.pdf
Errors encountered.  No output created.
[···]$ ls -lh file*pdf
-rw-rw-r-- 1 cal cal 139K Oct  3 12:30 file1.pdf
-rw-rw-r-- 1 cal cal 139K Oct  3 12:30 file2.pdf
[···]$ file file*pdf
file1.pdf: PDF document, version 1.5
file2.pdf: PDF document, version 1.5

If I type evince file1.pdf, the PDF viewer opens and I see the file. The file is there and is accessible (it is owned by the same user cal, there are no permissions issues, etc.).

I ran the above command as root (both as sudo pdftk ... and sudo -i to login as root, then navigated to cal's directory and re-ran the pdftk command; exactly the same error messages in all cases)

Any ideas?

[EDIT]:
The problem seems to be related to user-specific settings. I copy the files to a different user's directory (adjusting ownsership, etc.), and the same command works over there. I ran env on both, and compared. Naturally, there are many differences (I mean in addition to the obvious ones such as HOME, PATH, PWD). I've tried setting env variables on the problematic user with the same value from the given env variable on the non-problematic user (for several variables that sounded like could be the culprit), but it still doesn't work.
[END EDIT]

Cal-linux
  • 123
  • 4
  • 1
    Two suggestions: (1) run with the `verbose` keyword; (2) provide full path names to the files (this shouldn't make a difference, but who knows). – Jos Oct 03 '22 at 17:22
  • Good suggestions indeed! Unfortunately, neither one makes a difference; `verbose` makes (funnily enough) _absolutely no difference_ (output is, bit by bit, identical). And as you suspected, providing full path made no difference either. I tried filenames in quotes (i.e., A="/home/cal/file1.pdf" ... ), and I also tried avoiding the aliases (i.e., avoid the A= and B=, and just try concatenating the two full input PDFs); same error messages every time. – Cal-linux Oct 03 '22 at 18:23
  • As the `pdftk` program clearly doesn't work as described, you may consider [contacting the developer](https://www.pdflabs.com/company/contact/). – Jos Oct 03 '22 at 21:58
  • 1
    Is it possible there are non-printing characters in the file names? What is the output of `ls -lb file*pdf` for example? – steeldriver Oct 03 '22 at 22:42
  • No. The original files I was working with had spaces in the filename; I thought it might be that (even though I was using `A="Document C-L - signed.pdf"`), so I renamed them to try (so, yes, file1.pdf was typed by myself as part of `mv "Document ... .pdf" file1.pdf`). I then even thought that numbers in the filenam might be a problem, so I renamed to filea.pdf and fileb.pdf and retried; no change. The output of `ls -1b file*pdf` is just the two filenames, one on each line. – Cal-linux Oct 03 '22 at 23:46

0 Answers0