fix disable filigran
This commit is contained in:
parent
486357834b
commit
b2ff0cc6bd
@ -27,7 +27,7 @@ declare(strict_types=1);
|
||||
namespace OCA\Gestion\Service\InvoiceGroupPdfHandler;
|
||||
|
||||
use DateTime;
|
||||
use \FPDF;
|
||||
use FPDF;
|
||||
use OCA\Gestion\Helpers\FileExportHelpers;
|
||||
use OCA\Gestion\Helpers\PriceHelpers;
|
||||
|
||||
@ -54,11 +54,11 @@ class InvoiceGroupPdfHandler extends FPDF
|
||||
public $additionalArticlesLineBasedOnMultiline = 0;
|
||||
public $interLigneHeader = 5;
|
||||
|
||||
function Header()
|
||||
public function Header()
|
||||
{
|
||||
if ($this->logo != "nothing") {
|
||||
$this->Image($this->logoPath . "logo.png", 4, 2, 50, 35);
|
||||
$this->AddWatermark();
|
||||
//$this->AddWatermark();
|
||||
} else {
|
||||
$this->Cell(55, 30, '');
|
||||
}
|
||||
@ -66,7 +66,7 @@ class InvoiceGroupPdfHandler extends FPDF
|
||||
$this->DrawInvoiceCompanyAndClientInfo();
|
||||
$this->DrawInvoiceInfoTable();
|
||||
}
|
||||
function AddWatermark()
|
||||
public function AddWatermark()
|
||||
{
|
||||
try {
|
||||
$this->SetAlpha(0.2);
|
||||
@ -96,7 +96,7 @@ class InvoiceGroupPdfHandler extends FPDF
|
||||
|
||||
}
|
||||
|
||||
function SetAlpha($alpha)
|
||||
public function SetAlpha($alpha)
|
||||
{
|
||||
// Appliquer la transparence au document
|
||||
$this->SetFillColor(255, 255, 255, $alpha * 255);
|
||||
@ -111,7 +111,7 @@ class InvoiceGroupPdfHandler extends FPDF
|
||||
|
||||
}
|
||||
|
||||
function Footer()
|
||||
public function Footer()
|
||||
{
|
||||
$this->SetY(-34);
|
||||
$this->SetFont('Arial', '', 7);
|
||||
@ -467,7 +467,7 @@ class InvoiceGroupPdfHandler extends FPDF
|
||||
$this->DrawBankAndTotalPriceInfo();
|
||||
}
|
||||
|
||||
function MultiAlignCell($w, $h, $text, $border = 0, $ln = 0, $align = 'L', $fill = false)
|
||||
public function MultiAlignCell($w, $h, $text, $border = 0, $ln = 0, $align = 'L', $fill = false)
|
||||
{
|
||||
// Store reset values for (x,y) positions
|
||||
$x = $this->GetX() + $w;
|
||||
@ -482,19 +482,22 @@ class InvoiceGroupPdfHandler extends FPDF
|
||||
}
|
||||
}
|
||||
|
||||
function NbLines($w, $txt)
|
||||
public function NbLines($w, $txt)
|
||||
{
|
||||
// Compute the number of lines a MultiCell of width w will take
|
||||
if (!isset($this->CurrentFont))
|
||||
if (!isset($this->CurrentFont)) {
|
||||
$this->Error('No font has been set');
|
||||
}
|
||||
$cw = $this->CurrentFont['cw'];
|
||||
if ($w == 0)
|
||||
if ($w == 0) {
|
||||
$w = $this->w - $this->rMargin - $this->x;
|
||||
}
|
||||
$wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize;
|
||||
$s = str_replace("\r", '', (string) $txt);
|
||||
$nb = strlen($s);
|
||||
if ($nb > 0 && $s[$nb - 1] == "\n")
|
||||
if ($nb > 0 && $s[$nb - 1] == "\n") {
|
||||
$nb--;
|
||||
}
|
||||
$sep = -1;
|
||||
$i = 0;
|
||||
$j = 0;
|
||||
@ -510,22 +513,26 @@ class InvoiceGroupPdfHandler extends FPDF
|
||||
$nl++;
|
||||
continue;
|
||||
}
|
||||
if ($c == ' ')
|
||||
if ($c == ' ') {
|
||||
$sep = $i;
|
||||
}
|
||||
$l += $cw[$c];
|
||||
if ($l > $wmax) {
|
||||
if ($sep == -1) {
|
||||
if ($i == $j)
|
||||
if ($i == $j) {
|
||||
$i++;
|
||||
} else
|
||||
}
|
||||
} else {
|
||||
$i = $sep + 1;
|
||||
}
|
||||
$sep = -1;
|
||||
$j = $i;
|
||||
$l = 0;
|
||||
$nl++;
|
||||
} else
|
||||
} else {
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
return $nl;
|
||||
}
|
||||
|
||||
@ -534,38 +541,42 @@ class InvoiceGroupPdfHandler extends FPDF
|
||||
{
|
||||
$k = $this->k;
|
||||
$hp = $this->h;
|
||||
if ($style == 'F')
|
||||
if ($style == 'F') {
|
||||
$op = 'f';
|
||||
elseif ($style == 'FD' || $style == 'DF')
|
||||
} elseif ($style == 'FD' || $style == 'DF') {
|
||||
$op = 'B';
|
||||
else
|
||||
} else {
|
||||
$op = 'S';
|
||||
}
|
||||
$MyArc = 4 / 3 * (sqrt(2) - 1);
|
||||
$this->_out(sprintf('%.2F %.2F m', ($x + $r) * $k, ($hp - $y) * $k));
|
||||
|
||||
$xc = $x + $w - $r;
|
||||
$yc = $y + $r;
|
||||
$this->_out(sprintf('%.2F %.2F l', $xc * $k, ($hp - $y) * $k));
|
||||
if (strpos($corners, '2') === false)
|
||||
if (strpos($corners, '2') === false) {
|
||||
$this->_out(sprintf('%.2F %.2F l', ($x + $w) * $k, ($hp - $y) * $k));
|
||||
else
|
||||
} else {
|
||||
$this->_Arc($xc + $r * $MyArc, $yc - $r, $xc + $r, $yc - $r * $MyArc, $xc + $r, $yc);
|
||||
}
|
||||
|
||||
$xc = $x + $w - $r;
|
||||
$yc = $y + $h - $r;
|
||||
$this->_out(sprintf('%.2F %.2F l', ($x + $w) * $k, ($hp - $yc) * $k));
|
||||
if (strpos($corners, '3') === false)
|
||||
if (strpos($corners, '3') === false) {
|
||||
$this->_out(sprintf('%.2F %.2F l', ($x + $w) * $k, ($hp - ($y + $h)) * $k));
|
||||
else
|
||||
} else {
|
||||
$this->_Arc($xc + $r, $yc + $r * $MyArc, $xc + $r * $MyArc, $yc + $r, $xc, $yc + $r);
|
||||
}
|
||||
|
||||
$xc = $x + $r;
|
||||
$yc = $y + $h - $r;
|
||||
$this->_out(sprintf('%.2F %.2F l', $xc * $k, ($hp - ($y + $h)) * $k));
|
||||
if (strpos($corners, '4') === false)
|
||||
if (strpos($corners, '4') === false) {
|
||||
$this->_out(sprintf('%.2F %.2F l', ($x) * $k, ($hp - ($y + $h)) * $k));
|
||||
else
|
||||
} else {
|
||||
$this->_Arc($xc - $r * $MyArc, $yc + $r, $xc - $r, $yc + $r * $MyArc, $xc - $r, $yc);
|
||||
}
|
||||
|
||||
$xc = $x + $r;
|
||||
$yc = $y + $r;
|
||||
@ -573,8 +584,9 @@ class InvoiceGroupPdfHandler extends FPDF
|
||||
if (strpos($corners, '1') === false) {
|
||||
$this->_out(sprintf('%.2F %.2F l', ($x) * $k, ($hp - $y) * $k));
|
||||
$this->_out(sprintf('%.2F %.2F l', ($x + $r) * $k, ($hp - $y) * $k));
|
||||
} else
|
||||
} else {
|
||||
$this->_Arc($xc - $r, $yc - $r * $MyArc, $xc - $r * $MyArc, $yc - $r, $xc, $yc - $r);
|
||||
}
|
||||
$this->_out($op);
|
||||
}
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ declare(strict_types=1);
|
||||
namespace OCA\Gestion\Service;
|
||||
|
||||
use DateTime;
|
||||
use \FPDF;
|
||||
use FPDF;
|
||||
use OCA\Gestion\Constants\MultipleFactureTypeConstant;
|
||||
use OCA\Gestion\Helpers\DateHelpers;
|
||||
use OCA\Gestion\Helpers\FileExportHelpers;
|
||||
@ -35,7 +35,6 @@ use OCA\Gestion\Helpers\PriceHelpers;
|
||||
|
||||
class InvoicePdfHandler extends FPDF
|
||||
{
|
||||
|
||||
private $multipleFactureData = [];
|
||||
private $factureData = [];
|
||||
private $logo = null;
|
||||
@ -49,17 +48,17 @@ class InvoicePdfHandler extends FPDF
|
||||
private $articleTablesHeight = 130;
|
||||
|
||||
public $interLigneHeader = 5;
|
||||
function Header()
|
||||
public function Header()
|
||||
{
|
||||
if ($this->logo != "nothing") {
|
||||
$this->Image($this->logoPath . "logo.png", 4, 2, 50, 35);
|
||||
$this->AddWatermark();
|
||||
//$this->AddWatermark();
|
||||
} else {
|
||||
$this->Cell(55, 30, '');
|
||||
}
|
||||
}
|
||||
|
||||
function AddWatermark()
|
||||
public function AddWatermark()
|
||||
{
|
||||
try {
|
||||
$this->SetAlpha(0.2);
|
||||
@ -89,7 +88,7 @@ class InvoicePdfHandler extends FPDF
|
||||
|
||||
}
|
||||
|
||||
function SetAlpha($alpha)
|
||||
public function SetAlpha($alpha)
|
||||
{
|
||||
// Appliquer la transparence au document
|
||||
$this->SetFillColor(255, 255, 255, $alpha * 255);
|
||||
@ -98,7 +97,7 @@ class InvoicePdfHandler extends FPDF
|
||||
}
|
||||
|
||||
|
||||
function Footer()
|
||||
public function Footer()
|
||||
{
|
||||
$this->SetY(-34);
|
||||
$this->SetFont('Arial', '', 7);
|
||||
@ -421,7 +420,7 @@ class InvoicePdfHandler extends FPDF
|
||||
$this->DrawBankAndTotalPriceInfo($totalPriceValue);
|
||||
}
|
||||
|
||||
function MultiAlignCell($w, $h, $text, $border = 0, $ln = 0, $align = 'L', $fill = false)
|
||||
public function MultiAlignCell($w, $h, $text, $border = 0, $ln = 0, $align = 'L', $fill = false)
|
||||
{
|
||||
// Store reset values for (x,y) positions
|
||||
$x = $this->GetX() + $w;
|
||||
@ -436,19 +435,22 @@ class InvoicePdfHandler extends FPDF
|
||||
}
|
||||
}
|
||||
|
||||
function NbLines($w, $txt)
|
||||
public function NbLines($w, $txt)
|
||||
{
|
||||
// Compute the number of lines a MultiCell of width w will take
|
||||
if (!isset($this->CurrentFont))
|
||||
if (!isset($this->CurrentFont)) {
|
||||
$this->Error('No font has been set');
|
||||
}
|
||||
$cw = $this->CurrentFont['cw'];
|
||||
if ($w == 0)
|
||||
if ($w == 0) {
|
||||
$w = $this->w - $this->rMargin - $this->x;
|
||||
}
|
||||
$wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize;
|
||||
$s = str_replace("\r", '', (string) $txt);
|
||||
$nb = strlen($s);
|
||||
if ($nb > 0 && $s[$nb - 1] == "\n")
|
||||
if ($nb > 0 && $s[$nb - 1] == "\n") {
|
||||
$nb--;
|
||||
}
|
||||
$sep = -1;
|
||||
$i = 0;
|
||||
$j = 0;
|
||||
@ -464,22 +466,26 @@ class InvoicePdfHandler extends FPDF
|
||||
$nl++;
|
||||
continue;
|
||||
}
|
||||
if ($c == ' ')
|
||||
if ($c == ' ') {
|
||||
$sep = $i;
|
||||
}
|
||||
$l += $cw[$c];
|
||||
if ($l > $wmax) {
|
||||
if ($sep == -1) {
|
||||
if ($i == $j)
|
||||
if ($i == $j) {
|
||||
$i++;
|
||||
} else
|
||||
}
|
||||
} else {
|
||||
$i = $sep + 1;
|
||||
}
|
||||
$sep = -1;
|
||||
$j = $i;
|
||||
$l = 0;
|
||||
$nl++;
|
||||
} else
|
||||
} else {
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
return $nl;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user