This is what I use:
exec('convert "'.$targetFile.'[0]" -flatten -geometry 1600x1600 -density 130x130 -quality 20 "'.$previewTargetFile.'"');
The "[0]" and "-flatten" will flatten the file and output only one image. Some PDF's have multiple pages.