use ghostscript to convert pdf to images.