1.引入PDF文件
1.1 引入中文字体 PDFMerger/fpdf/chinese.php;
12 引入英文字体 PDFMerger/fpdf/chinese.php;
文件地址如图 :
2.获取信息
$barcode ='保存地址'; //保存地址
$source = trim( file_get_contents('url')); //获取文件信息
3.PDF文件格式
//中文引入 require 'chinese.php'; $pdf = new PDF_Chinese(); $pdf->AddGBFont('simhei', '黑体'); $pdf->AddPage(); //英文引入 $pdf = new FPDF ( 'P', 'mm', array ( 100, 100 ) ); $pdf->SetAutoPageBreak ( false ); $pdf->SetMargins ( 1, 1 ); $pdf->AddPage (); $pdf->SetFont('simhei', '', 13); //自动换行 $pdf->MultiCell(180,10,iconv("utf-8","gbk","中文自动换行中文自动换行中文自动换行中文自动换行中文自动换行中文自动换行中文自动换行中文自动换行中文自动换行中文自动换行中文自动换行")); //显示一格 $pdf->Cell(40,10,iconv("utf-8","gbk","第一个单元格")); $pdf->Ln();//换行 $pdf->Cell(40,10,iconv("utf-8","gbk","第二个单元格")); $pdf->Ln();//换行 //输出表格 //Cell方法最后一个参数表示是否显示边框 $pdf->Cell(60,10,iconv("utf-8","gbk","姓名"),1); $pdf->Cell(60,10,iconv("utf-8","gbk","性别"),1); $pdf->Ln(); $pdf->Cell(60,10,iconv("utf-8","gbk","张三"),1); $pdf->Cell(60,10,iconv("utf-8","gbk","男"),1); $pdf->Ln(); $pdf->Cell(60,10,iconv("utf-8","gbk","李四"),1); $pdf->Cell(60,10,iconv("utf-8","gbk","女"),1); $pdf->Ln(); //插入图片 //Image参数:文件,x坐标,y坐标,宽,高 $pdf->Image('test.jpg',null,null,50,50); $pdf->Output();//直接输出,即在浏览器显示 //$pdf->Output('example.pdf','F');//保存为example.pdf文件
标签:10,iconv,FPDF,换行,gbk,Cell,pdf,操作,php From: https://www.cnblogs.com/itzhangmeng2299/p/16648913.html