still problems generating pdf with images but preventing server crash