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. 【转】python 调用super()初始化报错“TypeError: super() takes at least 1 argument”

    一.实验环境 1.Windows7x64_SP1 2.Anaconda2.5.0 + python2.7(anaconda集成,不需单独安装) 二.实验步骤 2.1 在python中有如下代码: cl ...

  2. Vue.js 源码分析(十一) 基础篇 过滤器 filters属性详解

    Vue.js 允许你自定义过滤器,可被用于一些常见的文本格式化.过滤器可以用在两个地方:双花括号插值和 v-bind 表达式 (后者从 2.1.0+ 开始支持).过滤器应该被添加在 JavaScrip ...

  3. Linux(centOS6.5)安装RabbitMQ

    第一.下载erlang和rabbitmq-server的rpm: wget  http://www.rabbitmq.com/releases/erlang/erlang-19.0.4-1.el7.c ...

  4. 前端学习:学习笔记(JS部分)

    前端学习:学习笔记(JS部分) 前端学习:JS学习总结(图解)    JS的简介 JS基本语法 JS内置对象 JS的函数 JS的事件 JS的BOM JS的DOM JS的简介 新建步骤 <body ...

  5. 【华为云实战开发】8.如何快速搭建C#网站并实现持续集成?【华为云技术分享】

    1 概述 1.1 文章目的 本文通过一个实例介绍如何使用软件开发服务DevCloud完成一个C#Web项目的开发. 1.2 项目详情 1. 项目名称:超级冷笑话网站 2. 项目简介:一个Web网站,包 ...

  6. Linux ip Command

    Syntax ip OBJECT COMMAND ip [options] OBJECT COMMAND ip OBJECT help Understanding ip command OBJECTS ...

  7. Python程序调试工具Py-Spy

    序言 如果你是从Java语言开发转Python开发,可能在庆幸自己的开发效率提高了很多,但是也有痛苦的时候,比如你会怀念jstack,jmap, 等各种工具在生产环境做perfomance tunin ...

  8. Reactor的NIO线程模型

    1.Reactor单线程模型 传统的javaNIO通信的线程模型.该线程模型仅有一个I/O线程处理所有的I/O操作,如下图:   单线程模型的Reactor 所有的客户端都连接到一个I/O线程负责的A ...

  9. Application类-多窗口交互

    我们在派生自Application类中出来放置响应应用程序事件的代码外,还可以放置一些完成其他任务的代码. 在此之前要知道: 如何获取应用程序的Application对象: //App是一个继承自Ap ...

  10. aspx页面,后端通过Attributes.Add给textbox添加事件时,传参失效问题。

    测试一:------------------------------------------------------------------------------------------------ ...