有谁可以帮助我,我在fpdf中遇到水印问题
这是我的代码:
$width_header = array(10,45,25,60,20,15,15);
$set_align = array('L','L','L','L','R','L','R');
$table_head = array('No.','Kelompok','Kode Brg','Nama Barang','QTY','','Cek list');
$page_copy = 0;
$fpdf->SetFont('Arial','B',11);
$lebar = $fpdf->w;
$fpdf->line($fpdf->GetX(), $fpdf->GetY(), $fpdf->GetX()+$lebar-18, $fpdf->GetY());
$fpdf->Ln(2);
$fpdf->SetWidths($width_header);
$fpdf->SetAligns($set_align);
$fpdf->SetFont('Arial','B',9);
for($i=1;$i<=1;$i++) {
$fpdf->Row_Header($table_head);
}
$fpdf->line($fpdf->GetX(), $fpdf->GetY(), $fpdf->GetX()+$lebar-18, $fpdf->GetY());
$no = 1;
$sub_total = 0;
$sql2 = $this->adm_entry_penjualan_model->getDataCetakDetil(" WHERE a.hps<>'*' AND a.no_bukti='$no_bukti_tmp' AND a.tgl='$tgl_tmp' ORDER BY b.acct_no, b.kode_sub");
$fpdf->SetFont('Arial','',10);
foreach ($sql2->result_array() as $key_no => $row2) {
//Put the watermark
$fpdf->SetFont('Arial','B',50);
$fpdf->SetTextColor(255,222,233);
$fpdf->RotatedText(90,90,'COPY',45);
$fpdf->SetFont('Arial','',10);
$fpdf->SetTextColor(0,0,0);
$fpdf->SetFont('Arial','',10);
$fpdf->Row(
array($no++,
$row2['acct_name'],
$row2['kode_sub'],
$row2['nama_sub'],
$row2['qty'].' ',
$row2['satuan'],
'...'
));
$fpdf->line($fpdf->GetX(), $fpdf->GetY(), $fpdf->GetX()+$lebar-18, $fpdf->GetY());
}
我想要一张像这张图片的结果:
但看起来像这张图片:
为了得到我想要的结果,我应该改变什么
抱歉我的英文不好答案 0 :(得分:1)
将您的水印代码放入Header()
功能中,如this example所示。这样,水印将在AddPage()
上设置,即在输出实际内容之前,使水印出现在“背景”中。