Is there a way to manipulate the Content-Type header in PHP to influence how browsers handle the download of specific file types, such as PDFs?

To manipulate the Content-Type header in PHP to influence how browsers handle the download of specific file types, such as PDFs, you can set the Content-Type header to 'application/octet-stream' for PDF files. This forces the browser to treat the file as a download rather than attempting to display it in the browser window.

<?php
$file = 'example.pdf';
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . basename($file) . '"');
readfile($file);
?>