THE SEARCHABLE PDFs ARE GENERATED AS FOLLOWS

GENERAL
All individual scanned images are converted to a single PDF file with an OCR text layer and are then assembled to a single PDF document.

CONVERSION OF A BITMAP TO A PDF
The conversion is achieved with following shell command example:
tesseract -l deu /run/user/1000/tmp_000.jpg /run/user/1000/tmp_new pdf
PLEASE NOTE: TESSERACT TURNS UPSIDE DOWN DOCUMENTS AUTOMATICALLY !!!

CORRECTING THE PRINT SIZE OF THE GENERATED PDF
It was observed that Tesseract generates PDFs with the print size of the bitmap. This is a problem if the image is turned by Gambas with the Image.RotateRight method because this changes the print size for unknown reasons. Hence it is required to correct the print size of the generated PDF. This is achieved with Ghostscript, i.e.:
gs -o out.pdf -dDEVICEWIDTHPOINTS=ImageWidth -dDEVICEHEIGHTPOINTS=ImageHeight -sDEVICE=pdfwrite -dPDFFitPage out.pdf

ASSEMBLING OF  ALL INDIVIDUAL PDFs TO ONE SINGLE PDF-DOCUMENT
After having processed all images, Ghostscript is used to assemble the individual PDFs to a single PDF. This is done with following shell command as an example:
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -sOutputFile=out.pdf & ListofImages

AVAILABLE PAGE SEGMENTATION MODES (in the app only used for OCR to pure text format):
  0    Orientation and script detection (OSD) only.
  1    Automatic page segmentation with OSD.
  2    Automatic page segmentation, but no OSD, or OCR.
  3    Fully automatic page segmentation, but no OSD. (Default and used by the app)
  4    Assume a single column of text of variable sizes.
  5    Assume a single uniform block of vertically aligned text.
  6    Assume a single uniform block of text.
  7    Treat the image as a single text line.
  8    Treat the image as a single word.
  9    Treat the image as a single word in a circle.
 10    Treat the image as a single character.
 11    Sparse text. Find as much text as possible in no particular order.
 12    Sparse text with OSD.
 13    Raw line. Treat the image as a single text line,
       bypassing hacks that are Tesseract-specific.

OTHERS (NOT APPLIED IN THIS APP)
Should one of the pages have a different print size format, the follow command can adjust all pages of a document to A4 size:
gs -o out.pdf -sDEVICE=pdfwrite -sPAPERSIZE=a4 -dFIXEDMEDIA -dPDFFitPage -dCompatibilityLevel=1.4 in.pdf

DOWNLOAD AND LOCATION OF LANGUAGES
For Tesseract versions 4.00+ vollowing source should be used, i.e.:
https://github.com/tesseract-ocr/tessdata/blob/main/deu.traineddata
Unpack and copy the .traineddata file into a ‘tessdata’ directory. The exact directory will depend both on the type of training data, and your Linux distribution. Possibilities are /usr/share/tesseract-ocr/tessdata or /usr/share/tessdata or /usr/share/tesseract-ocr/4.00/tessdata.

LIST OF TRAINEDDATA
Traineddata Files for Version 4.00 are also compatible with tesseract 5:
Quote: "We have three sets of official .traineddata files trained at Google, for tesseract versions 4.00 and above. These are made available in three separate repositories."
Language downloads with direct URLS for standard quality:
https://github.com/tesseract-ocr/tessdata_fast/raw/4.0.0/eng.traineddata
https://github.com/tesseract-ocr/tessdata_fast/raw/4.0.0/deu.traineddata   (~1.5MB)
Better Quality:
https://github.com/tesseract-ocr/tessdata/raw/4.1.0/deu.traineddata        (~15MB)
https://raw.githubusercontent.com/tesseract-ocr/tessdata/main/deu.traineddata  (~15MB) 
https://raw.githubusercontent.com/tesseract-ocr/tessdata/main/deu-frak.traineddata  (~1.9MB) Version 4.0.0
Best Quality:
https://raw.githubusercontent.com/tesseract-ocr/tessdata/4.00/deu.traineddata

Traineddata with better performance are also available form here:
For version 3:
https://github.com/tesseract-ocr/tessdata/raw/3.04.00/deu.traineddata
for versions >= 4
https://tesseract-ocr.github.io/tessdoc/Data-Files
oder
https://tesseract-ocr.github.io/tessdoc/Data-Files#special-data-files
A list for version 4
https://creator.pdf24.org/tesseract/4.0/traindata/list.txt

