ok.php
header("HTTP/1.1 200 OK", true, 200);
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"{$todayTimestamp}.pdf\"");
readfile(DOCUMENT_DIR."/".$documentType);
結論としては上記コードが正常動作した.
不具合のあったソースは
ng.php
$documentBinary = file_get_contents(DOCUMENT_DIR."/".$documentType);
header("HTTP/1.1 200 OK", true, 200);
header("Content-Type: application/pdf");
header("Content-Length: ".strlen($documentBinary));
header("Content-Disposition: attachment; filename=\"{$todayTimestamp}.pdf\"");
print($documentBinary);
だった.
//以下ソースをコメントアウト
//header("Content-Length: ".strlen($data));
// file_get_contents($path);をやめて
readline($path);
これでうごきました.
ng.phpのソースでもwindows上の各種ブラウザでは問題なく動作しておりましたが
MacOS上のsafariでは全く動作しないどころかダウンロードしたファイルがなにかしらの欠損が発生していたようです.