Mime type application/pdf was hardcoded.  I have removed this code so that it takes any suitable mime type.