내 dompdf pdf를 생성하는 데 문제가 있습니다. 올바르게 렌더링되지만 25 페이지 pdf 파일을 만들려고하면 PHP 시간 초과 30 초 오류가 발생합니다.
imgpaths를 올바르게 설정하는 domelement를 통해 pdf를 만들고 있습니다. 또한 값을 2 개의 필드로 설정합니다.
나는 그것을 찾아 보았고 새로운 body 요소가 파싱되면 dompdf가 새 페이지를 만드는 것으로 나타났습니다. 그래서 여러 페이지에 여러 본문을 삽입하고 있습니다. 그것은 잘 렌더링됩니다. 아주 오래 걸리므로 아마도 뭔가 잘못하고 있습니다.
내 pdf 생성 코드는 다음과 같습니다.
$pdf = Yii::app()->pfPDF->firstrun();
$basepath = str_replace('\\', '/', Yii::app()->theme->basePath);
$doc = new DOMDocument();
$doc->preserveWhiteSpace = false;
$htmlfile = $basepath.'/pdf/pdf.html';
$html = null;
\timestuff::$times[] = microtime(true);
foreach($models as $model)
{
$model->printed = true;
$model->save();
$doc->loadHTMLFile($htmlfile);
$html .= '<head>';
$headNode = $doc->getElementsByTagName('head')->item(0);
foreach($headNode->childNodes as $childnode){
if($childnode->nodeType == XML_TEXT_NODE){
continue;
}
$html.= $doc->saveHTML($childnode);
}
$html .= '</head><body>';
$doc->getElementById('vouchercode')->nodeValue = $model->code;
$doc->getElementById('timelimit')->nodeValue = $timelimit;
$doc->getElementById('nllogo')->attributes->getNamedItem('src')->nodeValue = $basepath.'/pdf/assets/images/plate.png';
$doc->getElementById('enlogo')->attributes->getNamedItem('src')->nodeValue = $basepath.'/pdf/assets/images/plate.png';
$doc->getElementById('delogo')->attributes->getNamedItem('src')->nodeValue = $basepath.'/pdf/assets/images/plate.png';
$doc->getElementById('frlogo')->attributes->getNamedItem('src')->nodeValue = $basepath.'/pdf/assets/images/plate.png';
$doc->getElementById('customerlogo')->attributes->getNamedItem('src')->nodeValue = $basepath.'/pdf/assets/images/logo_krieghuus.png';
$doc->getElementById('maxwifilogo')->attributes->getNamedItem('src')->nodeValue = $basepath.'/pdf/assets/images/maxwifi.png';
$bodyNode = $doc->getElementsByTagName('body')->item(0);
foreach($bodyNode->childNodes as $childnode){
if($childnode->nodeType == XML_TEXT_NODE){
continue;
}
$html.= $doc->saveHTML($childnode);
}
$html.= '</body>';
}
\timestuff::$times[] = microtime(true);
Yii::app()->pfPDF->show($html);
\timestuff::$times[] = microtime(true);
HTML은 다음과 같습니다.
<!doctype HTML>
<head>
<title>
voucher pdf
</title>
<style>
#wrapper {
width: 800px;
background-color: white;
}
#vouchercode {
font-weight: bolder;
}
.topsection {
position: absolute;
top: 0;
height: 400px;
left: 0;
}
#topleftsection {
position: absolute;
top: 0px;
left: 0px;
width: 400px;
height: 400px;
}
#topleftimg,
#topleftimg img {
max-width: 400px;
max-height: 285px;
}
#topleftimgdescr {
text-align: center;
font-weight: bold;
}
#toprightsection {
position: relative;
clear: none;
top: 0px;
left: 400px;
height: 400px;
}
.maxwifisection {
margin-left: 100px;
}
.maxwifihref {
margin-right: 550px;
text-align: center;
}
#wifisection {
position: relative;
top: 100px;
}
.instructionsection {
position: absolute;
top: 400px;
bottom: 0;
/*page-break-after: always;*/
}
#nl {
height: 130px;
}
.countrytext {
margin-top: -44px;
margin-left: 8px;
font-weight: bolder;
color: white;
font-size: 30px;
font-family: "Verdana", Arial, sans-serif;
}
.countrypng {
width: 60px;
}
.partial {
height: 140px;
}
.instruction {
position: relative;
top: -120px;
left: 60px;
font-size: 14px;
}
ul {
margin-top: 0px;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div id="wrapper">
<div class="topsection">
<div id="topleftsection">
<div id="topleftimg">
<img id="customerlogo" src="./assets/images/logo.png" />
</div>
<div id="topleftimgdescr">Vakantiepark de “Krieghuusbelten”</div>
</div>
<div id="toprightsection">
<div class="maxwifisection">
<img id="maxwifilogo" src="./assets/images/maxwifi.png" />
<br />
<div class="maxwifihref"><a>www.maxCoax.nl</a>
</div>
</div>
<div id="wifisection">
<table>
<tr>
<th>Wifi activatiecode</th>
<th></th>
</tr>
<tr>
<td>Tijdsduur:</td>
<td id="timelimit"></td>
</tr>
<tr>
<td>Apparaten:</td>
<td>1</td>
</tr>
<tr>
<td>Activatiecode:</td>
<td id="vouchercode"></td>
</tr>
</table>
</div>
</div>
</div>
<div class="instructionsection">
<div class="partial">
<div class="countrypng">
<img id="nllogo" src="./assets/images/plate.png" />
<div class="countrytext">NL</div>
</div>
<div class="instruction">
<b>Instructies</b>
<ul>
<li>
Start uw notebook, PDA of PC. Wanneer u binnen het bereik van een wifi hotspot bent kunt u verbinding
<br />maken met het Wifi netwerk. Start internet en de activatiepagina opent.
</li>
<li>
Vul de hierboven vermelde toegangscode in.
</li>
<li>
De tijdsduurgebruik gaat in na activatie.
</li>
<li>
U kunt gebruik maken van internet.
</li>
<li>
<b>Let op!</b> Deze toegangscode is te activeren op 1 apparaat.
</li>
</ul>
</div>
</div>
<div class="partial">
<div class="countrypng">
<img id="enlogo" src="./assets/images/plate.png" />
<div class="countrytext">EN</div>
</div>
<div class="instruction">
<b>Instructions</b>
<ul>
<li>
Start up your notebook, PDA or PC. Please connect with the Wifi network if you are within range of a Wifi
<br />access point.
</li>
<li>
Log on to the internet. You will land on the activation page.
</li>
<li>
Enter the above mentioned access code. The duration of use starts after activation.
</li>
<li>
You are now ready to use internet.
</li>
<li>
<b>Attention!</b> This code is for use on 1 device
</li>
</ul>
</div>
</div>
<div class="partial">
<div class="countrypng">
<img id="delogo" src="./assets/images/plate.png" />
<div class="countrytext"> D</div>
</div>
<div class="instruction">
<b>Hinweise</b>
<ul>
<li>
Starten Sie Ihr Notebook, PDA oder Ihren PC. Wenn Sie sich innerhald der Reichweite eines Accespoints
<br />befinden, dan können Sie mit dem drahlosen Netzwerk verbindung machen.
</li>
<li>
Starten Sie internet. Sie bekommen den Aktivierungsseite.
</li>
<li>
Geben Sie den oben erwähnten Aktivierungscode ein. Die Dauerder Anwenung startet nach den Aktivierung.
</li>
<li>
Sie können jetzt das Internet benutzen.
</li>
<li>
<b>Achtung!</b> Dieser code können sie gleichzeitig aktiveren für den Einsatz auf 1 Gerät.
</li>
</ul>
</div>
</div>
<div class="partial">
<div class="countrypng">
<img id="frlogo" src="./assets/images/plate.png" />
<div class="countrytext">FR</div>
</div>
<div class="instruction">
<b>Instructions</b>
<ul>
<li>
Ouvrez Votre portable, PDA ou PC. Lorsque vous êtes dans les environs d’un point d’accès Wifi, vous serez
<br />reliés après quelques secondes automatique au résea Wifi systeme sans fil.
</li>
<li>
Démarrez internet. Alors sur le site du hotel ou camping.
</li>
<li>
Complétez le code d’accès mentionné ci-dessus. La durée d’utilisation commence après l’activation.
</li>
<li>
Vous pourrez maintenant utiliser internet.
</li>
<li>
<b>Attention!</b> Ce code est utilisé sur 1 pèriphèrique
</li>
</ul>
</div>
</div>
</div>
</div>
</body>
누구든지로드 속도를 높이도록 도와 줄 수 있습니까? 모든 도움을 주시면 감사하겠습니다.
결과적으로 내가 일하는 컴퓨터입니다. 내 집 컴퓨터는 +/- 15 초 안에 PDF를 생성합니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다