1、TCPDF 背景图片透明度 

参考:https://bbs.csdn.net/topics/392364981

效果:

2、画一条线:

2.1方法解说 

/*画一条线:

x1:线条起点x坐标

y1:线条起点y坐标

x2:线条终点x坐标

y2:线条终点y坐标

style:SetLineStyle的效果一样

*/

//       $pdf->Line($x1, $y1, $x2, $y2, $style=array());

 2.2方法使用:

/*线的颜色*/
$this->SetLineStyle(array('width' => 0, 'cap' => 'butt', 'join' => 'miter', 'dash' => '0', 'color' => array(220, 20,60)));
/*画一条线*/
$this->Line(1, 100, 100, 1, $style=array()); /*加入一条下划线 下划线颜色默认为黑色,用此方法【SetLineStyle()】可以自定义线的颜色 */
$this->Cell(180, 0, '', 1, 0, 'C', 0, '', 0, true);

2.3效果:

3.自定义页眉页脚:

/*
*
* */
function zidingyi_yemei(){
//============================================================+
// File name : example_003.php
// Begin : 2008-03-04
// Last Update : 2013-05-14
//
// Description : Example 003 for TCPDF class
// Custom Header and Footer
//
// Author: Nicola Asuni
//
// (c) Copyright:
// Nicola Asuni
// Tecnick.com LTD
// www.tecnick.com
// info@tecnick.com
//============================================================+ /**
* Creates an example PDF TEST document using TCPDF
* @package com.tecnick.tcpdf
* @abstract TCPDF - Example: Custom Header and Footer
* @author Nicola Asuni
* @since 2008-03-04
*/ // Include the main TCPDF library (search for installation path).
require_once('ThinkPHP/Library/Vendor/tcpdf/tcpdf.php'); // Extend the TCPDF class to create custom Header and Footer
class MYPDF extends TCPDF { //Page header
/*public function Header() {
// Logo
$image_file = K_PATH_IMAGES.'bl_logo.png';
$this->Image($image_file, 10, 10, 15, '', 'JPG', '', 'T', false, 300, '', false, false, 0, false, false, false);
// Set font
$this->SetFont('helvetica', 'B', 20);
// Title
$this->Cell(0, 15, '<< TCPDF Example 003 >>', 0, false, 'C', 0, '', 0, false, 'M', 'M');
} // Page footer
public function Footer() {
// Position at 15 mm from bottom
$this->SetY(-15);
// Set font
$this->SetFont('helvetica', 'I', 8);
// Page number
$this->Cell(0, 10, 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M');
}*/
//Page header 自定义页眉
public function Header() {
$this->SetFont('stsongstdlight', '', 10);
$this->SetHeaderData('', '', ''.' 001', '', array(0,64,255), array(0,64,128));
// Title
$this->SetY(1);
$image_file = K_PATH_IMAGES.'bl_logo.png';
$this->SetY(1);
$this->Image($image_file, 15, 3.2, 5, '', 'PNG', '', 'T', false, 300, '', false, false, 0, false, false, false);
$this->SetY(3.7);
$left_text = '<p style="text-indent: 20px; color: #00489A; font-weight: bold;">山东保蓝环保工程有限公司</p>';
//$this->Write(0, $left_text, '', 0, 'L', true, 0, false, false, 0);
$this->writeHTML($left_text, 1, false, true, false, 'L');
$this->SetY(3.7);
$right_text = '<p style="color: #00489A; font-weight: bold;">技术方案</p>';
$this->writeHTML($right_text, 1, false, true, false, 'R');
/*$this->Cell(0, 10, ' 山东保蓝环保工程有限公司', 0, 0, 'L');
$this->Cell(0, 10, '技术方案', 0, 0, 'R');*/
//$this->SetX(1);
$this->SetY(9);
/*页眉下划线颜色*/
$this->SetLineStyle(array('width' => 0, 'cap' => 'butt', 'join' => 'miter', 'dash' => '0', 'color' => array(128,128,128)));
/*靠左面的距离,左上角的距离 ,长度,右上角的距离*/
$this->Line(14, 8.6, 196, 8.6, $style=array()); $this->SetY(19);
/*页眉下划线*/
$this->Cell(180, 0, '', 1, 0, 'C', 0, '', 0, true);
} // Page footer 自定义页脚
public function Footer() {
// Position at 15 mm from bottom
$this->SetY(-15);
// Set font
$this->SetFont('helvetica', 'I', 8);
// Page number
$this->Cell(0, 10, ' '.$this->getAliasNumPage().' / '.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M');
}
/*function Header() //设定页眉
{
$this->SetFont('stsongstdlight','',10);
$this->Write(10,'IPv6协议一致性测试报告','',false,'C'); $this->Ln(20);
} function Footer() //设定页脚
{
$this->SetY(-15);
$this->SetFont('stsongstdlight','',10);
$this->Cell(0,10,'第'.$this->PageNo().'页',0,0,'R');
}*/
} // create new PDF document
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle('TCPDF Example 003');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); // set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); // set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); // set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); // set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); // set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
require_once(dirname(__FILE__).'/lang/eng.php');
$pdf->setLanguageArray($l);
} // --------------------------------------------------------- // set font
$pdf->SetFont('times', 'BI', 12); // add a page
$pdf->AddPage(); // set some text to print
$txt = <<<EOD
TCPDF Example 003 Custom page header and footer are defined by extending the TCPDF class and overriding the Header() and Footer() methods.
EOD; // print a block of text using Write()
$pdf->Write(0, $txt, '', 0, 'C', true, 0, false, false, 0); // --------------------------------------------------------- //Close and output PDF document
$pdf->Output('example_003.pdf', 'I'); //============================================================+
// END OF FILE
//============================================================+ }

 效果:

TCPDF 背景图片透明度的更多相关文章

  1. TextView字体和背景图片 设置透明度

    背景图片透明度设置  viewHolder.relative_layout.getBackground().setAlpha(225);     0  ---  225 ((TextView)tv). ...

  2. android设置背景图片透明

    设置Activiyt为透明可以在Activity中引用系统透明主题android:theme="@android:style/Theme.Translucent" 设置背景图片透明 ...

  3. Hexo瞎折腾系列(2) - 添加背景图片轮播

    动态背景图片插件jquery-backstretch jquery-backstretch是一款简单的jQuery插件,可以用来设置动态的背景图片,以下是官方网站的介绍. A simple jQuer ...

  4. app引导页(背景图片切换加各个页面动画效果)

    前言:不知不觉中又加班到了10点半,整个启动页面做了一天多的时间,一共有三个页面,每个页面都有动画效果,动画效果调试起来麻烦,既要跟ios统一,又要匹配各种不同的手机,然后产品经理还有可能在中途改需求 ...

  5. 解决android:background背景图片被拉伸问题

    ImageView中XML属性src和background的区别: background会根据ImageView组件给定的长宽进行拉伸,而src就存放的是原图的大小,不会进行拉伸.src是图片内容(前 ...

  6. Duilib技巧:背景图片平铺

    贴图的描述 方式有两种    // 1.aaa.jpg    // 2.file='aaa.jpg' res='' restype='0' dest='0,0,0,0' source='0,0,0,0 ...

  7. WPF 渐隐渐现切换背景图片

    最近学习WPF,尝试着自己做一些小玩意,也遇到了一些问题,于是整理记录以便日后查阅. 我们都知道WPF可以实现一些很炫的效果,然而有时候为达到这个目的却并不是一件很容易的事情.比如:在软件中我希望能够 ...

  8. html之改变图片透明度而不改变文字的透明度--两种方法实现

    图片与图片上的文字设置不同的透明度的两种方法: 第一种方法:背景图+定位+background: url(timg.jpg)no-repeat; <!DOCTYPE html> <h ...

  9. 设置VS2017背景图片

    设置方法很简单:安装扩展ClaudiaIDE 1.在这里下载扩展,https://visualstudiogallery.msdn.microsoft.com/9ba50f8d-f30c-4e33-a ...

随机推荐

  1. debug 2

    Red Hat Developer Toolsetdelivers the latest stable versions of essential GCC C, C++, Fortran, and s ...

  2. virtualenv安装及使用

    环境 Windows 10 python 3.6.7 安装 virtualenv用于创建虚拟环境,用于隔离不同的python版本的运行,是容器类软件.这里在Windows下通过pip安装: pip i ...

  3. 解决SecureCRT中文版"数据库里没找到防火墙'无'"的错误提示

    问题描述: 最近从同事那拷贝到一个中文版的SecureCRT,但是每次打开都会有个防火墙的错误提示,“数据库里没找到防火墙“无”.此会话将尝试不通过防火墙进行连接. 出现这个错误的原因是在Secure ...

  4. NOIP2018Day1T2 货币系统

    题目描述 在网友的国度中共有 \(n\) 种不同面额的货币,第 \(i\) 种货币的面额为 \(a[i]\),你可以假设每一种货币都有无穷多张.为了方便,我们把货币种数为 \(n\).面额数组为 \( ...

  5. 高可用Redis(五):瑞士军刀之慢查询,Pipeline和发布订阅

    1.慢查询 1.1 慢查询的生命周期 步骤一:client通过网络向Redis发送一条命令 步骤二:由于Redis是单线程应用,可以把Redis想像成一个队列,client执行的所有命令都在排队等着s ...

  6. 如何在Django中配置MySQL数据库

    直接上图 在项目中直接找到settings 文件 第一步       原始Django自带数据库 第二步将配置改成MySQL的数据 第三步  在__init__文件中告知Django使用MySQL数据 ...

  7. STM32的定时器定时时间计算(计数时间和中断定时时间)

    时基单元 可编程高级控制定时器的主要部分是一个16位计数器和与其相关的自动装载寄存器.这个计数器可以向上计数.向下计数或者向上向下双向计数.此计数器时钟由预分频器分频得到. 计数器.自动装载寄存器和预 ...

  8. 末学者笔记--NFS服务和DHCP服务讲解

    NFS服务端概述 一.概念: NFS,是Network File System的简写,即网络文件系统.网络文件系统是FreeBSD支持的文件系统中的一种,也被称为NFS:NFS允许一个系统在网络上与他 ...

  9. swagger.net 使用nginx 代理时出现端口号导致出错

    1:当我们通过nginx代理访问时,由于nginx配置了映射到的一个站点为端口为127.0.0.1:6201,导致访问swagger接口时出现增加端口号,如下截图,这样就导致整个swagger无法使用 ...

  10. mybatis和hibernate中的懒加载

    概念:所谓懒加载就是延时加载,延迟加载.什么时候用懒加载呢,我只能回答要用懒加载的时候就用懒加载.至于为什么要用懒加载呢,就是当我们要访问的数据量过大时,明显用缓存不太合适,因为内存容量有限 ,为了减 ...