How to Split PDF File on Ubuntu 18.04
Splitting PDF files is a common task for many users, particularly for those who need to extract specific pages from a larger document. In this tutorial, we will cover how to split PDF files on Ubuntu 18.04 using the unipdf-cli command-line tool. This powerful tool is simple to use and supports a variety of PDF operations.
Prerequisites
Before we start, ensure you have the following:
- A computer running Ubuntu 18.04 or later.
- Access to the terminal.
- Basic knowledge of using command-line tools.
- Go programming language installed (minimum version 1.24).
Main Steps
Step 1: Install Go
If you do not have Go installed on your system, you can install it by running the following commands in the terminal:
sudo apt update
sudo apt install golang-go
Step 2: Clone the unipdf-cli Repository
Next, you need to clone the unipdf-cli repository from GitHub. Run the following command:
git clone https://github.com/unidoc/unipdf-cli.git
Step 3: Build unipdf-cli
Change into the directory and build the tool using Go:
cd unipdf-cli/cmd/unipdf
go build
Step 4: Splitting PDF Files
Now, you are ready to split your PDF file. The basic syntax for splitting a PDF file is as follows:
./unipdf split INPUT_FILE OUTPUT_FILE [PAGES]
Replace INPUT_FILE with the name of your original PDF, OUTPUT_FILE with the name of the resulting file, and PAGES with the ranges of pages you want to extract.
Example Usage
To split the first two pages of a PDF file named example.pdf and save it as output.pdf, use:
./unipdf split example.pdf output.pdf 1-2
You can also specify multiple page ranges. For instance, to extract pages 1-3 and 5, you would use:
./unipdf split example.pdf output.pdf 1-3,5
Advanced Configuration
If your PDF file is password protected, you will need to supply the password using the -p or --password flag:
./unipdf split -p yourpassword example.pdf output.pdf 1-2
Replace yourpassword with the actual password for the PDF file.
Best Practices
- Always make a backup of your original PDF files before performing any operations.
- Use descriptive names for output files to keep track of them easily.
- Test the output PDF to ensure the pages were split correctly.
- Familiarize yourself with other features of unipdf-cli, such as merging and encrypting PDF files.
Troubleshooting
If you encounter issues while splitting PDF files, consider the following troubleshooting tips:
- Invalid Page Range: Ensure that the page numbers you specify exist in the original PDF. For example, if your PDF has only 5 pages, trying to extract pages 1-10 will lead to an error.
- Password Issues: If you forget the password for a protected PDF, you will not be able to split the file without it.
- Permission Denied: Make sure you have appropriate permissions to read the input file and write to the output location.
- Go Errors: If you encounter issues related to Go, ensure your Go installation is correct, and you are using the supported version.
Conclusion
Splitting PDF files on Ubuntu 18.04 can be accomplished easily with the unipdf-cli tool. By following the steps outlined in this tutorial, you can quickly extract specific pages from PDF documents, making it a convenient solution for both casual users and professionals alike. Remember to practice good file management and stay organized when working with multiple PDF files.
For any further assistance or to consult a professional, feel free to reach out:
Konsultasi Jasa Setup SekarangVerifikasi Teknis
Panduan ini disusun berdasarkan referensi teknis terbaru. Namun, konfigurasi server dapat bervariasi. Lihat sumber referensi asli →
📚 Artikel Terkait
Screenshot Layar Linux dengan Shutter
634 kata • Baca selengkapnya →
How to Fix Security & Setup Warnings in Nextcloud
569 kata • Baca selengkapnya →
Cara Setting Firewall dengan FirewallD di CentOS 8
611 kata • Baca selengkapnya →
How to Install Grafana for System Monitoring on Ubuntu 18.04
634 kata • Baca selengkapnya →