Skip to content

Commit

Permalink
Updated Fpdf2 to version 3.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentmuller committed Jan 30, 2025
1 parent 5ea5254 commit 0c3e48f
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 18 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"fakerphp/faker": "^1.0",
"google/recaptcha": "^1.0",
"imagine/imagine": "^1.0",
"laurentmuller/fpdf2": "^2.0",
"laurentmuller/fpdf2": "^3.0",
"laurentmuller/highcharts-bundle": "^2.0",
"phpoffice/phpspreadsheet": "^3.0",
"phpoffice/phpword": "^1.0",
Expand Down
12 changes: 6 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/Pdf/Colors/PdfDrawColor.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace App\Pdf\Colors;

use fpdf\Color\PdfRgbColor;
use fpdf\PdfDocument;

/**
Expand All @@ -22,7 +23,8 @@ class PdfDrawColor extends AbstractPdfColor
{
public function apply(PdfDocument $doc): void
{
$doc->setDrawColor($this->red, $this->green, $this->blue);
$color = PdfRgbColor::instance($this->red, $this->green, $this->blue);
$doc->setDrawColor($color);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion src/Pdf/Colors/PdfFillColor.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace App\Pdf\Colors;

use fpdf\Color\PdfRgbColor;
use fpdf\PdfDocument;

/**
Expand All @@ -22,7 +23,8 @@ class PdfFillColor extends AbstractPdfColor
{
public function apply(PdfDocument $doc): void
{
$doc->setFillColor($this->red, $this->green, $this->blue);
$color = PdfRgbColor::instance($this->red, $this->green, $this->blue);
$doc->setFillColor($color);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion src/Pdf/Colors/PdfTextColor.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace App\Pdf\Colors;

use fpdf\Color\PdfRgbColor;
use fpdf\PdfDocument;

/**
Expand All @@ -22,7 +23,8 @@ class PdfTextColor extends AbstractPdfColor
{
public function apply(PdfDocument $doc): void
{
$doc->setTextColor($this->red, $this->green, $this->blue);
$color = PdfRgbColor::instance($this->red, $this->green, $this->blue);
$doc->setTextColor($color);
}

/**
Expand Down
5 changes: 3 additions & 2 deletions src/Report/MemoryImageReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use App\Service\FontAwesomeImageService;
use App\Service\ImageService;
use App\Utils\FileUtils;
use fpdf\Color\PdfRgbColor;
use fpdf\Enums\PdfMove;
use fpdf\Enums\PdfRectangleStyle;
use fpdf\Enums\PdfTextAlignment;
Expand Down Expand Up @@ -243,10 +244,10 @@ private function renderDigits(): void

private function renderEllipses(): void
{
$this->setDrawColor(255, 0, 0);
$this->setDrawColor(PdfRgbColor::red());
$this->ellipse(30, 220, 20, 10);
$this->circle(65, 220, 10);
$this->setFillColor(0, 255, 0);
$this->setFillColor(PdfRgbColor::green());
$this->circle(65, 245, 10, PdfRectangleStyle::BOTH);
$this->ellipse(30, 245, 20, 10, PdfRectangleStyle::BOTH);
}
Expand Down
12 changes: 6 additions & 6 deletions vendor-bin/php-cs-fixer/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0c3e48f

Please sign in to comment.