网页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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • linux 查看目录大小_shell判断文件大小

    linux 查看目录大小_shell判断文件大小du[-abcDhHklmsSx][-L][-X][–block-size][–exclude=][–max-depth=][–help][–version][目录或文件]常用参数:-a或-all为每个指定文件显示磁盘使用情况,或者为目录中每个文件显示各自磁盘使用情况。-b或-bytes显示目录或文件大小时,以byte为单位。-c或–tota…

    2022年10月12日
    0
  • 什么是IT人力外包?什么情况下选用IT人力外包?

    什么是IT人力外包?什么情况下选用IT人力外包?什么是IT人力外包?什么情况下选用IT人力外包?在IT企业中,在工作中通常涉及的外包业务主要有三类形式,概括来说:(一)项目外包:有明确的项目目标、时间要求、产出交付标准,请有相关资质的乙方公司帮助完成,付费方式通常为按约定的项目阶段、达成的交付产出分期支付,最后在项目上线运行后可能还会留少量比例的尾款,确保项目上线后还能得到乙方的继续支持。(二)业务外包:对于一些例行、重复的工作,明…

    2022年5月19日
    39
  • 文本域[通俗易懂]

    文本域[通俗易懂]<textarea>元素用来创建多行文本框。与其他input元素不同,<textarea>元素并非空元素,因此它包含起始标签和结束标签。

    2022年8月5日
    8
  • Latex 公式换行问题,(换行,等号对齐)

    Latex 公式换行问题,(换行,等号对齐)1.换行后等式对齐\begin{equation}\begin{aligned}R(S_2)&=p_2\cdotS_2=\sum_{i\in\mathcal{I}^+(p_2)}B_i+\betaB_{l’}\\&\leq\sum_{i\in\mathcal{I}^+(p_2)}B_i+B_{l’}\leq\sum_{i\in\mat

    2022年4月30日
    178
  • QuoteName\生成Sql语句

    QuoteName\生成Sql语句ifexists(selectnamefromtempdb.dbo.sysobjectswhereid=object_id(N’tempdb.dbo.#tempWorkDate’)andtype=’u’)droptable#tempWorkDateCREATETABLE[#tempWorkDate]([WorkDate][varc…

    2022年9月25日
    0
  • 服务器永恒之蓝病毒解决方法_永恒之蓝病毒作者

    服务器永恒之蓝病毒解决方法_永恒之蓝病毒作者一、NSA“永恒之蓝”勒索蠕虫全球爆发2017年5月12日爆发的WannaCry勒索病毒肆虐了全球网络系统,引起各国企业和机构极大恐慌。而这次受害最严重的是Windows系统,自然也被锁定为怀疑对象,有人认为正是因为该系统对于漏洞的麻木和疏漏才导致了此次勒索病毒的蔓延。作为受害者的微软却将矛头指向美国国安局(NSA)和永恒之蓝。不法分子利用…

    2022年10月16日
    1

发表回复

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

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