I have checked the script with xdebug. Now i can see. At the end of the PHP Script there is an wp_die(); this one start the script from the beginning. Anyone know why?
@axew3
befor the script converting each site as .jpg the PDF file is uploaded to the wordpress media files. The upload is no problem. Only the converting process.