I think the pdf file name can contain spaces, so you probably need to use something like `Shellwords.shellescape(path)`