devi stampare lo stream, non il file

Codice PHP:
header('Content-type: application/pdf');
header('Content-Disposition: attachment; filename="downloaded.pdf"');
echo 
$data