2) Make yourself familier with Wand, a ctypes-based simple ImageMagick binding for Python.
3) Install Wand - pip install wand
4) Use the following script..
#Install Ghost script before python package's installation
#from: http://www.a-pdf.com/convert-to-pdf/gs.exe
from wand.image import Image
from wand.display import display
fileDirectory = "D:/files/"
inFileName="myInputfile.pdf"
outFileName="myOutputfile.png"
imageFromPdf = Image(filename=fileDirectory+inFileName)
pages = len(imageFromPdf.sequence)
print(pages)
image = Image(
width=imageFromPdf.width,
height=imageFromPdf.height * pages
)
for i in range(pages):
image.composite(
imageFromPdf.sequence[i],
top=imageFromPdf.height * i,
left=0
)
image.format="png"
image.save(filename=fileDirectory+outFileName)
display(image)
5) Let me know if you have any trouble.