2022-09-08 17:15:25 • Filed to: Knowledge of PDF Files • Proven solutions
A convert PDF to text job on Linux is easy if you know a few tips and tricks in your particular distro, but what if you're new to Linux and you need to get a PDF document converted to a text-based equivalent? Are there any Linux tools specifically designed for this? How about OCR modules - how do you get them for Linux? The answers to these questions all in this article, so read on to learn more about how to convert PDF to text in Linux.
Let's look at a couple of ways to do this on a Linux desktop and the tools for those.
Essentially, what you want to do is convert a non-editable and possibly non-searchable PDF document and convert the content without actually changing the format. For this, you can use freeware or an open-source application like Calibre. It is available in most repos for Ubuntu, Mint, Fedora, and other popular distros. The correct syntax varies from one distribution to another, but your basic Terminal command should look something like this:
sudo apt install calibre
Once installed, you can follow the flow of the process from within the application. Here's what it should look like:
You can now open the file in any text editor and make changes or edit the content the way you want. This does not retain the format of the original but it's a fairly authentic copy of the non-editable file. The original PDF document will be unchanged, so you can save the new version with a slightly different name like Doc1_OCR, Doc2_OCR, and so on.
On the other hand, if you're at an expert level on your Linux machine, you can try the command line way of converting PDF to text. For this, you can use something like pdftotext. It's part of the Poppler package but the name might vary based on which distro you're using. The first step is to install it, and you can do it with the following commands:
1. First, type the following in Terminal and hit "Enter"
sudo apt install poppler-utils [Works for Debian, Mint, Ubuntu, etc.]
2. The next command is the one for conversion, and it should look like this:
pdftotext -layout source.pdf target.txt [Source is the original PDF and Target is the final output]
To execute the above command, the Terminal prompt needs to be in the same folder location as your source PDF file. Alternatively, you can define a file path before the source and target file names within the command.
3. Hit Enter to run the command on the entire PDF document. To convert just a single range of pages within the document, modify the syntax to match the one shown below:
pdftotext -layout -f M -l N source.pdf target.txt [where M is the first page and N is the last one to be converted.]
Now you know how to convert PDF to text in Linux, how about Windows or Mac? Do you know how to do the same thing on these OS platforms? If not, read on to learn about a unique and robust utility to do the same job in operating systems other than Linux.
Wondershare PDFelement - PDF Editor is a cross-platform PDF editor with desktop and mobile applications for PDF management. They're a lightweight family of PDF tools that are incredibly powerful and versatile. More importantly, they're far more affordable than some of the other premium options that rule the market today. For that reason, PDFelement is quickly becoming the de facto PDF editor for businesses that can't afford expensive alternatives. In addition, it boasts these features:
Steps for Converting PDF to Text in Windows and Mac:
Windows:
Mac (macOS versions including 10.15 Catalina):
PDFelement is equally intuitive on a Mac as it is in Windows. You might see a lot of UI differences between the two, but those features have been designed to work as closely as possible with the nuances of their platforms. The end result is a pretty native experience on any platform, including touchscreen-based iOS and Android devices and screens.
Now you know all there is to know about how to convert PDF to Text on Linux, Windows, and Mac.
Free Download or Buy PDFelement right now!
Buy PDFelement right now!
chief Editor