PHP生成PDF时,背景文字怎么去掉
答案:2 悬赏:40
解决时间 2021-10-19 11:28
- 提问者网友:欲劫无渡
- 2021-10-19 04:05
PHP生成PDF时,背景文字怎么去掉
最佳答案
- 二级知识专家网友:第四晚心情
- 2021-07-18 20:21
下面的是原程序:
try {
$p = new PDFlib();
if ($p->begin_document("", "") == 0) {
die("Error: " . $p->get_errmsg());
}
$p->begin_page_ext(595, 842, "");
$font = $p->load_font("Helvetica-Bold", "winansi", "");
$p->setfont($font, 24.0);
$p->set_text_pos(50, 700);
$p->show_xy("Hello world (PHP)!",100 , 750 );
$p->end_page_ext("");
$p->end_document("");
$buf = $p->get_buffer();
$len = strlen($buf);
header("Content-type: application/pdf");
header("Content-Length: $len");
header("Content-Disposition: inline; filename=hello.pdf");
print $buf;
}
catch (PDFlibException $e) {
die("PDFlib exception occurred in hello sample:\n" .
"[" . $e->get_errnum() . "] " . $e->get_apiname() . ": " .
$e->get_errmsg() . "\n");
}
catch (Exception $e) {
die($e);
}
$p = 0;
?>
try {
$p = new PDFlib();
if ($p->begin_document("", "") == 0) {
die("Error: " . $p->get_errmsg());
}
$p->begin_page_ext(595, 842, "");
$font = $p->load_font("Helvetica-Bold", "winansi", "");
$p->setfont($font, 24.0);
$p->set_text_pos(50, 700);
$p->show_xy("Hello world (PHP)!",100 , 750 );
$p->end_page_ext("");
$p->end_document("");
$buf = $p->get_buffer();
$len = strlen($buf);
header("Content-type: application/pdf");
header("Content-Length: $len");
header("Content-Disposition: inline; filename=hello.pdf");
print $buf;
}
catch (PDFlibException $e) {
die("PDFlib exception occurred in hello sample:\n" .
"[" . $e->get_errnum() . "] " . $e->get_apiname() . ": " .
$e->get_errmsg() . "\n");
}
catch (Exception $e) {
die($e);
}
$p = 0;
?>
全部回答
- 1楼网友:舍身薄凉客
- 2021-05-13 17:00
对于pdf格式的幻灯片,通常讲,你所说的背景文字都是加进去的图片就已经有了文字,这就需要先把图片先导出来,然后用photoshop来处理,去除文字。
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯