1 Answer
+ 3
You are not the first one who had this idea :)
It is always useful to look out for existing libraries over the internet that do just what you want, example pdf2image
https://github.com/Belval/pdf2image
But you can most likely find others that do similar things.