fdo#35143 PDF import: Reimplementation of whitespace detection function

Change-Id: I5b230aaebf72b70bbb7e206414a5ac0e01f01f86
Reviewed-on: https://gerrit.libreoffice.org/7564
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>