FPDF를 사용하여 PDF 파일로 생성하려고합니다. 처음 시도합니다.FPDF + WriteHTML 추가 기능으로 0으로 나누기
필자는 최신 FPDF 파일을 가지고 있으며 WriteHTML 애드온을 설정했습니다. 아래 코드는 맨 아래에있는 WriteHTML 부분까지 작동합니다. "경고 : 796 행의 /home4/fwall/public_html/fpdf/fpdf.php에서 0으로 나누기"오류가 표시됩니다. 나는 FPDF.php 라인 796에서 볼 때,이 찾을 :
// Output text in flowing mode
$cw = &$this->CurrentFont['cw'];
$w = $this->w-$this->rMargin-$this->x;
$wmax = ($w-2*$this->cMargin)*1000/$this->FontSize; // <--LINE 796
$s = str_replace("\r",'',$txt);
$nb = strlen($s);
$sep = -1;
$i = 0;
$j = 0;
$l = 0;
$nl = 1;
내가의 라인을 따라, 조건문을 추가하는 경우 : 내가 멀리 갈 오류를 얻을 수 있습니다
if ($this->FontSize != 0) {
$wmax = ($w-2*$this->cMargin)*1000/$this->FontSize; // <--LINE 796
}
, 그러나 나는 그것이 맞을 수 없다는 것을 압니다. 누구든지이 문제를 일으키는 내 코드에서 오류가 표시됩니까?
require ('/home4/fwall/public_html/fpdf/fpdf.php');
//create a FPDF object
$pdf=new FPDF();
$pdfhtml=new PDF_HTML();
//set document properties
$pdf->SetAuthor('Author Name');
$pdf->SetTitle('PRESS RELEASE - NAME OF SHOW');
//set font for the entire document
$pdf->SetFont('Helvetica','B',10);
$pdf->SetTextColor(0,0,0);
//set up a page
$pdf->AddPage('P');
$pdf->SetDisplayMode(real,'default');
//display the top block
$contact = 'Contact Name';
$addline1 = '4002 2nd Ave NE, #2';
$addline2 = 'Address Line 2';
$cityzip = 'Seattle, WA 98105';
$pdf->Cell(0, 4, 'PRESS RELEASE', 0, 0, 'L');
$pdf->Cell(0, 4, 'FOR IMMEDIATE RELEASE', 0, 1, 'R');
$pdf->Cell(0, 4, 'CONTACT: '.$contact, 0, 0, 'L');
$pdf->Cell(0, 4, 'KILL DATE: August 1, 2014', 0, 1, 'R');
$pdf->Cell(0, 4, $addline1, 0, 1, 'L');
$pdf->Cell(0, 4, $addline2, 0, 1, 'L');
$pdf->Cell(0, 4, $cityzip, 0, 1, 'L');
//display the title
$pdf->SetFontSize(20);
$pdf->Cell(0,10,'PRESS RELEASE TITLE',0,1,'C',0);
//display the sub-title
$pdf->SetFontSize(16);
$pdf->Cell(0,10,'The Subtitle',0,1,'C',0);
//display the italic summary
$pdf->SetXY(10,55);
$pdf->SetFont('Helvetica','I',10);
$summary = 'SEATTLE - Theatre Off Jackson presents SPF 8, the annual exhibition of solo performance. Featuring four featured performers and one shorts night, the festival will occur between February 6th and March 1st, 2014. This year\'s festival is an exciting mix of experienced artists and new-comers with exciting stories to tell. From tales of a ten-day vows of silence to what it\'s like growing up with deaf parents and siblings, this year\'s festival is a potpourri of styles and stories.';
$pdf->MultiCell(0, 4, $summary , 0, 'J');
//display the main content
$pdf->SetFont('Helvetica','',10);
$maincontent = '
First line.
Second Line?
<ul>
<li>
Item 1
</li>
</ul>
';
$pdfhtml->WriteHTML($maincontent);
//Output the document
$pdf->Output('example1.pdf','I');
'$ this-> FontSize'가 0으로 설정된 이유를 찾아서 고쳐 주십니까? BTW,'if' 문은'$ this-> FontSize'와 분리 된 변수 인'$ thisFontSize'에 대해 언급합니다. – paxdiablo
고마워, 그 질문에 오타가 있었는데, 그것은 내 코드에서 맞습니다. 나는 그것을 위에 고칠 것이다. 그리고 네, 저는 운이없는 상태로 0으로 설정된 이유를 알아 내려고 노력했습니다. 나는 FPDF에 대한 더 많은 경험을 가진 누군가가 나를 계몽 할 수 있기를 희망한다. – Eckstein
사용중인 WriteHTML 추가 기능에 대한 링크를 제공 할 수 있습니까? – TPete