缩小代码在localhost中运行良好,但是当我测试它时,我的pdf页面显示为空白且代码为$html = '<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Type: application/pdf; charset=utf-8"/>
<link rel="stylesheet" href="style.css">
<div style="width:800px; height:970px; padding:20px; border: 10px solid #787878">
<style>
body {
body {font-family: "NotoSansCJKtc-Regular"}
}
</style>
<div style="width:750px; height:915px; padding:20px; border: 5px solid #787878">
//pdf content is here
</div>
</div>
</html>';
$dompdf->loadHtml($html);
$dompdf->setPaper('A4', 'landscape');
$dompdf->getOptions()->setIsFontSubsettingEnabled(true);
/* Render the HTML as PDF */
$dompdf->render();
header('Content-Type: application/pdf; charset=utf-8');
header('Content-disposition: inline; filename="' . $no . '.pdf"', true);
/* Output the generated PDF to Browser */
$dompdf->stream();
当我删除上面的行..pdf工作正常,但大小是18MB.i希望使用相同的字体系列将我的PDF大小减少到50KB。
apply plugin: 'com.android.application'