2010-11-20 4 views
0

FPD 및 FPDF를 사용하여 PDF를 생성하려고하는데 셀을 만들 때 문제가 있습니다. fillcolor를 사용하고 싶습니다. 따라서 셀에는 배경색이 있습니다. 대한FPDI 및 FPDF 사용

는 지금은 같이있다 :

<?php 
require_once('fpdf/fpdf.php'); 
require_once('pdf/fpdi.php'); 
$pdf = new FPDI(); 

$pdf->AddPage(); 

$pdf->setSourceFile('anolis_dopis_a4.pdf'); 
// import page 1 
$tplIdx = $pdf->importPage(1); 
//use the imported page and place it at point 0,0; calculate width and height 
//automaticallay and ajust the page size to the size of the imported page 
$pdf->useTemplate($tplIdx, 0, 0, 0, 0, true); 

// now write some text above the imported page 
$pdf->SetFont('Arial', '', '13'); 
$pdf->SetTextColor(0,0,0); 
//set position in pdf document 
$pdf->SetXY(40, 50); 
//first parameter defines the line height 
$pdf->Write(0, 'gift code'); 

$pdf->SetXY(40, 55); 
$pdf->Write(0, 'gift code'); 

//HERE I WANT TO HAVE BACKGROUND COLOR 
$pdf->Cell(100,10,"bla bla",1,"left",""); 

//force the browser to download the output 
$pdf->Output('test.pdf', 'D'); 

?> 
+0

$ x & $ y'$ outPdf-> useTemplate ($ outPdf-> importPage ($ i), null, null, 0, 0, true); '에서 Null을 사용할 때만 효과가있었습니다. 그렇지 않으면 페이지를 A4로 자릅니다. – juanmf

답변

0
$pdf->SetFillColor(227,227,227); 
$pdf->Cell(100,10,'bla bla',1,0,'L',TRUE); 
+0

내가 tryed하지만 작동하지 않습니다 – Alen

+0

당신은 무엇을 가지고 – jatt

+0

나는 pdf 테이블에 쓰기를 원하지만 evry second coll backgorund 색이 있어야합니다. – Alen

2

난 그냥 같은 문제가 있었다. 나는이 웹 사이트의 다른 주제에서 답을 찾았습니다.

이 솔루션은 $pdf->useTemplate($tplIdx, 0, 0, 0, 0, true);

$pdf->setPageMark();을 추가 같은 문제를 가지고 여기까지 밖에 나 같은 더 많은 사람들이 아마이 있습니다.

관련 문제