Added PageSegMode support

This allows autodetection of page layouts (which means it can now work
with multiple columns).

Sorry about some reshuffling of the imports (goimports did that), let me know if you want a new pull without it.