插件例子:https://tcpdf.org/examples/

下载tcpdf插件:

demo

// Include the main TCPDF library (search for installation path).
require_once(__DIR__.'/../vendor/tcpdf/tcpdf.php');
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // set document information
$pdf->SetCreator("创建者");
$pdf->SetAuthor('作者');
$pdf->SetTitle('标题');
$pdf->SetSubject('项目名');
$pdf->SetKeywords(关键字'); // set header and footer fonts
// remove default header/footer
//关闭头尾输出
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false); // 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('symbol', '', 10);
//$pdf->SetFont('times', 'BI', 20, '', 'false'); // add a page
$pdf->AddPage(); // writeHTML($html, $ln=true, $fill=false, $reseth=false, $cell=false, $align='')
// writeHTMLCell($w, $h, $x, $y, $html='', $border=0, $ln=0, $fill=0, $reseth=true, $align='', $autopadding=true) // create some HTML content
$html = '<html><body>dfdfdfdfdf自定义内容</body><html>';
/ output the HTML content
$pdf->writeHTML($html, true, false, true, false, ''); // ---------------------------------------------------------
//浏览pdft
//Close and output PDF document
$pdf->Output('example_006.pdf', 'I'); //============================================================+
// END OF FILE
//============================================================+

  

效果

php生成pdf,php+tcpdf生成pdf, php pdf插件的更多相关文章

  1. Java在已存在的pdf文件中生成文字和图片--基础

    自我总结,有什么不足之处请告知,感激不尽!下一次总结pdf模板映射生成报表(应对多变的pdf报表需求,数据提供和报表生成解耦). 目的:在给定的pdf模板上生成报表,就需要知道最基本的操作:文字添加, ...

  2. django生成文件txt、pdf(在生成 PDF 文件之前,需要安装 ReportLab 库)

    from django.http import HttpResponse def download_file(request): # Text file #response = HttpRespons ...

  3. java根据pdf模版动态生成pdf

    java根据pdf模版动态生成pdf package com.utils; import java.io.ByteArrayOutputStream; import java.io.File; imp ...

  4. Java实现PDF和Excel生成和数据动态插入以及导出

    一.序言 Excel.PDF的导出.导入是我们工作中经常遇到的一个问题,刚好今天公司业务遇到了这个问题,顺便记个笔记以防下次遇到相同的问题而束手无策. 公司有这么两个需求: 需求一.给了一个表单,让把 ...

  5. 【使用Itext处理PDF文档(新建PDF文件、修改PDF文件、PDF中插入图片、将PDF文件转换为图片)】

    iText简介 iText是著名的开放源码的站点sourceforge一个项目,是用于生成PDF文档的一个java类库.通过iText不仅可以生成PDF或rtf的文档,而且可以将XML.Html文件转 ...

  6. Pdf File Writer 中文应用(PDF文件编写器C#类库)

    该文由小居工作室(QQ:2482052910)    翻译并提供解答支持,原文地址:Pdf File Writer 中文应用(PDF文件编写器C#类库):http://www.cnblogs.com/ ...

  7. Word转pdf,再转图片插入PDF

    WORD转PDF所需jar包: https://yangtaotao.lanzous.com/ice1jlc PDF转图片所需jar包: https://yangtaotao.lanzous.com/ ...

  8. PDF技术 -Java实现Html转PDF文件

    转载:https://blog.csdn.net/qq_34190023/article/details/82999702 html转换为pdf的关键技术是如何处理网页中复杂的css样式.以及中文乱码 ...

  9. php生成excel或php生成csv

    一.php生成excel 使用phpexcel类文件生成 二.php生成csv <?php$action ="make";if ($action=='make'){ $fp ...

随机推荐

  1. Linux查看CPU信息计算CPU核数量

    1. 物理CPU的个数: cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l 2. 每个物理CPU的核心数量: ...

  2. 论文笔记: Matrix Factorization Techniques For Recommender Systems

    Recommender system strategies 通过例子简单介绍了一下 collaborative filtering 以及latent model,这两个方法在之前的博客里面介绍过,不累 ...

  3. C#设计模式之12:中介者模式

    中介者模式 在asp.net core中实现进程内的CQRS时用mediatR是非常方便的,定义command,然后定义commandhandler,或者notification和notificati ...

  4. Linux系统新手入门学习的四点建议

    随着计算机的普及.互联网的发展,原本黑客手中的攻城利器---Linux,渐渐进入到普通群众的视线里,让越来越多的人接触到Linux,并学习Linux进而投身到Linux运维工作中去.如果大家对Linu ...

  5. 创建图 figure & figcaption

    如报纸.杂志.报告等其他媒介上看到过图.通常,图是由页面上的文本引述出. 在HTML5出现之前,没有专门实现这个目的的元素,因此一些开发人员想出了他们自己的解决办法(通常会使用不那么理想的.没有语义的 ...

  6. JavaScript之鼠标事件

    事件三要素: 事件源.事件类型(点击onclick)=function(){ 事件触发后执行的代码 } 案例: function abb(a){ return document.getElementB ...

  7. ora121 tips

    1. 900929 - Linux: STORAGE_PARAMETERS_WRONG_SET and "mmap() failed" Solution Increase the ...

  8. iOS OpenCV资料收集

    OpenCV iOS Title: OpenCV iOS Hello Compatibility: > OpenCV 2.4.3 Author: Charu Hans You will lear ...

  9. OpenGL ES教程系列(经典合集)

    为了搞透播放器的开发,花了些时间收集这些资料,虽然我已经搞定opengles渲染视频的内容,但是想玩玩opengles,往深里玩,图像处理这块是个好的方向,所以opengles是值得好好学的.   O ...

  10. Unity shader error: “Too many texture interpolators would be used for ForwardBase pass”

    Unity shader error: "Too many texture interpolators would be used for ForwardBase pass" 解决 ...