2

As pdftk is not yet available on Ubuntu 18.04 I compiled a pdftk fork following this excellent answer to a related question.

This works great, however I now have to type

java -jar build/jar/pdftk.jar

to run pdftk.

I would like to just type pdftk with its respective options. I created a bash script, but this does ignore the command line options. Any ideas?

dessert
  • 39,982
Bruni
  • 10,542

2 Answers2

2

That's a case for alias: Open ~/.bash_aliases in your preferred text editor and add this line:

alias pdftk='java -jar build/jar/pdftk.jar'

Save the file and open up a new terminal window (or run . ~/.bash_aliases in an existing), pdftk should work with the syntax as you know it now.

dessert
  • 39,982
1

Here a bash script for you

#!/bin/bash

exec java -jar /path/to/pdftk.jar "$@"

$@ is the variable you were looking for. It's all the argument you pass to the script that you pass on to pdftk.jar.

exec is to avoid another shell and replace it with java process.

solsTiCe
  • 9,231