This is fantastic, I would only suggest one more thing, yesterday there was article on first page about vectorization, so further compression and cleaning could be done if text would convert to vectors, links is:
https://mzucker.github.io/2018/05/14/maptrace.html
So first article is from 2016, and vector one from 2018, 3 years later there is no explicit article combining two, but I get it if you want it, do it on your own.
I did missed that he mentioned it, but it is still quite interesting as I use a lot GoodNotes on iPad.