We have a scenario where in we convert HTML files (which uses htmlcleaner) to PDF. We noticed that if we for example try to use tag on a word then it adds whitespace before and after that word. For example "(Hello)" after PDF conversion it becomes "( Hello )". This behavior only happens when there is a character before and after the word but if there is an existing whitespace already then it does not add another whitespace, just preserves it.
becomes
using PrettyHtmlSerialiser