TCPDF生成PDF文件,含jpjraph生成雷达图

TCPDF生成PDF文件,含jpjraph生成雷达图

依赖自行安装

        "tecnickcom/tcpdf": "^6.6",
        "amenadiel/jpgraph": "4"

雷达图生成

中文字体添加安装

没有封装,只作为测试案例展示

// 创建新的PDF文档
        $pdf = new \TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
//        $pdf = new \TCPDF('P', 'mm', 'A4', true, 'UTF-8', false, true);
        $pdf->SetPrintHeader(false);
        $pdf->SetPrintFooter(false);
        //禁用自动分页
        $pdf->SetAutoPageBreak(false);

// 设置文档信息
//        $pdf->SetCreator(PDF_CREATOR);  //设置 PDF 文件的创建者。
//        $pdf->SetAuthor('Your Name');   //设置 PDF 文件的作者姓名。
//        $pdf->SetTitle('Radar Chart');      //设置 PDF 文件的标题。
//        $pdf->SetSubject('TCPDF Tutorial');//设置 PDF 文件的主题。
//        $pdf->SetKeywords('TCPDF, PDF, example, test, guide');//设置 PDF 文件的关键词。
// 设置默认的页眉数据
//        $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 006', PDF_HEADER_STRING);
// 设置页眉和页脚字体
//        $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
//        $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// 设置默认等宽字体
//        $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// 设置边距
//        $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
//        $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
//        $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
// 设置自动分页
//        $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// 设置图像缩放因子
//        $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set font
//        $pdf->SetFont('helvetica', '', 10);

        $pageWidth = $pdf->getPageWidth();// 页宽度
        $pageHeight = $pdf->getPageHeight();// 页宽度
        $titleFont = 'yahei'; // 字体
        $titleFontSize = 16; // 字号
        
        //封面
        $pdf->AddPage();
        $cover_img = 'https://******.png';
        $pdf->Image($cover_img, 0, 0, $pageWidth, $pageHeight);
        // 设置文字颜色
        $pdf->SetTextColor(0,0,0);
        // 设置字体和字号
        $pdf->SetFont($titleFont, '', $titleFontSize-6);
        $pdf->Text(23, 275, '扫一扫在线浏览报告');
        //======================编号
        // 设置文字颜色
        $pdf->SetTextColor(0,0,0);
        // 设置字体和字号
        $pdf->SetFont($titleFont, '', $titleFontSize-6);
        $pdf->Text(18, 30, '报告编号:');
        //======================自测时间
        $dateTime = new \DateTime($row['create_time']);
        $yearMonthDay = $dateTime->format('Y-m-d');

        $pdf->Text(157, 265, '自测时间:'.$yearMonthDay);
        //======================报告单位
        $pdf->Text(115, 271, '报告提供单位:');
        //======================企业名称
        // 设置文字颜色
        $pdf->SetTextColor(67, 16, 16);
        // 设置字体和字号
        $pdf->SetFont($titleFont, '', $titleFontSize+3);
        $pdf->Text($pdf->GetX()-180, $pdf->GetY()-145, $qy_data['Name'] ?? '');

        //第一页
        $pdf->AddPage();
        $headerImgPath = 'https://*****.png';
        $footerImgPath = 'https://******.png';
        $headerImgHeight = 30; // 页眉图片高度
        $footerImgHeight = 30; // 页脚图片高度

        // 添加页眉图片
        $pdf->Image($headerImgPath, 0, 0, $pageWidth, $headerImgHeight, '', '', '', false, 300, '', false, false, 0);
        // 添加页脚图片
        $pdf->Image($footerImgPath, 0, 267, $pageWidth, $footerImgHeight, '', '', '', false, 300, '', false, false, 0);
        $pdf->SetFont($titleFont, '', 8);
        $pdf->SetTextColor(144, 144, 144);
        $pdf->Text($pdf->GetX()+8, $pdf->GetY()+2, $qy_data['Name']);

//================开始========================
        // 设置标题样式
        $titleWidth = $pageWidth - 20; // 标题宽度(以点为单位)
        $titleHeight = 15; // 标题高度(以点为单位)
        $titleBackgroundColor = array(0, 130, 237); // 背景颜色(RGB颜色值)
        $titleTextColor = array(255, 255, 255); // 文字颜色(RGB颜色值)

        // 设置背景颜色
        $pdf->SetFillColor($titleBackgroundColor[0], $titleBackgroundColor[1], $titleBackgroundColor[2]);
        // 设置文字颜色
        $pdf->SetTextColor($titleTextColor[0], $titleTextColor[1], $titleTextColor[2]);
        // 设置字体和字号
        $pdf->SetFont($titleFont, 'B', $titleFontSize);
        // 绘制带有背景颜色的矩形作为标题
        $pdf->Rect(10, 25, $titleWidth, $titleHeight, 'F');
        // 在标题矩形内居中显示标题文本
        $titleText = '企业概要';
        $pdf->Text(12, 29, $titleText);

//===================黑字文案=================
        $pdf->SetTextColor(0,0,0);
        $pdf->SetFont($titleFont, '', 12);
        $pdf->Text(12, 45, '企业基本信息数据来源于测试主体在相关信息公示、公开信息数据整理分析所得');

        //======================

        // 设置背景颜色
        $pdf->SetFillColor(95, 183, 255);
        // 设置文字颜色
        $pdf->SetTextColor($titleTextColor[0], $titleTextColor[1], $titleTextColor[2]);
        $pdf->Rect(10, 55, $titleWidth, $titleHeight-2, 'F');
        // 在标题矩形内居中显示标题文本
        $pdf->SetFont($titleFont, 'B', 12);
        $titleText = '基本信息';
        $pdf->Text(12, 59, $titleText);


        $pdf->Ln(12); // 换行
        // 设置字体
        $pdf->SetTextColor(0,0,0);
        $pdf->SetFont($titleFont, '', 8);
        // 表格数据
        $data = [
            ['企业名称', $qy_data['Name'] ?? '', '统一社会信用代码', $qy_data['CreditCode'] ?? ''],
            ['法人代表', $qy_data['OperName'] ?? '', '注册资本', $qy_data['RegistCapi'] ?? ''],
            ['企业类型', $qy_data['EconKind'] ?? '', '登记状态', $qy_data['Status'] ?? ''],
            ['成立日期', $qy_data['StartDate'] ? date('Y-m-d',strtotime($qy_data['StartDate'])) : '', '核准日期', $qy_data['CheckDate'] ? date('Y-m-d',strtotime($qy_data['CheckDate'])) : ''],
            ['营业期限', date('Y-m-d',strtotime($qy_data['TermStart'])).'至'.$qy_data['TeamEnd'] ? date('Y-m-d',strtotime($qy_data['TeamEnd'])) :'无固定期限', '登记机关', $qy_data['BelongOrg'] ?? ''],
//            ['注册地址', 'B4', 'C4', 'D4'],
//            ['经营范围', 'B4', 'C4', 'D4'],
        ];

        // 遍历表格数据
        $tHeight = 30;
        foreach ($data as $key => $val) {
            foreach ($val as $colIndex => $cell) {
                // 设置单元格背景颜色
                if ($colIndex == 0 || $colIndex == 2) {
                    $pdf->SetFillColor(244, 244, 244); // 淡灰色背景
                    $tWidth = 30;
                    $align = 'C';
                } else {
                    $pdf->SetFillColor(255, 255, 255); // 白色背景
                    $tWidth = 65;
                    $align = 'L';
                }

                // 创建单元格
                $pdf->Cell($tWidth, 10, $cell, ['LTRB' => ['width' => 0.1, 'color' => array(233, 233, 233)]], 0, $align, 1);
            }
            $pdf->Ln(); // 换行
        }
        // 合并最后一行的后三列
//        $pdf->SetXY(12, $pdf->GetY()); // 设置位置为当前 Y 坐标
        $tWidth = 30;
        $pdf->SetFillColor(244, 244, 244); // 淡灰色背景
        $pdf->Cell($tWidth, 10, '注册地址', 1, 0, 'C',1);
        $pdf->SetFillColor(255, 255, 255); // 白色背景
        $pdf->Cell($tWidth + 130, 10, $qy_data['Address']??'', ['LTRB' => ['width' => 0.1, 'color' => array(233, 233, 233)]], 1, 'L', 1, '', 3);
        $pdf->SetFillColor(244, 244, 244); // 淡灰色背景


        $contentHeight = $pdf->GetStringHeight($tWidth + 130,$qy_data['Scope']??'');
        $rowHeight = max(10, $contentHeight)+2; // 行高度,取标题和内容高度的最大值
        $pdf->Cell($tWidth, $rowHeight, '经营范围', 1, 0, 'C',1);
        $pdf->MultiCell($tWidth + 130, $rowHeight, $qy_data['Scope']??'', ['LTRB' => ['width' => 0.1, 'color' => array(233, 233, 233)]], 'L', 0, 1,'', '', true, 0, false, true, $rowHeight, 'M');

============2. 企业投资人信息=======
/// 表格数据
//        $data = [
//            [
//                "KeyNo" => "1xxxxxxxxxxxxxxxxx",
//                "StockName" => "1xxx",
//                "StockType" => "1自然人股东1",
//                "StockPercent" => "12.8338%",
//                "ShouldCapi" => "1641.6913",
//                "ShoudDate" => "1007-10-22",
//                "StakeDate" => "1007-08-22",
//                "CreditCode" => "1xxxxxxxxxxxxx"
//            ],[
//                "KeyNo" => "2xxxxxxxxxxxxxxxxx",
//                "StockName" => "2xxx",
//                "StockType" => "自然人股东2",
//                "StockPercent" => "22.8338%",
//                "ShouldCapi" => "2641.6913",
//                "ShoudDate" => "2007-10-22",
//                "StakeDate" => "2007-08-22",
//                "CreditCode" => "2xxxxxxxxxxxxxx"
//            ]
//        ];
        $data = $qy_datas['t']['Result'];
        if(!$data){
            $data = [
                [
                    "KeyNo" => "-",
                    "StockName" => "-",
                    "StockType" => "-",
                    "StockPercent" => "-",
                    "ShouldCapi" => "-",
                    "ShoudDate" => "-",
                    "StakeDate" => "-",
                    "CreditCode" => "-"
                ]
            ];
        }
            // 检查是否需要换页
            if ($pdf->GetY() + 20 > $pdf->getPageHeight()) {
                $pdf->AddPage(); // 换页        // 添加页眉图片
                $pdf->Image($headerImgPath, 0, 0, $pageWidth, $headerImgHeight, '', '', '', false, 300, '', false, false, 0);
                // 添加页脚图片
                $pdf->Image($footerImgPath, 0, 267, $pageWidth, $footerImgHeight, '', '', '', false, 300, '', false, false, 0);
                $pdf->SetFont($titleFont, '', 8);
                $pdf->SetTextColor(144, 144, 144);
                $pdf->Text($pdf->GetX()+8, $pdf->GetY()+2, $qy_data['Name']);
                $pdf->Ln(12);
            }
            $pdf->SetFont($titleFont, 'B', 12);
            // 设置背景颜色
            $pdf->SetFillColor(95, 183, 255);
            // 设置文字颜色
            $pdf->SetTextColor($titleTextColor[0], $titleTextColor[1], $titleTextColor[2]);
            $pdf->Rect($pdf->GetX(), $pdf->GetY()+3, $titleWidth, $titleHeight-2, 'F');
            // 在标题矩形内居中显示标题文本
            $titleText = '企业投资人信息';
            $pdf->Text(12, $pdf->GetY()+7, $titleText);

            $pdf->Ln(12); // 换行
            // 遍历表格数据
            foreach ($data as $key => $val) {
                // 检查是否需要换页
                if ($pdf->GetY() + 30 > $pdf->getPageHeight()) {
                    $pdf->AddPage(); // 换页        // 添加页眉图片
                    $pdf->Image($headerImgPath, 0, 0, $pageWidth, $headerImgHeight, '', '', '', false, 300, '', false, false, 0);
                    // 添加页脚图片
                    $pdf->Image($footerImgPath, 0, 267, $pageWidth, $footerImgHeight, '', '', '', false, 300, '', false, false, 0);
                    $pdf->SetFont($titleFont, '', 8);
                    $pdf->SetTextColor(144, 144, 144);
                    $pdf->Text($pdf->GetX()+8, $pdf->GetY()+2, $qy_data['Name']);
                    $pdf->Ln(12);
                }
                // 设置字体
                $pdf->SetTextColor(0,0,0);
                $pdf->SetFont($titleFont, '', 8);

                $pdf->SetFillColor(244, 244, 244); // 淡灰色背景
                // 创建单元格
                $pdf->Cell(30, 10, '投资人姓名', 1, 0, 'C', 1);
                $pdf->SetFillColor(255, 255, 255); // 白色背景
                // 创建单元格
                $pdf->Cell(65, 10, $val['StockName'], 1, 0, 'L', 1);
                $pdf->SetFillColor(244, 244, 244); // 淡灰色背景
                // 创建单元格
                $pdf->Cell(30, 10, '投资人类型', 1, 0, 'C', 1);
                $pdf->SetFillColor(255, 255, 255); // 白色背景
                // 创建单元格
                $pdf->Cell(65, 10, $val['StockType'], 1, 1, 'L', 1);
                $pdf->SetFillColor(244, 244, 244); // 淡灰色背景
                // 创建单元格
                $pdf->Cell(30, 10, '持股比例', 1, 0, 'C', 1);
                $pdf->SetFillColor(255, 255, 255); // 白色背景
                // 创建单元格
                $pdf->Cell(65, 10, $val['StockPercent'], 1, 0, 'L', 1);
                $pdf->SetFillColor(244, 244, 244); // 淡灰色背景
                // 创建单元格
                $pdf->Cell(30, 10, '认缴出资额', 1, 0, 'C', 1);
                $pdf->SetFillColor(255, 255, 255); // 白色背景
                // 创建单元格
                $pdf->Cell(65, 10, $val['ShouldCapi'], 1, 1, 'L', 1);
                $pdf->Ln(2); // 换行
            }

//============3. 企业资质(如高新技术企业、创新型/科技型中小企业)=======
        // 表格数据
//        $data = [
//            [
//                "Name" => "高新技术企业",
//                "Level" => "国家级",
//                "Source" => "关于辽宁省2020年第三批高新技术企业备案的复函",
//                "PublishOffice" => "全国高新技术企业认定管理工作领导小组办公室",
//                "PublishDate" => "2021-01-18",
//                "BegingDate" => "2020-12-01",
//                "DeadLine" => "2023-12-01"
//            ],
//            [
//                "Name" => "科技型中小企业",
//                "Level" => "国家级",
//                "Source" => "辽宁省2020年第五批入库科技型中小企业名单公告",
//                "PublishOffice" => "辽宁省科学技术厅",
//                "PublishDate" => "2020-11-30",
//                "BegingDate" => "2020-11-30",
//                "DeadLine" => "2023-11-30"
//            ]
//        ];
        $data = $qy_datas['z']['Result']['Data'];
        if(!$data){
                    $data = [
            [
                "Name" => "-",
                "Level" => "-",
                "Source" => "-",
                "PublishOffice" => "-",
                "PublishDate" => "-",
                "BegingDate" => "-",
                "DeadLine" => "-"
            ]
        ];
        }
            // 检查是否需要换页
            if ($pdf->GetY() + 30 > $pdf->getPageHeight()) {
                $pdf->AddPage(); // 换页        // 添加页眉图片
                $pdf->Image($headerImgPath, 0, 0, $pageWidth, $headerImgHeight, '', '', '', false, 300, '', false, false, 0);
                // 添加页脚图片
                $pdf->Image($footerImgPath, 0, 267, $pageWidth, $footerImgHeight, '', '', '', false, 300, '', false, false, 0);
                $pdf->SetFont($titleFont, '', 8);
                $pdf->SetTextColor(144, 144, 144);
                $pdf->Text($pdf->GetX()+8, $pdf->GetY()+2, $qy_data['Name']);
                $pdf->Ln(12);
            }
        // 设置背景颜色
        $pdf->SetFillColor(95, 183, 255);
        // 设置文字颜色
        $pdf->SetTextColor($titleTextColor[0], $titleTextColor[1], $titleTextColor[2]);
        $pdf->Rect($pdf->GetX(), $pdf->GetY(), $titleWidth, $titleHeight-2, 'F');
        $pdf->SetFont($titleFont, 'B', 12);
        // 在标题矩形内居中显示标题文本
            $titleText = ' 企业资质(如高新技术企业、创新型/科技型中小企业)';
            $pdf->Text(12, $pdf->GetY()+4, $titleText);

//=====表格

            $pdf->Ln(12); // 换行
            // 遍历表格数据
            foreach ($data as $key => $val) {
                // 检查是否需要换页
                if ($pdf->GetY() + 30 > $pdf->getPageHeight()) {
                    $pdf->AddPage(); // 换页        // 添加页眉图片
                    $pdf->Image($headerImgPath, 0, 0, $pageWidth, $headerImgHeight, '', '', '', false, 300, '', false, false, 0);
                    // 添加页脚图片
                    $pdf->Image($footerImgPath, 0, 267, $pageWidth, $footerImgHeight, '', '', '', false, 300, '', false, false, 0);
                    $pdf->SetFont($titleFont, '', 8);
                    $pdf->SetTextColor(144, 144, 144);
                    $pdf->Text($pdf->GetX()+8, $pdf->GetY()+2, $qy_data['Name']);
                    $pdf->Ln(12);
                }
                // 设置字体
                $pdf->SetTextColor(0,0,0);
                $pdf->SetFont($titleFont, '', 8);

                $pdf->SetFillColor(244, 244, 244); // 淡灰色背景
                // 创建单元格
                $pdf->Cell(30, 10, '资质名称', 1, 0, 'C', 1);
                $pdf->SetFillColor(255, 255, 255); // 白色背景
                // 创建单元格
                $pdf->Cell(65, 10, $val['Name'], 1, 0, 'L', 1);
                $pdf->SetFillColor(244, 244, 244); // 淡灰色背景
                // 创建单元格
                $pdf->Cell(30, 10, '级别', 1, 0, 'C', 1);
                $pdf->SetFillColor(255, 255, 255); // 白色背景
                // 创建单元格
                $pdf->Cell(65, 10, $val['Level'], 1, 1, 'L', 1);
                $pdf->SetFillColor(244, 244, 244); // 淡灰色背景
                // 创建单元格
                $pdf->Cell(30, 10, '来源', 1, 0, 'C', 1);
                $pdf->SetFillColor(255, 255, 255); // 白色背景
                // 创建单元格
                $pdf->Cell(65, 10, $val['Source'], 1, 0, 'L', 1);
                $pdf->SetFillColor(244, 244, 244); // 淡灰色背景
                // 创建单元格
                $pdf->Cell(30, 10, '发布单位', 1, 0, 'C', 1);
                $pdf->SetFillColor(255, 255, 255); // 白色背景
                // 创建单元格
                $pdf->Cell(65, 10, $val['PublishOffice'], 1, 1, 'L', 1);
                $pdf->Ln(2); // 换行
            }


//===================第二页======================
        $pdf->AddPage();
        // 添加页眉图片
        $pdf->Image($headerImgPath, 0, 0, $pageWidth, $headerImgHeight, '', '', '', false, 300, '', false, false, 0);
        // 添加页脚图片
        $pdf->Image($footerImgPath, 0, 267, $pageWidth, $footerImgHeight, '', '', '', false, 300, '', false, false, 0);
        $pdf->SetFont($titleFont, '', 8);
        $pdf->SetTextColor(144, 144, 144);
        $pdf->Text($pdf->GetX()+8, $pdf->GetY()+2, $qy_data['Name']);
        $pdf->Ln(12);

        //=============================
        // 设置背景颜色
        $pdf->SetFillColor($titleBackgroundColor[0], $titleBackgroundColor[1], $titleBackgroundColor[2]);
        // 设置文字颜色
        $pdf->SetTextColor($titleTextColor[0], $titleTextColor[1], $titleTextColor[2]);
        // 设置字体和字号
        $pdf->SetFont($titleFont, 'B', $titleFontSize);
        // 绘制带有背景颜色的矩形作为标题
        $pdf->Rect(10, 25, $titleWidth, $titleHeight, 'F');
        // 在标题矩形内居中显示标题文本
        $titleText = '企业评测结果概览';
        $pdf->Text(12, 29, $titleText);
        $pdf->Ln(); // 换行

        $scoreImg = 'https://******.png';
        $pdf->Image($scoreImg, 35, 45, 135, 45, '', '', 'C', false, 300, '', false, false, 0);
//============================分数================================
        $zongScore = Question::with(['record'])
            ->where(['gp_id' => 1, 'pid' => $row['record_id'], 'state' => 0, 'record.test_log_id' => $row['id']])
            ->order('sort','asc')
            ->sum('record.result_value');

        $pdf->SetTextColor(34, 84, 244);
        $pdf->SetFont($titleFont, '', 19);
        if($zongScore>99){
            $pdf->Text(48, 49, $zongScore); 
        }elseif($zongScore<10){
            $pdf->Text(53, 49, $zongScore);
        }else{
            $pdf->Text(50, 49, $zongScore); 
        }

        $pdf->SetTextColor(50, 113, 229);
        $pdf->SetFont($titleFont, '', 24);
        if($row['score']>100){
            $pdf->Text(92, 62, $row['score']);
        }else{
            $pdf->Text(96, 62, $row['score']); 
        }

        $pdf->SetTextColor(98, 199, 184);
        $pdf->SetFont($titleFont, '', 19);
        if($row['score']-$zongScore>99){
            $pdf->Text(131, 52, $row['score']-$zongScore);
        }else{
            $pdf->Text(133, 52, $row['score']-$zongScore);
        }

        $analysis = 'https://********.png';
        $pdf->Image($analysis, 10, 100, $titleWidth, 52, '', '', 'C', false, 300, '', false, false, 0);

        $pdf->SetTextColor(44,44,44);
        $pdf->SetFont($titleFont, '', 12);
        $zong = '本次报告测评结果分为【综合评汉分数】与【维度评测分数】两部分组成,总分为200分。在本次测评中,您的企业综合评测得分为X分,维度评测分数为Y分。您的综合评指标存在不足,上年度研发占比、上年度获得机构融资总额未满足,需有针对性地加强。维度评测得分<60分,专业化、精细化、特色化、创新力方面需有针对性地加强,经过专业辅导后可满足申报条件。如您的企业有申报需求,可在线咨询平台专家,专家会根据您报告得分的具体情况为您提供专业建议并制定申报辅导方案。';
        $pdf->MultiCell(145, 0, $zong, 0, 'L', false, 1, 52, 103, true, 0, false, true, 0, 'T', false);

//=======================综合评测分数分析=======================================
        $pdf->SetFillColor($titleBackgroundColor[0], $titleBackgroundColor[1], $titleBackgroundColor[2]);
        // 设置文字颜色
        $pdf->SetTextColor($titleTextColor[0], $titleTextColor[1], $titleTextColor[2]);
        // 设置字体和字号
        $pdf->SetFont($titleFont, 'B', $titleFontSize);
        // 绘制带有背景颜色的矩形作为标题
        $pdf->Rect(10, 166, $titleWidth, $titleHeight, 'F');
        // 在标题矩形内居中显示标题文本
        $titleText = '综合评测分数分析';
        $pdf->Text(12, 170, $titleText);

//============================已满足条件分析==============
        $pdf->Ln(12); // 换行
//        $pdf->SetFont($titleFont, '', 12);
//        $pdf->SetFillColor(95, 183, 255);
//        $pdf->SetTextColor($titleTextColor[0], $titleTextColor[1], $titleTextColor[2]);
//        $pdf->Rect(10, 174, $titleWidth, $titleHeight-2, 'F');
//        $pdf->Text(12, 178, '已满足条件分析');

//        $pdf->Ln(14); // 换行

        // 设置字体
        $pdf->SetTextColor(0,0,0);
        $pdf->SetFont($titleFont, '', 8);

        // 表格数据
        $data = Question::with(['record'])
            ->where(['gp_id' => 1, 'pid' => $row['record_id'], 'state' => 0, 'record.test_log_id' => $row['id']])
            ->order('sort','asc')
            ->select();
//        echo json_encode($data);
//        $data = [
//            '从事特定细分市场时间达到2年以上',
//            '企业从事特定细分市场已有2年以上,满足条件。',
//        ];
        // 自定义排序函数,根据 result_value 的值进行排序
        usort($data, function($a, $b) {
            if ($a['record']['result_value'] > 0 && $b['record']['result_value'] <= 0) {
                return -1; // $a 在 $b 之前
            } elseif ($a['record']['result_value'] <= 0 && $b['record']['result_value'] > 0) {
                return 1; // $a 在 $b 之后
            } else {
                return 0; // 保持原来的顺序
            }
        });
//        echo json_encode($datas);

        // 遍历表格数据
        $is_true = 0;
        $is_false = 0;
        foreach ($data as $key => $val) {
            if($key < 6){
                //判断第6题是否选择正确,暂时用下面的空字符串和null判断
//                if($key == 5){
//                    $select_data = QuestionSelect::where(['record_id' => $val['record']['id']])->value('select_data');
//                    $val['record']['result_value']=1;
//                }
//==========已满足、未满足大标题
                // 检查是否需要换页
                if ($pdf->GetY() + 35 > $pdf->getPageHeight()) {
                    $pdf->AddPage(); // 换页        // 添加页眉图片
                    $pdf->Image($headerImgPath, 0, 0, $pageWidth, $headerImgHeight, '', '', '', false, 300, '', false, false, 0);
                    // 添加页脚图片
                    $pdf->Image($footerImgPath, 0, 267, $pageWidth, $footerImgHeight, '', '', '', false, 300, '', false, false, 0);
                    $pdf->SetFont($titleFont, '', 8);
                    $pdf->SetTextColor(144, 144, 144);
                    $pdf->Text($pdf->GetX()+8, $pdf->GetY()+2, $qy_data['Name']);
                    $pdf->Ln(12); // 换行
                }
                if($val['record']['result_value']>0 || ($val['record']['result_value']==0 && $val['record']['data'] === '')){
                    if($is_true == 0){
                        $pdf->Ln(); // 换行
                        $pdf->SetFont($titleFont, 'B', 12);
                        $pdf->SetFillColor(95, 183, 255);
                        $pdf->SetTextColor($titleTextColor[0], $titleTextColor[1], $titleTextColor[2]);
                        $pdf->Rect($pdf->GetX(), $pdf->GetY()-6, $titleWidth, $titleHeight-2, 'F');
                        $pdf->Text($pdf->GetX(), $pdf->GetY()-2, '  已满足条件分析');
                        $pdf->Ln(12); // 换行
                        $is_true = 1;
                    }
                    $pdf->SetTextColor(95, 188, 102);
                    $successImg = 'https://**********.png';
                }else{
                    if($is_false == 0){
                        $pdf->Ln(); // 换行
                        $pdf->SetFont($titleFont, 'B', 12);
                        $pdf->SetFillColor(95, 183, 255);
                        $pdf->SetTextColor($titleTextColor[0], $titleTextColor[1], $titleTextColor[2]);
                        $pdf->Rect($pdf->GetX(), $pdf->GetY()-6, $titleWidth, $titleHeight-2, 'F');
                        $pdf->Text($pdf->GetX(), $pdf->GetY()-2, '未满足条件分析');
                        $pdf->Ln(12); // 换行
                        $is_false = 1;
                    }
                    $pdf->SetTextColor(239, 56, 34);
                    $successImg = 'https://**********.png';
                }
                // 检查是否需要换页
                if ($pdf->GetY() + 35 > $pdf->getPageHeight()) {
                    $pdf->AddPage(); // 换页        // 添加页眉图片
                    $pdf->Image($headerImgPath, 0, 0, $pageWidth, $headerImgHeight, '', '', '', false, 300, '', false, false, 0);
                    // 添加页脚图片
                    $pdf->Image($footerImgPath, 0, 267, $pageWidth, $footerImgHeight, '', '', '', false, 300, '', false, false, 0);
                    $pdf->SetFont($titleFont, '', 8);
                    $pdf->SetTextColor(144, 144, 144);
                    $pdf->Text($pdf->GetX()+8, $pdf->GetY()+2, $qy_data['Name']);
                    $pdf->Ln(12); // 换行
                }
                $pdf->SetFillColor(233, 233, 233); // 淡灰色背景
                $pdf->Cell(10, 10, '', ['LTB' => ['width' => 0.1, 'color' => [233, 233, 233]]],0,'L',1);
                $pdf->SetFont($titleFont, '', 10);
                $pdf->Cell($titleWidth-30, 10, $val['name'], ['LTRB' => ['width' => 0.1, 'color' => [233, 233, 233]]], 0, 'L', 1);
                $pdf->SetTextColor(0, 0, 0);
                $pdf->Cell(20, 10, '', ['LTRB' => ['width' => 0.1, 'color' => [233, 233, 233]]], 1, 'L', 1);
                $pdf->Image($successImg, $pdf->GetX() + 3, $pdf->GetY()-8, 5);

                $pdf->SetFillColor(255, 255, 255); // 白色背景
                $pdf->SetTextColor(0, 140, 255);
                if($key == 5 && $val['record']['data'] === null){   //第六题没有分数判断data为null还是空字符串
                    $content = '企业已满足1.近三年获得过省级科技奖励,并排名前三2.近三年获得国家级科技奖励,并在获奖单位中排名前五3.近两年研发费用总额均值在1000万元以上4.近两年新增股权融资总额(合格机构投资者实缴金额)达到6000万元以上4.近三年进入“创客中国”中小企业创新创业大赛全国500强企业#其中一项或多项,满足条件。';
                    $contentHeight = $pdf->GetStringHeight($tWidth + 130,$content);
                    $rowHeight = max(10, $contentHeight); // 行高度,取标题和内容高度的最大值
                    $pdf->Cell(25, $contentHeight, '【大师兄点评】', ['LTB' => ['width' => 0.1, 'color' => [233, 233, 233]]],0,'L',0);
                    $pdf->SetTextColor(144, 144, 144);
                    $pdf->MultiCell($tWidth + 135, $rowHeight, $content, ['TRB' => ['width' => 0.1, 'color' => array(233, 233, 233)]], 'L', 0, 1,'', '', true, 0, false, true, $rowHeight, 'M');

                    $pdf->Ln(2); // 换行
                }elseif ($key == 5 && $val['record']['data'] === ''){
                    $content = '企业已满足1.近三年获得过省级科技奖励,并排名前三2.近三年获得国家级科技奖励,并在获奖单位中排名前五3.近两年研发费用总额均值在1000万元以上4.近两年新增股权融资总额(合格机构投资者实缴金额)达到6000万元以上4.近三年进入“创客中国”中小企业创新创业大赛全国500强企业#其中一项或多项,满足条件。';
                    $contentHeight = $pdf->GetStringHeight($tWidth + 130,$content);
                    $rowHeight = max(10, $contentHeight); // 行高度,取标题和内容高度的最大值
                    $pdf->Cell(25, $contentHeight, '【大师兄点评】', ['LTB' => ['width' => 0.1, 'color' => [233, 233, 233]]],0,'L',0);
                    $pdf->SetTextColor(144, 144, 144);
                    $pdf->MultiCell($tWidth + 135, $rowHeight, $content, ['TRB' => ['width' => 0.1, 'color' => array(233, 233, 233)]], 'L', 0, 1,'', '', true, 0, false, true, $rowHeight, 'M');
                }else{
                    $content = \app\admin\model\question\Tips::where(['group_id' => $val['standard_group'],'result_value' => $val['record']['result_value']])->value('content');
                    $contentHeight = $pdf->GetStringHeight($tWidth + 130,$content);
                    $rowHeight = max(10, $contentHeight); // 行高度,取标题和内容高度的最大值
                    $pdf->Cell(25, $rowHeight, '【大师兄点评】', ['LTB' => ['width' => 0.1, 'color' => [233, 233, 233]]],0,'L',0);
                    $pdf->SetTextColor(144, 144, 144);
                    $pdf->MultiCell($tWidth + 135, $rowHeight, $content, ['TRB' => ['width' => 0.1, 'color' => array(233, 233, 233)]], 'L', 0, 1,'', '', true, 0, false, true, $rowHeight, 'M');

                    $pdf->Ln(2); // 换行
                }
            }
        }

        //=======================维度评测分数分析=======================================
        $pdf->SetFillColor($titleBackgroundColor[0], $titleBackgroundColor[1], $titleBackgroundColor[2]);
        // 设置文字颜色
        $pdf->SetTextColor($titleTextColor[0], $titleTextColor[1], $titleTextColor[2]);
        // 设置字体和字号
        $pdf->SetFont($titleFont, 'B', $titleFontSize);
        // 绘制带有背景颜色的矩形作为标题
        $pdf->Rect($pdf->GetX(), $pdf->GetY()+4, $titleWidth, $titleHeight, 'F');
        // 在标题矩形内居中显示标题文本
        $titleText = '维度评测分数分析';
        $pdf->Text($pdf->GetX()+2, $pdf->GetY()+7, $titleText);

        //专业化
        $zScore = Question::with(['record'])
            ->where(['gp_id' => 2, 'pid' => $row['record_id'], 'state' => 0, 'record.test_log_id' => $row['id']])
            ->order('sort','asc')
            ->sum('record.result_value');
        //精细化
        $jScore = Question::with(['record'])
            ->where(['gp_id' => 3, 'pid' => $row['record_id'], 'state' => 0, 'record.test_log_id' => $row['id']])
            ->order('sort','asc')
            ->sum('record.result_value');
        //新颖化
        $xScore = Question::with(['record'])
            ->where(['gp_id' => 4, 'pid' => $row['record_id'], 'state' => 0, 'record.test_log_id' => $row['id']])
            ->order('sort','asc')
            ->sum('record.result_value');
        //特色化
        $tScore = Question::with(['record'])
            ->where(['gp_id' => 5, 'pid' => $row['record_id'], 'state' => 0, 'record.test_log_id' => $row['id']])
            ->order('sort','asc')
            ->sum('record.result_value');
//============================雷达图============================
        $pdf->Ln(); // 换行
//        // =================创建雷达图
        $values = array($jScore,$zScore,$xScore,$tScore);
        $graph = $this->createRadarGraph($values);

        // 将雷达图输出到缓冲区
        ob_start();
        $graph->Stroke();
        $imgData = ob_get_clean();

        // 将雷达图插入 PDF
        $pdf->Image('@' . $imgData, $pdf->GetX()+42, $pdf->GetY()+16, 100, 100, '', '', 'C', false, 300, '', false, false, 0);
// -----------------------四维度分数----------------------------------

        $pdf->SetTextColor(0, 0, 0);
        $pdf->SetFont($titleFont, 'B', 14);
        $pdf->Text(95, $pdf->GetY()+10, '精细化');
        $pdf->SetFont($titleFont, '', 10);
        $pdf->Text(95, $pdf->GetY()+10, '评分:');
        $pdf->SetTextColor(239, 56, 34);
        $pdf->Text(106, $pdf->GetY(), $jScore);
        $pdf->SetTextColor(0, 0, 0);
        $pdf->SetFont($titleFont, 'B', 14);
        $pdf->Text(45, $pdf->GetY()+38, '专业化');
        $pdf->SetFont($titleFont, '', 10);
        $pdf->Text(45, $pdf->GetY()+11, '评分:');
        $pdf->SetTextColor(239, 56, 34);
        $pdf->Text(56, $pdf->GetY(), $zScore);
        $pdf->SetTextColor(0, 0, 0);
        $pdf->SetFont($titleFont, 'B', 14);
        $pdf->Text(145, $pdf->GetY()-11, '特色化');
        $pdf->SetFont($titleFont, '', 10);
        $pdf->Text(145, $pdf->GetY()+10, '评分:');
        $pdf->SetTextColor(239, 56, 34);
        $pdf->Text(156, $pdf->GetY(), $tScore);
        $pdf->SetTextColor(0, 0, 0);
        $pdf->SetFont($titleFont, 'B', 14);
        $pdf->Text(95, $pdf->GetY()+40, '新颖化');
        $pdf->SetFont($titleFont, '', 10);
        $pdf->Text(95, $pdf->GetY()+10, '评分:');
        $pdf->SetTextColor(239, 56, 34);
        $pdf->Text(106, $pdf->GetY(), $xScore);

        //================
        $pdf->Ln(); // 换行
        $pdf->SetFillColor(237, 237, 237);
        $pdf->SetTextColor(0,0,0);
        $pdf->SetFont($titleFont, '', 12);
        // 绘制带有背景颜色的矩形作为标题
        $pdf->Rect($pdf->GetX(), $pdf->GetY()+4, $titleWidth, 20, 'F');
        // 在标题矩形内居中显示标题文本
        $titleText = '当前企业维度评分为';
        $pdf->Text(45, $pdf->GetY()+8, $titleText);
        $pdf->SetTextColor(239, 56, 34);
        $pdf->SetFont($titleFont, '', 18);
        $titleText = $zScore + $tScore + $xScore + $jScore;
        $pdf->Text(84, $pdf->GetY()-2, $titleText);
        $pdf->SetTextColor(0,0,0);
        $pdf->SetFont($titleFont, '', 12);
        $titleText = '分,评分高代表该维度指标最强,';
        $pdf->Text(93, $pdf->GetY()+2, $titleText);
        $titleText = '评分低代表该指标有待提高,详细分析见下方。';
        $pdf->Text(55, $pdf->GetY()+8, $titleText);
        $pdf->Ln(); // 换行

        //=========================各维度
        $pdf->AddPage(); // 换页
        $pdf->Image($headerImgPath, 0, 0, $pageWidth, $headerImgHeight, '', '', '', false, 300, '', false, false, 0);
        $pdf->Image($footerImgPath, 0, 267, $pageWidth, $footerImgHeight, '', '', '', false, 300, '', false, false, 0);
        $pdf->SetFont($titleFont, '', 8);
        $pdf->SetTextColor(144, 144, 144);
        $pdf->Text($pdf->GetX()+8, $pdf->GetY()+2, $qy_data['Name']);
        $pdf->Ln(12); // 换行

        $data = Question::with(['record'])
//            ->where(['gp_id' => ['in','2,3,4,5'], 'pid' => $row['record_id'], 'state' => 0, 'record.test_log_id' => $row['id']])
            ->where(['gp_id' => ['in','2,3,4,5'], 'pid' => $row['record_id'], 'state' => 0, 'record.test_log_id' => $row['id']])
            ->order('sort','asc')
            ->select();
//        return json_encode($data);
//1综合指标,2专业化,3精细化,4创新力,5特色化
        $wei = [
            0 => ['name'=>'专业化','score' => 25,'gScore' => $zScore],
            4 => ['name'=>'精细化','score' => 25,'gScore' => $jScore],
            8 => ['name'=>'新颖化','score' => 35,'gScore' => $xScore],
            12 => ['name'=>'特色化','score' => 15,'gScore' => $tScore],
        ];
        //==========
        $lastKey = count($data)-1;
        foreach ($data as $key => $val){
            // 检查是否需要换页
            if ($pdf->GetY() + 30 > $pdf->getPageHeight()) {
                $pdf->AddPage(); // 换页        // 添加页眉图片
                $pdf->Image($headerImgPath, 0, 0, $pageWidth, $headerImgHeight, '', '', '', false, 300, '', false, false, 0);
                // 添加页脚图片
                $pdf->Image($footerImgPath, 0, 267, $pageWidth, $footerImgHeight, '', '', '', false, 300, '', false, false, 0);
                $pdf->SetFont($titleFont, '', 8);
                $pdf->SetTextColor(144, 144, 144);
                $pdf->Text($pdf->GetX()+8, $pdf->GetY()+2, $qy_data['Name']);
                $pdf->Ln(8); // 换行
            }
            if($key == 0 || $key == 4 || $key == 8 || $key == 12){
                $pdf->Ln(2); // 换行
                $pdf->SetFillColor(95, 183, 255);
                $pdf->SetFont($titleFont, '', 12);
                $pdf->SetTextColor($titleTextColor[0], $titleTextColor[1], $titleTextColor[2]);
                $pdf->Rect($pdf->GetX(), $pdf->GetY(), $titleWidth, $titleHeight-2, 'F');
                $pdf->Text($pdf->GetX()+4, $pdf->GetY()+4, $wei[$key]['name']);
//                $pdf->SetY($pdf->GetY()+4);
//                $pdf->Ln(); // 换行

//=========得分框======
                // 设置边框颜色和填充颜色
                $pdf->SetDrawColor(148, 172, 250);   // 边框颜色
                $pdf->SetFillColor(255,255,255);
                // 绘制圆角长方体的框
                $width = 50; // 框的宽度
                $height = 30; // 框的高度
                $pdf->RoundedRect(10, $pdf->GetY()+10, $width, $height, 2, '1111', 'DF');
//                $pdf->SetY($pdf->GetY()+$height+8);
                //得分
                $pdf->SetFont($titleFont, 'B', 32);
                $pdf->SetTextColor(0,0,0);
                if($wei[$key]['gScore']<=9){
                    $pdf->Text(30, $pdf->GetY()+15, $wei[$key]['gScore']);
                }else{
                    $pdf->Text(28, $pdf->GetY()+15, $wei[$key]['gScore']);
                }
                //满分
                $pdf->SetFont($titleFont, 'B', 12);
                $pdf->SetTextColor(118, 118, 119);
                $pdf->Text(24, $pdf->GetY()+15, '满分 '.$wei[$key]['score'] . ' 分');
//=========得分条======
                // 设置底部进度条的位置和尺寸
                $progressX = 80;
                $progressY = $pdf->GetY()-5;
                $progressWidth = 100;
                $progressHeight = 8;
                $cornerRadius = 2; // 圆角半径
                // 设置进度条颜色
                $progressColor = [71, 136, 255]; // 蓝色
                // 设置进度百分比(0-100)
                $progressPercentage = $wei[$key]['gScore'] / $wei[$key]['score'] * 100;
                // 计算实际进度条的宽度
                $actualProgressWidth = $progressWidth * ($progressPercentage / 100);
                // 绘制底部进度条背景(灰色部分)
                $pdf->SetFillColor(200, 200, 200); // 灰色
                $pdf->RoundedRect($progressX, $progressY, $progressWidth, $progressHeight, $cornerRadius, '1111', 'DF');
                // 绘制实际进度
                // 定义渐变颜色
//                $startColor = [173, 205, 255]; // 浅蓝色
//                $endColor = [71, 136, 255];      // 深蓝色
                // 创建线性渐变
//                $gradient = $pdf->LinearGradient($progressX, $progressY, $actualProgressWidth, $progressHeight, $startColor, $endColor);
//                $pdf->SetFillColor($gradient);
//                $pdf->SetFillColor($progressColor);
                if($wei[$key]['gScore'] != 0){
                    $pdf->RoundedRect($progressX, $progressY, $actualProgressWidth, $progressHeight, $cornerRadius, '1111', 'DF','',$progressColor);
                }

// 在进度条内显示数值
                $textX = $progressX + $actualProgressWidth - 8; // 设置文本位置的 x 坐标
                $textY = $progressY + $progressHeight / 2 - 14; // 设置文本位置的 y 坐标
                $pdf->SetFont($titleFont, '', 16);
                $pdf->SetTextColor(240, 74, 54);
                $pdf->Text($textX, $textY, $wei[$key]['gScore'] . ' 分');
                //进度条两边分数
                $pdf->SetFont($titleFont, '', 12);
                $pdf->SetTextColor(164, 164, 164);
                $pdf->Text($progressX - 12, $progressY+2, '0 分');
                $pdf->Text($progressX+103, $progressY+2, $wei[$key]['score'] . ' 分');

                $pdf->Ln(14); // 换行
            }

//========建议===
            $pdf->Ln(4); // 换行
            $pdf->SetFillColor(233, 233, 233); // 淡灰色背景
            $pdf->Cell(5, 10, '', ['LTB' => ['width' => 0.1, 'color' => [233, 233, 233]]],0,'L',1);
            $pdf->SetFont($titleFont, '', 10);
            $pdf->SetTextColor(0, 0, 0);
            $pdf->Cell($titleWidth-25, 10, $val['name'], ['LTRB' => ['width' => 0.1, 'color' => [233, 233, 233]]], 0, 'L', 1);
            $pdf->Cell(20, 10, '得分:'.intval($val['record']['result_value']).'分', ['LTRB' => ['width' => 0.1, 'color' => [233, 233, 233]]], 1, 'L', 1);

            // 检查是否需要换页
            if ($pdf->GetY() + 30 > $pdf->getPageHeight()) {
                $pdf->AddPage(); // 换页        // 添加页眉图片
                $pdf->Image($headerImgPath, 0, 0, $pageWidth, $headerImgHeight, '', '', '', false, 300, '', false, false, 0);
                // 添加页脚图片
                $pdf->Image($footerImgPath, 0, 267, $pageWidth, $footerImgHeight, '', '', '', false, 300, '', false, false, 0);
                $pdf->SetFont($titleFont, '', 8);
                $pdf->SetTextColor(144, 144, 144);
                $pdf->Text($pdf->GetX()+8, $pdf->GetY()+2, $qy_data['Name']);
                $pdf->Ln(12); // 换行
            }
            $contentHeight = $pdf->GetStringHeight($tWidth + 130,$val['option_answer']);
            $rowHeight = max(10, $contentHeight); // 行高度,取标题和内容高度的最大值
            $pdf->SetTextColor(106, 192, 112);
            $pdf->SetFont($titleFont, '', 10);
            $pdf->Cell(2, $rowHeight, '', ['LTB' => ['width' => 0.1, 'color' => [233, 233, 233]]],0,'L',0);
            $pdf->MultiCell($tWidth + 138, $rowHeight, '满分指标:'.$val['option_answer'], ['TB' => ['width' => 0.1, 'color' => array(233, 233, 233)]], 'L', 0, 0,'', '', true, 0, false, true, $rowHeight, 'M');
            $pdf->Cell(20, $rowHeight, '满分:'.$val['option_score'].'分', ['TRB' => ['width' => 0.1, 'color' => [233, 233, 233]]],1,'L',0);

            // 检查是否需要换页
            if ($pdf->GetY() + 30 > $pdf->getPageHeight()) {
                $pdf->AddPage(); // 换页        // 添加页眉图片
                $pdf->Image($headerImgPath, 0, 0, $pageWidth, $headerImgHeight, '', '', '', false, 300, '', false, false, 0);
                // 添加页脚图片
                $pdf->Image($footerImgPath, 0, 267, $pageWidth, $footerImgHeight, '', '', '', false, 300, '', false, false, 0);
                $pdf->SetFont($titleFont, '', 8);
                $pdf->SetTextColor(144, 144, 144);
                $pdf->Text($pdf->GetX()+8, $pdf->GetY()+2, $qy_data['Name']);
                $pdf->Ln(12); // 换行
            }
//=============特色化建议区分===
                if($val['gp_id'] == 5 && $key == $lastKey){
//                    echo $key.'==='.count($data);die;
                    if($tScore <= 4){
                        $result_value = 4;
                    }elseif($tScore > 4 && $tScore <= 10){
                        $result_value = 10;
                    }elseif($tScore > 10 && $tScore <= 15){
                        $result_value = 15;
                    }
                    $content = \app\admin\model\question\Tips::where(['group_id' => 'GP_5','result_value' => $result_value])->value('content');
                    $contentHeight = $pdf->GetStringHeight($tWidth + 130,$content);
                    $rowHeight = max(10, $contentHeight); // 行高度,取标题和内容高度的最大值
                    $pdf->SetTextColor(0, 140, 255);
                    $pdf->Cell(25, $rowHeight, '【大师兄建议】', ['LTB' => ['width' => 0.1, 'color' => [233, 233, 233]]],0,'L',0);
                    $pdf->SetTextColor(144, 144, 144);
                    $pdf->MultiCell($tWidth + 135, $rowHeight, $content, ['TRB' => ['width' => 0.1, 'color' => array(233, 233, 233)]], 'L', 0, 1,'', '', true, 0, false, true, $rowHeight, 'M');
                }elseif($val['gp_id'] != 5){
                    $content = \app\admin\model\question\Tips::where(['group_id' => $val['standard_group'],'result_value' => $val['record']['result_value']])->value('content');
                    $contentHeight = $pdf->GetStringHeight($tWidth + 130,$content);
                    $rowHeight = max(10, $contentHeight); // 行高度,取标题和内容高度的最大值
                    $pdf->SetTextColor(0, 140, 255);
                    $pdf->Cell(25, $rowHeight, '【大师兄建议】', ['LTB' => ['width' => 0.1, 'color' => [233, 233, 233]]],0,'L',0);
                    $pdf->SetTextColor(144, 144, 144);
                    $pdf->MultiCell($tWidth + 135, $rowHeight, $content, ['TRB' => ['width' => 0.1, 'color' => array(233, 233, 233)]], 'L', 0, 1,'', '', true, 0, false, true, $rowHeight, 'M');
                }


        }

        $pdf->Ln(17); // 换行
        // 检查是否需要换页
        if ($pdf->GetY() + 30 > $pdf->getPageHeight()) {
            $pdf->AddPage(); // 换页        // 添加页眉图片
            $pdf->Image($headerImgPath, 0, 0, $pageWidth, $headerImgHeight, '', '', '', false, 300, '', false, false, 0);
            // 添加页脚图片
            $pdf->Image($footerImgPath, 0, 267, $pageWidth, $footerImgHeight, '', '', '', false, 300, '', false, false, 0);
            $pdf->SetFont($titleFont, '', 8);
            $pdf->SetTextColor(144, 144, 144);
            $pdf->Text($pdf->GetX()+8, $pdf->GetY()+2, $qy_data['Name']);
            $pdf->Ln(12); // 换行
        }
        $pdf->SetTextColor(125, 125, 125);
        $content = '更详尽的专精特新企业分析报告,请联系平台客服400-123-123,或直接进入《专精特新专区》在线咨询,上千专家在线为您解读报告!';
        $pdf->MultiCell(145, 30, $content, 0, 'L');
        $imgPath = 'https://***********.png';
        $pdf->Image($imgPath, 170, $pdf->GetY()-40, 30, 30, '', '', 'C', false, 300, '', false, false, 0);

//Close and output PDF document
        $file = ROOT_PATH.'/public/uploads/'. $qy_data['report_number'] .'.pdf';

        $pdf->Output($file, 'FI');

上几个效果图

封面
企业信息
评测分析
雷达图
维度信息

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/71155.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

中心极限定理例题

关于大数定律的两个题目。 例1 注意牢记公式&#xff1a; P { X } P { ∑ i 1 n x i − n μ n σ < x } ∫ − ∞ x e − x 2 2 d x 2 π P\{ X\} P \{\frac { \sum_{i1}^{n} x_i - n \mu}{\sqrt {n} \sigma} < x \} \frac {\int _{-\infty} ^{x} e ^{- \frac {x^…

18.3.0:Dynamic Web TWAIN Crack Web 文档扫描 SDK

Dynamic Web TWAIN用于快速部署 Web 应用程序的文档扫描 SDK&#xff0c;文档扫描SDK&#xff0c;&#xff0c;超过 5300 家公司信任 Dynamic Web TWAIN &#xff0c;因其稳健性和安全性而受到超过 5300 家公司的信赖&#xff0c;Dynamic Web TWAIN 是一款基于浏览器的文档扫描…

项目架构简介

目录 1 单体应用架构 2 垂直应用架构 3 分布式架构 3.1 RPC 3.2 SOA 4 微服务架构 本文介绍后台应用的各种架构,以及各架构的优缺点对比 1 单体应用架构 将所有的代码功能都写在一个项目中(例如:MVC结构,SSM框架),同时打包,同时部署 优点:便于管理,减少开发、维护、运维成…

Git全栈体系(六)

第十章 自建代码托管平台-GitLab 一、GitLab 简介 GitLab 是由 GitLabInc.开发&#xff0c;使用 MIT 许可证的基于网络的 Git 仓库管理工具&#xff0c;且具有 wiki 和 issue 跟踪功能。使用 Git 作为代码管理工具&#xff0c;并在此基础上搭建起来的 web 服务。GitLab 由乌克…

类与对象(加深)

目录 1.类的6个默认成员函数 2. 构造函数 2.1 概念 2.2 特性 3.析构函数 3.1 概念 3.2 特性 4. 拷贝构造函数 4.1 概念 4.2 特征 5.赋值运算符重载 5.1 运算符重载 5.2 赋值运算符重载 6.const成员 7.取地址及const取地址操作符重载 1.类的6个默认成员函数 如果…

01 - 工作区、暂存区、版本库、远程仓库 - 以一次连贯的提交操作为例

1. 工作区、暂存区、版本库、远程仓库 以一次连贯的提交操作为例。 1.1 工作区 Git的工作区也就是我们平时编辑代码的目录文件夹。 新建一个kongfu_person.txt文件&#xff0c;工作区的变化&#xff1a; 1.2 工作区 > 暂存区&#xff1a;git add 1.3 暂存区 > 版本库…

【踩坑】最新亲测能用!修复MacOS安装软件时提示“应该移到废纸篓”并且无法打开软件

转载请注明出处&#xff1a;小锋学长生活大爆炸[xfxuezhang.cn] 目录 网上方法的尝试 方法一&#xff1a;xattr 方法二&#xff1a;UPX 真的能用的方法 GateKeeper_Helper.command的内容 网上方法的尝试 方法一&#xff1a;xattr 以前的Mac版本可以通过以下方式来解开限…

Gopeed-全平台开源高速下载器 支持(HTTP、BitTorrent、Magnet)协议

一、软件介绍 Gopeed&#xff08;全称 Go Speed&#xff09;&#xff0c;是一款由GolangFlutter开发的高速下载器&#xff0c;开源、轻量、原生&#xff0c;支持&#xff08;HTTP、BitTorrent、Magnet 等&#xff09;协议下载&#xff0c;并且支持全平台使用&#xff0c;底层使…

大华智慧园区综合管理平台文件上传漏洞复现(HW0day)

0x01 产品简介 “大华智慧园区综合管理平台”是一款综合管理平台&#xff0c;具备园区运营、资源调配和智能服务等功能。平台意在协助优化园区资源分配&#xff0c;满足多元化的管理需求&#xff0c;同时通过提供智能服务&#xff0c;增强使用体验。 0x02 漏洞概述 大华智慧园…

Android图形-合成与显示-SurfaceTestDemo

目录 引言&#xff1a; 主程序代码&#xff1a; 结果呈现&#xff1a; 小结&#xff1a; 引言&#xff1a; 通过一个最简单的测试程序直观Android系统的native层Surface的渲染显示过程。 主程序代码&#xff1a; #include <cutils/memory.h> #include <utils/L…

使用 PyTorch 逐步检测单个对象

一、说明 在对象检测任务中&#xff0c;我们希望找到图像中对象的位置。我们可以搜索一种类型的对象&#xff08;单对象检测&#xff0c;如本教程所示&#xff09;或多个对象&#xff08;多对象检测&#xff09;。通常&#xff0c;我们使用边界框定义对象的位置。有几种方法可以…

Ajax-概念、Http协议、Ajax请求及其常见问题

Ajax Ajax概念Ajax优缺点HTTP协议请求报文响应报文 Ajax案例准备工作express基本使用创建一个服务器 发送AJAX请求GET请求POST请求JSON响应 Ajax请求出现的问题IE缓存问题Ajax请求超时与网络异常处理Ajax手动取消请求Ajax重复发送请求问题 Ajax概念 AJAX 全称为Asynchronous J…

Python3 安装、环境变量配置、PyCharm新建Python项目

一、安装包下载 Pyhton官网下载>>最新稳定版的安装包&#xff1a; 找到合适的版本进行下载&#xff1a; 如果下载较慢&#xff0c;此处提供一个3.10.11的稳定版本的安装包&#xff1a; 链接&#xff1a;https://pan.baidu.com/s/16GnWjkGFuSfWfaI9UVX8qA?pwd4u5o 提取…

物联网的定义、原理、示例、未来

什么是物联网? 物联网 (IoT) 是指由嵌入传感器、软件和网络连接的物理设备、车辆、电器和其他物理对象组成的网络&#xff0c;允许它们收集和共享数据。这些设备(也称为“智能对象”)的范围可以从简单的“智能家居”设备(如智能恒温器)到可穿戴设备(如智能手表和支持RFID的服…

【C++入门到精通】C++入门 —— vector (STL)

阅读导航 前言一、vector简介1. 概念2. 特点 二、vector的使用1.vector 构造函数2. vector 空间增长问题⭕resize 和 reserve 函数 3. vector 增删查改⭕operator[] 函数 三、迭代器失效温馨提示 前言 前面我们讲了C语言的基础知识&#xff0c;也了解了一些数据结构&#xff0…

CTF之逆向之阿里巴巴

题目地址&#xff1a;http://www.shiyanbar.com/ctf/13 题目预览&#xff1a; 解题过程&#xff1a; 1、下载附件发现是exe文件 2、使用PEid和Detect It Easy查壳 和 开发语言&#xff0c;发现没有加壳&#xff0c;都是用C#开发的 3、C#和Java Python属于解释型语言&#xff…

Ajax 笔记(四)—— Ajax 进阶

笔记目录 4. Ajax 进阶4.1 同步代码和异步代码4.2 回调函数地狱4.2.1 解决方法一&#xff1a;Promise 链式调用4.2.2 解决方法二&#xff1a;async 函数和 await 4.3 Promise.all 静态方法4.4 事件循环4.4.1 事件循环4.4.2 宏任务与微任务 4.5 案例4.5.1 案例一-商品分类4.5.2 …

Vue响应式数据的原理

在 vue2 的响应式中&#xff0c;存在着添加属性、删除属性、以及通过下标修改数组&#xff0c;但页面不会自动更新的问题。而这些问题在 vue3 中都得以解决。 vue3 采用了 proxy 代理&#xff0c;用于拦截对象中任意属性的变化&#xff0c;包括&#xff1a;属性的读写、属性的…

【Java】常用Stream API

常见 Stream 流表达式 总体结构图 一、两大类型 中间操作(Intermediate Operations) 中间操作是指在Stream上执行的操作, 它们返回一个新的Stream, 允许你链式地进行多个中间操作. 终端操作(Terminal Operations) 对Stream进行最终处理的操作, 当调用终端操作时, Stream会开始执…

[保研/考研机试] KY3 约数的个数 清华大学复试上机题 C++实现

题目链接&#xff1a; KY3 约数的个数 https://www.nowcoder.com/share/jump/437195121691716950188 描述 输入n个整数,依次输出每个数的约数的个数 输入描述&#xff1a; 输入的第一行为N&#xff0c;即数组的个数(N<1000) 接下来的1行包括N个整数&#xff0c;其中每个…
最新文章