More tricks for short-sighted Linux users

Tricks for short-sighted Linux users

At previous article We explain how we can download videos and subtitles to be able to take advantage of the tools that desktop video players make available to the disabled and make available to those of us who have visual problems. Next, we go with more tricks for short-sighted Linux users.

In this case, we will see how we can change the typography, background and format of e-books.

More tricks for short-sighted Linux users

I have to make a clarification. There are some tutorials on the Internet that explain how to do this using plugins. The problem is, referring to e-books distributed by Amazon, that the serial number of a device registered in the user's name is needed. Since I don't have any, all that remains is to do things the hard way.

Programs that we will need

(You can find them in the repositories of the main Linux distributions)

  • scrot: Screen capture tool for the command line.
  • Xdotools: Simulates mouse button pressure.
  • Gscan2PDF:  Convert image pdf to text pdf.
  • caliber: Convert PDF text into other formats.
  • tesseract-ocr and tesseract-ocr-spa: Spanish character and language recognition program.

In the case of Caliber, I recommend installing it from their website since it is usually more updated. We do it from the terminal with this command:

sudo -v && wget -nv -O- https://download.calibre-ebook.com/linux-installer.sh | sudo sh /dev/stdin

The method

What we are going to do is automate the turning of online reader pages and screenshots. Next, we will put the screenshots together into a PDF and perform optical character recognition to create another one in text format. If we wish we can convert this second pdf to another format.

First step: Automation

To take different screenshots We need to automate the page turning process since doing it manually is tedious. The process is the following.

  1. Open the book in the web reader or the reader software of the service where the book is.
  2. Maximize the window.
  3. Open the terminal, but make it smaller enough to allow you to see the other window. Place it on the left side.
  4. In the terminal type the command xdotool getmouselocation but do not press Enter.
  5. Move the pointer to where the reader's page turn button is and press Enter.
  6. Take note of the coordinates that it shows you in the terminal.

Open your distribution's text editor and paste this script.

#!/bin/bash
while [ 1 ]; do
xdotool mousemove XXXX YYY click 1 &
scrot -q 100 '%Y-%m-%d-%H:%M:%S.png' -e 'mv $f ~/Carpeta_de_archivos/'
sleep 20
done

Replace XXXX and YYYY with the coordinates you copied previously. Replace ~/File_Folder/' with the folder where you want the files to be saved.

Save the file with the name script.sh.

Now, place the pointer on the icon of the script you saved and with the right click on Properties, click on the option to give it execution permissions.

Create the destination folder with the command

mkdir destination_folder_name.

Remember that it must match the name of the folder you put in the script.

Next, open the reader and the terminal. In the terminal write.

./script.sh

Set the reader to full screen and wait for the capture process to finish. You'll notice why that's when you stop turning pages. Minimize the reader and close the terminal.

For best results have the text displayed in a single column.

Second step: PDF creation

Go to the destination folder and delete the duplicate ones. Next:

  1. Open Gscan2pdf.
  2. Go to Menu File/Open and select all the images.
  3. Go to the Tools/OCR menu and select All pages, Tesseract as an OCR engine and the corresponding language.
  4. Press on Start ocr.
  5. When the recognition is finished go to File/Save and select All and the pdf format.
  6. Click Save and choose the destination.

Now you have a pdf of text that maintains the styles and images. If you ltext reader allows it, you can change the colors and typography. You can also convert it to other formats with Caliber.


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.