before pdf and png script