Install PDFtk on Ubuntu

https://linuxhint.com/install_pdftk_ubuntu/

PDF is an integral part of our everyday life. It’s a document format that’s trusted by every single platform. Often times, important documents and books are in PDF format. It’s so widespread that without an appropriate PDF tool at hand, no system is complete. Ubuntu offers a great flexibility in terms of software availability. It’s also one of the most popular Linux distros for being so simple yet powerful and fast, extremely suitable for new to moderate Linux users. Let’s grab PDFtk – the ultimate PDF toolkit you’ll ever need!

 

PDFtk

There are 2 versions of PDFtk available – Free, Pro ($3.99) and Server. The Pro version offers all the additional features like rotating the PDF, stamping etc. The Server version is the command-line utility for performing various tasks.

PDFtk is available in the default Ubuntu software repository. However, on the latest Ubuntu releases, it’s not accessible directly. You have to use a little trick to get in on your system.

Method 1

Run the following commands –

sudo add-apt-repository ppa:malteworld/ppa
sudo apt update

sudo apt install pdftk

Method 2

You can also download and build PDFtk by yourself. For doing so, you need the Java build tools and dependencies.

Run the following commands –

sudo apt install default-jre-headless libcommons-lang3-java libbcprov-java

sudo apt install git default-jdk-headless ant \
libcommons-lang3-java libbcprov-java

git clone https://gitlab.com/pdftk-java/pdftk.git
 
cd pdftk
mkdir libs
ln -st libs /usr/share/java/{commons-lang3,bcprov}.jar

ant  jar
java -jar build/jar/pdftk.jar --help

Method 3 (recommended)

Install the PDFtk snap –

sudo snap install pdftk

Note that this is the “Server” version of PDFtk.

Using PDFtk

After the installation is complete, check out the app working perfectly –

pdftk

In fact, running this command will show a short guide you can use. For the long, in-depth guide, run the following command –

pdftk  --help

For checking out the guide later, export it to a text file –

pdftk --help > ~/Desktop/pdftk.txt

Here are some of the most used tasks you can do with PDFtk.

Encrypt a PDF (128-bit encryption)

pdftk dummy.pdf output dummy.128.pdf owner_pw foo user_pw  123

Decrypt a PDF

pdftk dummy.128.pdf input_pw  123 output dummy.unsecured.pdf

Join multiple PDFs into one

pdftk dummy1.pdf dummy2.pdf  cat output dummy_merged.pdf

You can also use wildcard –

pdftk  *.pdf cat output combined.pdf

Rotate PDF document (must be 1 page document)
# 90° clockwise rotate
pdftk dummy.pdf cat 1east 2-end output dummy_90.pdf

# 180° rotate
pdftk dummy.pdf cat 1-endsouth output dummy_180.pdf

Enjoy!

转载于:https://www.cnblogs.com/dhcn/p/11412720.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值