Use binary mode for temporary files when using pdf_from_string

Use binary mode for temporary files when using pdf_from_string