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!

Install PDFtk on Ubuntu的更多相关文章

  1. Install Docker on Ubuntu

    Install Docker on Ubuntu Estimated reading time: 17 minutes Docker is supported on these Ubuntu oper ...

  2. (转) How to install eclipse in ubuntu 12.04

    源地址:http://www.krizna.com/ubuntu/install-eclipse-in-ubuntu-12-04/ Eclipse installation in ubuntu 12. ...

  3. Install OpenCV on Ubuntu or Debian

    http://milq.github.io/install-OpenCV-ubuntu-debian/转注:就用第一个方法吧,第二个方法的那个sh文件执行失败,因为我价格kurento.org的源,在 ...

  4. Install OpenCV-Python in Ubuntu

    之前安装python版opencv,需要下载whl文件,进行安装,这是在window环境下的: 安装opencv_python,下载whl包 安装系统python下的opencv 今天发现一个简单的方 ...

  5. How To Install Cacti On Ubuntu 14

    How To Install Cacti On Ubuntu 14.04/14.10 by anismaj Cacti is an open source web based network moni ...

  6. How To Install Nginx on Ubuntu 16.04 zz

    Introduction Nginx is one of the most popular web servers in the world and is responsible for hostin ...

  7. How to Install PhantomJS on Ubuntu 16.04

    Introduction PhantomJS is a scripted, headless browser that can be used for automating web page inte ...

  8. install cinnamon on ubuntu 14.04

    emotion: I feel not comfortable with ubuntu 14.04 default desktop unity,i still look for a alternati ...

  9. ubuntu 16.04上源码编译和安装cgal并编写CMakeLists.txt | compile and install cgal on ubuntu 16.04

    本文首发于个人博客https://kezunlin.me/post/39ab7ed9/,欢迎阅读最新内容! compile and install cgal on ubuntu 16.04 Guide ...

随机推荐

  1. Django性能优化的几种方法

    1.一次性取出你所需要的数据 单一动作,需要多次连接数据库里的时候,最好一次性取出所有需要的数据,减少连接数据库的次数.此类需求推荐使用QuerySet.select_related()和prefet ...

  2. android 模拟输入框edittext控件按下回车或扫描头扫描到条码

    edtScan.setText(result); edtScan.onEditorAction(EditorInfo.IME_ACTION_NEXT); 场景:PDA都有扫描头,但有时想用自己的手机来 ...

  3. Java之数据库基础理论

    一.事务的四大特性 ACID 只有满足一致性,事务的执行结果才是正确的. 在无并发的情况下,事务串行执行,隔离性一定能够满足.此时要只要能满足原子性,就一定能满足一致性. 在并发的情况下,多个事务并发 ...

  4. SpringBoot系列之profles配置多环境(篇一)

    SpringBoot profles配置多环境 23/100 发布文章 u014427391 软件环境简介 这里介绍一下SpringBoot提供的profiles属性加上maven配置一下多环境,在实 ...

  5. 阿里云RDS数据库备份同步到自建库方法(SHELL脚本)

    一.背景: 由于阿里云RDS生产库每天都需要备份且拷贝到自建读库,而如果使用阿里云的自动拷贝到只读实例, 费用太高, 故采用自编写同步脚本方法实现. 二.前提: 1). 已开通阿里云RDS, 且开启定 ...

  6. 我自己整理的 Linux 常用命令

    1.查看文件安装路径: 由于软件安装的地方不止一个地方,所有先说查看文件安装的所有路径(地址). 这里以 xsp 为例.比如说我安装了xsp,但是不知道文件都安装在哪些地方.放在哪些文件夹里,可以用下 ...

  7. C#查找指定路径下的所有指定文件,并读取

    string path="指定路径"; string filename =“需要查找的文件名.csv"; List<string> lineStringLis ...

  8. 关于Panel隐藏横向滚动条

    不设置控件的AutoScroll属性,在后台写代码,就可以隐藏掉横向滚动条

  9. vertx 异步编程指南 step7-保护和控制访问

    保护和控制访问与Vert.x很容易.在本节中,我们将: 从HTTP转移到HTTPS,以及 使用基于组的权限将用户身份验证添加到Web应用程序,以及 使用JSON Web令牌(JWT)控制对Web AP ...

  10. Visual Studio Code创建C#项目

    Visual Studio Code是一个支持跨平台的文本编辑器,同其他文本文本编辑器一样,不但占用磁盘空间小,性能也比较快:近几年由于不断的升级和许多开发者提供大量的插件,它已经成为了一个非常强大的 ...