网页title图标_php 数据库显示在页面并能修改

网页title图标_php 数据库显示在页面并能修改在生成的pdf文件的页眉设置logo有以下解决方案重新定义TCPDF中的K_PATH_IMAGES常量(define(‘K_PATH_IMAGES’,xxxx),需要定义在加载tcpdf.php之前)##示例$logo=”xxxx”;//相对地址$pdf->SetHeaderData(PDF_HEADER_LOGO,PDF_HEADER_LOGO_WIDTH,”标题”,…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺

在生成的pdf文件的页眉设置logo有以下解决方案

重新定义TCPDF中的K_PATH_IMAGES常量(define(‘K_PATH_IMAGES’, xxxx) , 需要定义在加载tcpdf.php 之前)

## 示例

$logo = “xxxx”; //相对地址

$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, “标题”, “标语”, array(0,64,255), array(0,64,128));

$pdf->setFooterData(array(0,64,0), array(0,64,128));

若不定义常量,可以将logo图片移动到vendor/tecnickcom/examples/images下

## 示例

$logo = “xxxx”; //相对地址

$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, “标题”, “标语”, array(0,64,255), array(0,64,128));

$pdf->setFooterData(array(0,64,0), array(0,64,128));

重写 public function Header() {} 方法

public function Header() {

$logo = xxxx;//绝对地址

$this->Image($logo, 5, 2, 15, ”, ‘PNG’, ”, ‘T’, false, 300, ”, false, false, 0, false, false, false);

$this->SetFont(‘stsongstdlight’, ”, 10);

$this->MultiCell(0, 15, $this->title, 0, “R”, false, 1, 0, 5);

}

设置头部Logo源码分析

$this->Image(K_PATH_IMAGES.$headerdata[‘logo’], ”, ”, $headerdata[‘logo_width’]);

根据源码分析,发现此处 会在配置的 $headerdata[‘logo’] 数据前面,自动加上 常量 K_PATH_IMAGES,所以才有了解决方案1,方案2

## 源码

public function Header() {

if ($this->header_xobjid === false) {

// start a new XObject Template

$this->header_xobjid = $this->startTemplate($this->w, $this->tMargin);

$headerfont = $this->getHeaderFont();

$headerdata = $this->getHeaderData();

$this->y = $this->header_margin;

if ($this->rtl) {

$this->x = $this->w – $this->original_rMargin;

} else {

$this->x = $this->original_lMargin;

}

if (($headerdata[‘logo’]) AND ($headerdata[‘logo’] != K_BLANK_IMAGE)) {

$imgtype = TCPDF_IMAGES::getImageFileType(K_PATH_IMAGES.$headerdata[‘logo’]);

if (($imgtype == ‘eps’) OR ($imgtype == ‘ai’)) {

$this->ImageEps(K_PATH_IMAGES.$headerdata[‘logo’], ”, ”, $headerdata[‘logo_width’]);

} elseif ($imgtype == ‘svg’) {

$this->ImageSVG(K_PATH_IMAGES.$headerdata[‘logo’], ”, ”, $headerdata[‘logo_width’]);

} else {

$this->Image(K_PATH_IMAGES.$headerdata[‘logo’], ”, ”, $headerdata[‘logo_width’]);

}

$imgy = $this->getImageRBY();

} else {

$imgy = $this->y;

}

$cell_height = $this->getCellHeight($headerfont[2] / $this->k);

// set starting margin for text data cell

if ($this->getRTL()) {

$header_x = $this->original_rMargin + ($headerdata[‘logo_width’] * 1.1);

} else {

$header_x = $this->original_lMargin + ($headerdata[‘logo_width’] * 1.1);

}

$cw = $this->w – $this->original_lMargin – $this->original_rMargin – ($headerdata[‘logo_width’] * 1.1);

$this->SetTextColorArray($this->header_text_color);

// header title

$this->SetFont($headerfont[0], ‘B’, $headerfont[2] + 1);

$this->SetX($header_x);

$this->Cell($cw, $cell_height, $headerdata[‘title’], 0, 1, ”, 0, ”, 0);

// header string

$this->SetFont($headerfont[0], $headerfont[1], $headerfont[2]);

$this->SetX($header_x);

$this->MultiCell($cw, $cell_height, $headerdata[‘string’], 0, ”, 0, 1, ”, ”, true, 0, false, true, 0, ‘T’, false);

// print an ending header line

$this->SetLineStyle(array(‘width’ => 0.85 / $this->k, ‘cap’ => ‘butt’, ‘join’ => ‘miter’, ‘dash’ => 0, ‘color’ => $headerdata[‘line_color’]));

$this->SetY((2.835 / $this->k) + max($imgy, $this->y));

if ($this->rtl) {

$this->SetX($this->original_rMargin);

} else {

$this->SetX($this->original_lMargin);

}

$this->Cell(($this->w – $this->original_lMargin – $this->original_rMargin), 0, ”, ‘T’, 0, ‘C’);

$this->endTemplate();

}

// print header template

$x = 0;

$dx = 0;

if (!$this->header_xobj_autoreset AND $this->booklet AND (($this->page % 2) == 0)) {

// adjust margins for booklet mode

$dx = ($this->original_lMargin – $this->original_rMargin);

}

if ($this->rtl) {

$x = $this->w + $dx;

} else {

$x = 0 + $dx;

}

$this->printTemplate($this->header_xobjid, $x, 0, 0, 0, ”, ”, false);

if ($this->header_xobj_autoreset) {

// reset header xobject template at each page

$this->header_xobjid = false;

}

}

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/197359.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • Intel 的AVX2指令集解读

    Intel 的AVX2指令集解读在IntelSandyBridge微架构中,Intel引入了256位SIMD扩展AVX,这套指令集在兼容原MMX、SSE、SSE2对128位整点SIMD支持的基础上,把支持的总向量数据宽度扩展成了256位。新增了若干条256位浮点SIMD指令。昨天,Intel刚刚发布了AVX2指令集,这套指令集在AVX基础上做了扩展,不过要在2013年发布的Haswell处理器上才能支持。参考1给出了

    2022年5月27日
    44
  • java软件工程师前景_培养java工程师

    java软件工程师前景_培养java工程师从各大招聘网上我们就能看出,同等软件工程师的就业前景是远比网络工程师就业前景要好很多,年薪在10万以上的软件工程师还只是一个起点,随着经验的增加,年薪超20万的也是很常见的,而其它专业的发展前景是远比不上Java软件工程师的就业前景的。Java软件工程师就业前景为什么这么好呢?原因之一:软件工程师可谓是软件项目开发的掌舵者,一名优秀的软件工程师应当具有较强的逻辑思维能力,对于技术的发展有敏锐的嗅觉…

    2022年9月23日
    3
  • 初学者计算机电脑怎样学,初学者怎样学习电脑能够快速入门(免费科普电脑基础知识)…

    初学者计算机电脑怎样学,初学者怎样学习电脑能够快速入门(免费科普电脑基础知识)…上次回答了一个关于怎样自学电脑操作比较快的问题,现在我把我的答案整理升级,增加了键盘的快速入手使用方法。发布出来,以便更多的人能够有所收获。1.开机和关机作为完全初学者,首先需要学会正确的开关机。下图我整理了一些常见主机的开关机键与重启(restart)按键。常见主机上的开关机键和重启键一般来说,较大的一个是开关机键,较小的一个为重启键。在电脑处于关闭状态时,按一下开关机键即为开机。当电脑处于开…

    2022年10月19日
    2
  • Vue(3)webstorm代码格式规范设置与vue模板配置

    Vue(3)webstorm代码格式规范设置与vue模板配置编译器代码格式规范设置通常我们写代码时,代码缩进都是4个空格,但是在前端中,据全球投票统计,建议使用2个空格来进行代码缩进。首先我们打开webstorm中的设置,如果使用的是mac的同学直接使用c

    2022年7月31日
    97
  • index() 方法返回指定元素相对于其他指定元素的 index 位置。

    index() 方法返回指定元素相对于其他指定元素的 index 位置。

    2021年10月18日
    165

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号