How to Convert a PDF File to Editable Text Using the Command Line in Linux
Most of the users frantically try to convert PDF file into editable text in Linux platform with unsuccessful results. It is quite easier to convert PDF file in the Windows but in Linux people are left with fewer or no choices at all. Here are some smart and simple ways which will allow users to convert PDF into editable text by using command line in Linux.
Ways To Install pdftotext Package on Linux
Linux possess a tool in command line which is called pdftotext which is usually comes pre-installed. First check its presence in your system by pressing “Ctrl + Alt + T” which will open terminal window, now type the following command and press enter.
dpkg –s poppler-utils
Carefully look at the third line of the command which shows that the pdftotxt is successfully installed on your system and it is not installed then type this command and press enter.
sudo apt-get install poppler-utils
Then you will be asked to enter your password and press enter.
It should be noted that poppler-ttils offers a wider range of packages which helps in converting the PDF into different formats along with editing and extracting features. Once the pdftotext is successfully installed your system screen will look like this.
Ways To Convert PDF Files to Editable Text
Once you had successfully installed the pdftofile package now you are all set to turn any PDF into editable text. Open the terminal window gain by pressing “Ctrl + Alt + T” and typw this command in the prompt and press enter.
pdftotext /home/lori/Documents/Sample.pdf /home/lori/Documents/Sample.txt
Kindly change the path as per your desired file location and state where you wish to save your resulting file also.
It is better to keep the location of the changed file at the same place for better viewing experience. Otherwise you might find it difficult to locate the file at first. Once the PDF file is converted into a text file you can easily open it just like any other text file in the Linux OS.
The text file might have some line breaks in different place which results due to conversion of any PDF file. A line break is inserted after every line of text which is present in the PDF file and your resulting file might look like this.
Tip To Preserve The Layout Of The Document
If you are looking to preserve the layout of the document which includes the headers footer, paging and other aspects like the original in PDF file to the converted file then use the ‘-layout’ flag in the code.
Tip To Convert A Particular Range Of Pages In PDF File
If you are looking to convert only a particular range of pages rather than complete PDF file then use the –f and –l flags along with specifying the first and last pages in the file which ought to be converted.
pdftotext -f 5 -l 9 /home/lori/Documents/Sample.pdf /home/lori/Documents/Sample.txt
In order to get more information about the pdftotext command, just type ‘man page pdftotext’ in the command prompt and press enter.
- Previous Smart Ways To Stop Windows 10 Updates From Downloading Automatically
- Next How to Stop Auto-Playing HTML5 Videos in Your Web Browser