About K2pdfopt
K2pdfopt is a free and open-source PDF manipulation software developed by Willus. This software supports standard PDF editor features, such as PDF resizing and cropping. However, the main highlight of this tool is its ability to convert PDF files into formats that are accessible to mobile devices. K2pdfopt can optimize simple, text-based PDF files; complex, multi-column PDF files; and can extract text from PDF files containing images with OCR technology.
This article will only cover optimizing simple, text-based PDF files for small screens. K2pdfopt comes with numerous options and hundreds of combinations that can be used according to your requirements. It is not realistic to cover them all here, so the focus of this article will be converting single-column PDF files containing text only. You can always experiment with this tool by following an in-depth explanation of its options available here.
Installing K2pdfopt in Linux
To install K2pdfopt on Ubuntu, run the command below:
Note that the version available in official repositories of Ubuntu may be outdated. You can install the latest version of the K2pdfopt executable binary for Ubuntu and other Linux distributions here.
Converting a Simple, Text-Only PDF File
Run the command below to launch K2pdfopt:
If you downloaded the binary, use the following commands instead:
$ ./k2pdfopt file.pdf
K2pdfopt features a well-made interactive command-line utility that makes it easy to enter customization options. After launching K2pdfopt, you should see the following layout:
Every option mentioned in the output above is preceded by an abbreviation code. All you need to do is enter these codes, as per your requirements, and follow the on-screen prompts. The interactive tool will also output the correct command-line switches that you can use directly on the binary.
For instance, to wrap text for better readability on mobile, enter “w” and follow the on-screen prompts. If you are not sure about a prompt, you can just hit the <Enter> key to select the default value. The screenshot below shows some of the prompts you will get after entering “w:”
You can enter any valid abbreviation code, any number of times. You will keep getting interactive prompts to customize the conversion behavior. Once you are satisfied with the options, hit the <Enter> key.
Take note of the “Selected options” line, which outputs the command-line parameters you selected from the interactive tool. The next time you want to use the same set of options, you will not be required to go through the interactive tool again. You can just use the stated options directly. For example:
If you are happy with the “Selected options,” hit the <Enter> key once again to start the conversion process:
Wait for the process to finish, you should get a new file suffixed with the term “k2opt.” In this instance, you will get a file called “file_k2opt.pdf.”.
Before conversion, the file looks like this on my device:
After conversion, the file becomes:
For reference, I use the command below for my Android device:
1080 -h 1920 -om 0.1,0.1,0.1,0.1
This command wraps the text for a better mobile reading experience, enlarges the text size by increasing the DPI values, sets margins on all four sides to 0.1 inches wide, and optimizes the file for 1920×1080 resolution. You can check the exact specifications of your device by installing a system information app, such as “CPU-Z.”
Book Reader Android App
If you do not have a Linux PC to work with, you can use the free and open-source Book Reader Android app to make PDF files mobile-friendly on-the-fly. The Book Reader app includes support for K2pdfopt and works fine for optimizing simple, text-based PDF files. The experience is not as smooth as a pre-optimized PDF file, and lags can be observed when scrolling and performing on-the-fly conversions. However, it gets the job done, supports a dark theme, and includes an option for increasing and decreasing font size.
Below is an example showing the mobile-friendly layout in the Book Reader app. Before optimization, the file looks like this:
You can click on the hamburger-style icon in the top bar to optimize the PDF. After optimization, the file looks like this on a mobile device:
Note that the Book Reader app does not convert the original PDF file, and is kept intact.
Conclusion
Some PDF viewers on mobile devices support text reflow mode. This mode tries to improve readability by wrapping the text. However, I found them to be poorly optimized with an uneven layout and bad hyphenation rules. K2pdfopt, on the other hand, is much more customizable and efficient at text wrapping, and can completely remove hyphenation. Hopefully, this article taught you about how to convert PDFs into more readable formats on your mobile device.
from Linux Hint https://ift.tt/2DnAeDe
0 Comments