定制 rafaelssucupira/fpdf 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

rafaelssucupira/fpdf

最新稳定版本:1.2.0

Composer 安装命令:

composer require rafaelssucupira/fpdf

包简介

API do fpdf incrementada com algumas ferramentas

README 文档

README

API do fpdf incrementada com algumas ferramentas com Diag, Rotate, Sector, Tag encontradas em fpdf.org

Important

É necessário adiocionar as fontes customizadas dentro de vendor/setasign/font, Ex : Tahoma e etc...

Traits implementados

  • PDF_Rotate
  • PDF_Sector
  • PDF_Diag
  • PDF_Tag
  • PDF_Table

Exemplo

<?php
require_once("vendor/autoload.php");

use FPDF;
use ReportApp\PDF_Rotate;
use ReportApp\PDF_Sector;
use ReportApp\PDF_Diag;   
use ReportApp\PDF_Tag;


class PDF extends FPDF {
    use PDF_Rotate, PDF_Sector, PDF_Diag, PDF_Tag;

    function __construct() {

        parent::__construct();
    }   

    function header() {

        $this->SetFont('Arial','',20);
        $this->RotatedText(100,60,'Hello!',45);

        $data = array('Men' => 1510, 'Women' => 1610, 'Children' => 1400);

        //Pie chart
        $this->SetFont('Arial', 'BIU', 12);
        $this->Cell(0, 5, '1 - Pie chart', 0, 1);
        $this->Ln(8);

        $this->SetFont('Arial', '', 10);
        $valX = $this->GetX();
        $valY = $this->GetY();
        $this->Cell(30, 5, 'Number of men:');
        $this->Cell(15, 5, $data['Men'], 0, 0, 'R');
        $this->Ln();
        $this->Cell(30, 5, 'Number of women:');
        $this->Cell(15, 5, $data['Women'], 0, 0, 'R');
        $this->Ln();
        $this->Cell(30, 5, 'Number of children:');
        $this->Cell(15, 5, $data['Children'], 0, 0, 'R');
        $this->Ln();
        $this->Ln(8);
        
        $this->SetXY(90, $valY);
        
        $col1=array(100,100,255);
        $col2=array(255,100,100);
        $col3=array(255,255,100);
        $this->PieChart(100, 35, $data, '%l (%p)', array($col1,$col2,$col3));
        $this->SetXY($valX, $valY + 40);

        //Bar diagram
        $this->SetFont('Arial', 'BIU', 12);
        $this->Cell(0, 5, '2 - Bar diagram', 0, 1);
        $this->Ln(8);
        $valX = $this->GetX();
        $valY = $this->GetY();
        $this->BarDiagram(190, 70, $data, '%l : %v (%p)', array(255,175,100));
        $this->SetXY($valX, $valY + 80);
        
        $this->SetFont('Arial','',12);
        $text  = "Let's show... \n\n";
        $text .= " [This is a cell][and another cell]\n\n";
        $text .= "<This is a bold sentence> and another non bold sentence.";
        $this->WriteText($text);
        
    }

}

$pdf = new PDF();
$pdf->AddPage();
$pdf->Output();

?>

统计信息

  • 总下载量: 10
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-10-05