Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
$filename = 'pdf-download';
$options = new \Dompdf\Options;
$options->set('isRemoteEnabled', true);
$dompdf = new \Dompdf\Dompdf($options);
$dompdf->set_option('defaultFont', 'droidsansfallback');
$dompdf->set_option('isFontSubsettingEnabled', true);
// 輸出 header 讓 PDF 可以被打開
header('Content-Type: application/pdf; charset=utf-8');
header('Content-disposition: inline; filename="' . $filename . '.pdf"', true);
// 直接印出來瀏覽器就可以讀取
echo $dompdf->output();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.