I want to make a php script when I insert doc file or pdf file in database.

At a time it generate very first image of word file or pdf.

I have seen an example related about it like:
Code:
<?php
// starting word
$word = new COM("word.application") or die("Unable to instantiate Word");
echo "Loaded Word, version {$word->Version}\n";

//bring it to front
...