TwitterFacebookInstagramYouTubeWhatsAppWWWPinterestE-Mail

PDFImage2TXT – DOWNLOAD INSTALLER HERE

What can you do with it?

  • Convert scanned PDFs to TXT.
  • Convert scanned Documents to TXT.
  • No coding required!!
  • Installer for Windows
  • Source code included!
  • MIT license

How to install/run?

Tutorial and things you have to know:

,.-‘'-.,_,.' Step 1 '.,_,.-'‘-., Screenshot
Defining the problem:
As a German teacher in Brazil, quite often I have
to read texts about philosophy, politics, medicine etc. with my
students. Nowadays, the PDF format is the most common file format to
share text because of its simplicity.

As a German teacher, I distinguish between 3 types of PDFs:

1) The “text-is-text-format”:
The text we see is a real text (for the computer). We can copy and
paste it and search through it using CTRL + F. If all PDFs were like
this, my tool wouldn’t be necessary.

2) The “text-is-picture-with-a-text-overlay-format”: The text we are reading is actually a picture,
but there is a text layer on top of it. Sometimes that works so great that we can’t even notice a difference to the “text-is-text-format”,
but many times we end up getting results like you can see on the right
picture when we use CTRL + C !

3) The “text-is-picture-format”: For
us humans, it is a text but for the computer it is a picture, there
are no additional text layers. We can neither copy the text nor can we
use CTRL + F to search through it.

,.-‘'-.,_,.' Step 2 '.,_,.-'‘-., Screenshot
Why PDFImage2TXT?
There are some tools around to solve this problem, but I haven’t found
any which use EasyOCR. EasyOCR is made by some Indian company and
produces the greatest results ever! It is incredible how good it is!
It is far better than everything that I have seen so far, even better
than Googles Tesseract! The only problem is that it is really slow,
but I rather wait longer for great results than having shxxxy results right away.
The only thing I needed to make EasyOcr work the way I
wanted to, was a way to convert the PDF file to images. After searching for about 5 minutes on GitHub, I found a nice tool to convert each page of a PDF
to a jpg file of good quality (300 DPI). Since pdf2jpg
uses Java, please ensure that
Java is installed on your system! If it is not installed, PDFImage2TXT
won’t work on your PC!
,.-‘'-.,_,.' Step 3 '.,_,.-'‘-., Screenshot
How to use it?
PDFImage2TXT is very simple to use:
1) Install it
2) Start it
3) Select the PDF or image you want to convert
4) If you convert a PDF file, you can decide what pages you want to convert to text:

if you write 11,12,13,14,15 after having selected the PDF, the app will only convert the pages 11,12,13,14,15!
If you write “ALL”, the app will convert the whole PDF document to text!

5) If you convert a picture to text, there is nothing else to configure.

,.-‘'-.,_,.' Step 4 '.,_,.-'‘-., Screenshot
Behind the scenes:
You don’t have to choose a name for the output folder or file! During the
process, a folder with the same name as your PDF + the ending “_dir”
will be created, and special characters in the name of the folder will be
replaced by underlines.

(Example: Jürgen Habermas – Strukturwandel der Öffentlichkeit -Suhrkamp (2001).pdf becomes J_rgen_Habermas_Strukturwandel_der_ffentlichkeit_Suhrkamp_2001_pdf_dir)

Please make sure that there isn’t already a folder with that name!
Inside the folder, there will be 2 files for each page: one JPG and one TXT

,.-‘'-.,_,.' Step 5 '.,_,.-'‘-., Screenshot
Once the entire process is done, PDFImage2TXT will create a single TXT file by joining all TXT files
The final TXT file will be in the same folder and will contain the prefix “complete”!
Everything that you want is in that file! You only need that file!
If you want, you can delete everything else!
,.-‘'-.,_,.' Step 6 '.,_,.-'‘-., Screenshot
As you can see, thanks to EasyOcr the results are almost perfect!
The script I wrote, takes care of the hyphens at the end of each line. It
makes sure that all separated words are not separated in the converted
document!
PDFImage2TXT took about 1h15m for a PDF with around
1,000,000 characters. I used an Intel i5-9600KF @ 3.7 GHz with 6
Cores. It should be a lot faster with CUDA enabled (for everybody with
an NVIDIA GPU), but I couldn’t get it to run on my PC. I am able to
use Cupy, OpenCV and Spacy with CUDA, but not Easy OCR. If you have
any solution, please tell me/us! It would be nice to implement that
feature!

License

PDFImage2TXT - Copyright (C) 2021 Johannes Fischer www.queroestudaralemao.com.br

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Donations

If this project has helped you somehow, consider donating a small amount. After being absent from computer programming for more than 20 years, I started again this year. At the beginning of 2021, I suffered from a bone infection and had to spend more than 3 months in hospital (only laying in bed!). To kill time, I stared learning Python, which rapidly became something bigger for me than just a “time killer”. pavypal

GitHub

View Github