Php 带有FPDI模板和CSS的TCPDF
当将TCPDF与FPDI模板一起使用时,在这个过程中会丢失一些CSS支持。问题是边框或背景色之类的东西,它们最终会出现在PDF模板下面的层中。TCPDF使用Php 带有FPDI模板和CSS的TCPDF,php,pdf,tcpdf,fpdi,Php,Pdf,Tcpdf,Fpdi,当将TCPDF与FPDI模板一起使用时,在这个过程中会丢失一些CSS支持。问题是边框或背景色之类的东西,它们最终会出现在PDF模板下面的层中。TCPDF使用SetLineStyle()将CSS边框/背景转换为PDF,这似乎就是问题所在 例如: $this->setSourceFile($filename); // /path/to/my/background.pdf $imported_page = $this->ImportPage(1); $this->useTemplat
SetLineStyle()
将CSS边框/背景转换为PDF,这似乎就是问题所在
例如:
$this->setSourceFile($filename); // /path/to/my/background.pdf
$imported_page = $this->ImportPage(1);
$this->useTemplate($imported_page);
...
$html = '<table style="border: 1px solid #000;"><tr><td style="background-color: #ff0000;">...</td></tr></table>';
$this->writeHTMLCell(45, 25, 160, 29, $html);
出于好奇:这是唯一的方法吗,还是有一种方法可以将PDF模板放在所有事情的底部
提前谢谢 您尝试过使用-method吗?您尝试过使用-method吗?解决方案就是使用setPageMark()。 以下是对我非常有效的方法:
public function AddPage($orientation = '', $format = '') {
global $pdf_data_path;
parent::AddPage($orientation, $format);
if ($this->use_headed) {
$this->setSourceFile($pdf_data_path."/headed.pdf");
$tplidx = $this->importPage(1, '/MediaBox');
$this->useTemplate($tplidx, 0, 0, 0, 0, true);
$this->setPageMark();
}
}
关键是在使用模板后放置setPageMark()。然后,边框将堆叠在模板顶部,生成PDF。解决方案是使用setPageMark()。 以下是对我非常有效的方法:
public function AddPage($orientation = '', $format = '') {
global $pdf_data_path;
parent::AddPage($orientation, $format);
if ($this->use_headed) {
$this->setSourceFile($pdf_data_path."/headed.pdf");
$tplidx = $this->importPage(1, '/MediaBox');
$this->useTemplate($tplidx, 0, 0, 0, 0, true);
$this->setPageMark();
}
}
关键是在使用模板后放置setPageMark()。然后,边框将堆叠在模板顶部,生成PDF