2012-07-31 3 views
0

yii php의 TCPDF 라이브러리를 사용하여 인보이스에 대한 pdf 문서를 생성 중입니다. 주소 데이터 다음에는 구입 한 품목 목록이 있습니다. 그 목록은 가변 길이로되어있어 다음 부분이 렌더링 될 위치를 예측하기가 어렵습니다. 그리고 마지막에는 지불, 세금, 배송 등이있는 부분이 있습니다.tcpdf에서 페이지 나누기를 제어하는 ​​방법

나는 마지막 부분을 깨지 않게 만드는 방법을 알고 싶습니다. 그래서 그것은 전체적으로 첫 번째 페이지에 있거나 완전히 두 번째 페이지에 있습니다.

도 할 수 있습니까?

할 경우에 여기에 도움이 문제가되는 부분에 대한 코드입니다 :

$pdf->SetFont("helvetica", "", 9); 
$pdf->Cell(4,0,'Versandart','TLR',0,'L',0,'',0, 0,'','T'); 
$pdf->Cell(8,0,"$model->versandart",'TBLR',0,'R',0,'',0, 0,'','B'); 
$pdf->SetFont("helvetica", "", 6); 
$pdf->Cell(5,0.4,'Hiermit bestätige ich den Auftrag','TLR',1,'R',0,'',0, 0,'','T'); 
$pdf->SetFont("helvetica", "", 9); 
$pdf->Cell(4,0,'Frachtpreis','TLR',0,'L',0,'',0, 0,'','T'); 
$pdf->Cell(8,0,"$model->versandpreis €",'BLR',0,'R',0,'',0, 0,'','B'); 
$pdf->Cell(5,0,'','LR',1,'R',0,'',0, 0,'','T'); 
$pdf->Cell(4,0,'Nachnahmegeb.','TLR',0,'L',0,'',0, 0,'','T'); 
$pdf->Cell(8,0,"$model->nachnahme €",'BLR',0,'R',0,'',0, 0,'','B'); 
$pdf->Cell(5,0,'','LR',1,'R',0,'',0, 0,'','T'); 
$pdf->Cell(4,0,'SPV-Versicherung','TLR',0,'L',0,'',0, 0,'','T'); 
$pdf->Cell(8,0,"$model->versicherung €",'BLR',0,'R',0,'',0, 0,'','B'); 
$pdf->SetFont("helvetica", "B", 6); 
$pdf->Cell(5,0.4,'Ort, Datum, Unterschrift','BLR',1,'R',0,'',0, 0,'','B'); 
$pdf->SetFont("helvetica", "", 9); 
$pdf->Cell(4,0,'Nettobetrag','TLR',0,'L',0,'',0, 0,'','T'); 
$pdf->Cell(8,0,$totalSum-($model->vat/100)*$totalSum." €",'BLR',0,'R',0,'',0, 0,'','B'); 
$pdf->SetFont("helvetica", "", 6); 
$pdf->Cell(5,0.4,'Ich erkenne die AGB in der Homepage','TLR',1,'R',0,'',0, 0,'','T'); 
$pdf->SetFont("helvetica", "", 9); 
$pdf->Cell(4,0,"incl. $model->vat% MwSt.",'TLR',0,'L',0,'',0, 0,'','T'); 
$pdf->Cell(8,0,($model->vat/100)*$totalSum." €",'BLR',0,'R',0,'',0, 0,'','B'); 
$pdf->SetFont("helvetica", "", 6); 
$pdf->Cell(5,0.4,'unter Kontakt nachzulesen hiermit an.','LR',1,'R',0,'',0, 0,'','T'); 
$pdf->SetFont("helvetica", "", 9); 
$pdf->Cell(4,0,'Summe','TLR',0,'L',0,'',0, 0,'','T'); 
$pdf->Cell(8,0,$totalSum." €",'BLR',0,'R',0,'',0, 0,'','B'); 
$pdf->SetFont("helvetica", "B", 6); 
$pdf->Cell(5,0.4,'','LR',1,'R',0,'',0, 0,'','B'); 
$pdf->SetFont("helvetica", "", 9); 
$pdf->Cell(4,0,'zu bezahlen','TBLR',0,'L',0,'',0, 0,'','T'); 
$pdf->Cell(8,0,$totalSum-$model->paymentSum." €",'BLR',0,'R',0,'',0, 0,'','B'); 
$pdf->SetFont("helvetica", "B", 6); 
$pdf->Cell(5,0.4,'Ort, Datum, Unterschrift','BLR',1,'R',0,'',0, 0,'','B'); 
$pdf->Ln(); 
$pdf->MultiCell(4, 1, 'Hiermit bestätige ich den Auftrag', 'TLR', 'R', 0, 1, '', '', true, 0, false, true, 0, 'T'); 
$pdf->MultiCell(4, 1, 'Ort, Datum, Unterschrift', 'BLR', 'R', 0, 1, '', '', true, 0, false, true, 0, 'B'); 

답변

9

내가 아는 방법은 첫 번째 HTML 코드를 생성하고 TCPDF는 코드 I 일반적으로 쉽게 PDF로 변환 할 수 있도록하는 것입니다 생각한다. 당신은 당신이 찾고있는 무엇을 달성하기 위해 다음과 같은 스타일 속성을 사용할 수 있습니다 : 어떤 HTML을 깨 <tr> 당신을 제공, 단순히 사용, 당신은 포함 할 수 이것에 대한 간단한 해결책이있다

<div style="page-break-inside:avoid;"> 
some non breakable text 
</div> 
+0

들으은 :) 작동 – gooy

+0

그것을 upvoting 당신이 그것을 도움하다고 생각하면 답으로 선택 고려하시기 바랍니다 많은 예를 들면 다음과 같습니다. 고맙습니다. – inVader

+0

나는 그것을 선택했지만 아직 투표 할 수 없습니다. 죄송합니다. – gooy

-2

nobr="true"

<table><tr nobr="tr"> 
<td> 
<td/> 
</tr> 
</table> 
관련 문제