mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-08-31 12:38:22 +00:00
:octocat: QRFpdf::dump(): allow using external FPDF instance
This commit is contained in:
@@ -109,15 +109,17 @@ class QRFpdf extends QROutputAbstract{
|
||||
* Initializes an FPDF instance
|
||||
*/
|
||||
protected function initFPDF():FPDF{
|
||||
return new FPDF('P', $this->options->fpdfMeasureUnit, $this->getOutputDimensions());
|
||||
$fpdf = new FPDF('P', $this->options->fpdfMeasureUnit, $this->getOutputDimensions());
|
||||
$fpdf->AddPage();
|
||||
|
||||
return $fpdf;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function dump(string $file = null):string|FPDF{
|
||||
$this->fpdf = $this->initFPDF();
|
||||
$this->fpdf->AddPage();
|
||||
public function dump(string $file = null, FPDF $fpdf = null):string|FPDF{
|
||||
$this->fpdf = ($fpdf ?? $this->initFPDF());
|
||||
|
||||
if($this::moduleValueIsValid($this->options->bgColor)){
|
||||
$bgColor = $this->prepareModuleValue($this->options->bgColor);
|
||||
|
||||
Reference in New Issue
Block a user