Ciao,我必须用dompdf创建一个pdf文件,但是如果我使用bootstrap.min.css dompdf不能正常工作。 如果我删除文件工程......
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="apple-touch-icon" href="apple-touch-icon.png">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<link rel="stylesheet" href="../css/bootstrap.css">
<link rel="stylesheet" href="../css/main.css">
<link rel="stylesheet" href="../css/cms.css">
<link rel="stylesheet" href="../css/pagine.css">
</head>
<body>
<?php require_once './fattura.php'; ?>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="../js/vendor/jquery-1.11.2.min.js"><\/script>')</script>
<script src="../js/vendor/bootstrap.min.js"></script>
</body>
fattura.php文件是pdf
的html内容这是生成内容的代码
<?php
require_once("dompdf/dompdf_config.inc.php");
spl_autoload_register('DOMPDF_autoload');
$filename = 'file_prova';
$dompdf = new DOMPDF();
$html = file_get_contents('http://localhost:8888/cms-contratto/pagine-contratto/contratto.php');
pdf_create($html,$filename,'A4','portrait');
function pdf_create($html, $filename, $paper, $orientation, $stream=TRUE)
{
$dompdf = new DOMPDF();
$dompdf->set_paper($paper,$orientation);
$dompdf->load_html($html);
$dompdf->render();
i$dompdf->stream($filename.".pdf");
}
古拉爵!