As an extension to this question: How do I convert a PDF document to a preview image in PHP?
<?php
$im = new imagick('file.pdf[0]');
$im->setImageFormat( "jpg" );
header( "Content-Type: image/jpeg" );
echo $im;
?>
How do I use the code from the above question to create files on the server of the PDF's. The above code only displays the image.