weird characters when using FPDF PHP?

丶灬走出姿态 提交于 2019-12-02 03:45:24

The following headers and Output command is what I currently use with FPDF:

// Set a filename
$filename = "AppName_Day_".$day1."_gen_".date("Y-m-d_H-i").".pdf";

// Send headers
header("Content-Type: application/pdf");
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header('Content-Disposition: attachment; filename="'.$filename.'"');
header("Content-Transfer-Encoding: binary ");

// Blast out the PDF
$pdf->Output('php://output');

It's worth noting, my use case is a dynamic document that could change at the next download, so I never want a browser to cache it. It's also ALWAYS a download and never viewed in the browser, so the content-disposition: attachment may not apply to your use case.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!