:octocat: allow base64 output for the fpdf module

This commit is contained in:
codemasher
2020-11-16 14:13:40 +01:00
parent ff09867c86
commit 9f0251b466
3 changed files with 7 additions and 1 deletions
+1
View File
@@ -13,6 +13,7 @@ $options = new QROptions([
'outputType' => QRCode::OUTPUT_FPDF,
'eccLevel' => QRCode::ECC_L,
'scale' => 5,
'imageBase64' => false,
'moduleValues' => [
// finder
1536 => [0, 63, 255], // dark (true)
+4
View File
@@ -102,6 +102,10 @@ class QRFpdf extends QROutputAbstract{
$this->saveToFile($pdfData, $file);
}
if($this->options->imageBase64){
$pdfData = sprintf('data:application/pdf;base64,%s', base64_encode($pdfData));
}
return $pdfData;
}
+2 -1
View File
@@ -77,7 +77,8 @@ class QRFpdfTest extends QROutputTestAbstract{
* @dataProvider types
*/
public function testRenderImage(string $type):void{
$this->options->outputType = $type;
$this->options->outputType = $type;
$this->options->imageBase64 = false;
// substr() to avoid CreationDate
$expected = substr(file_get_contents(__DIR__.'/samples/'.$type), 0, 2500);