Is there really no way to make Ghostscript resolve this problem (with added spaces between characters)?
Ken Sharp says
what you appear to be facing is a limitation in the Acrobat search facility, which is exposed by the way we emit the text.
I think he is saying it is not Ghostscript that is adding the spaces between characters.
And I believe his explanation. The PDFWrite device driver is subject to the limitations of a device driver in Ghostscript. I imagine the API was designed for making marks on visible surfaces, not for anything else that has been subsequently shoehorned in.
In particular, the notion that a sequence of marks constitute a word is of no importance when making marks at specified positions. The mark making device doesn't need to know the difference between a space and spacing (kerning etc).
A kind of corollary to this is that, so far as I know, words are not a thing in PDF or in it's ancestor Postscript. They don't have any need to keep track of words and don't provide any specific way of identifying them within PDF or PS file contents.
Is there an open source alternative to Ghostscript that could batch convert scanned PDF to PDF/A-1b without messing up OCR
So far as I know, The PDF specifications don't define "scanned PDF" or "OCR". Some PDF authoring tools presumably make clever use of PDF features when they are creating PDF files from scanned images and when invisibly including text that they created using OCR. This allows text searches and cut&paste operations to be performed on the PDF produced - which would not be possible if only the bitmap image were present.
Such PDFs may be useful, but they are really a bit of an abomination. It is always better to produce a PDF from a non-scanned sources where available.
PDF was originally intended to be a "final" document format. Not one intended to have further manipulations performed on it.
However it must be possible that other programs supporting PDF manipulation do so without forcing the conversion to be done through a printing API. In which case they can do it in a way that produces a result that better suits the quirks of Acrobat and other PDF-reading software.