Skip to content

Commit

Permalink
Updated PDF-Enginge-Pre-Init Callback
Browse files Browse the repository at this point in the history
  • Loading branch information
ruff committed Oct 1, 2023
1 parent 414dfca commit 4d24be6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ $visualizer = new ZugferdVisualizer(static::$document);
$visualizer->setDefaultTemplate();
$visualizer->setPdfPreInitCallback(function (array $config, ZugferdVisualizer $visualizer) {
$config["orientation"] = "L";
return $config;
});
```

Expand Down
2 changes: 1 addition & 1 deletion src/ZugferdVisualizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ private function instanciatePdfEngine(): Mpdf
];

if (is_callable($this->mpdfPreInitCallback)) {
call_user_func($this->mpdfPreInitCallback, $config, $this);
$config = call_user_func($this->mpdfPreInitCallback, $config, $this);
}

$pdf = new Mpdf($config);
Expand Down
1 change: 1 addition & 0 deletions tests/testcases/VisualizerText.php
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ public function testPdfInitCallback(): void
$oldOrientation = $config["orientation"] ?? "P";
$config["orientation"] = "L";
$newOrientation = $config["orientation"];
return $config;
});
$visualizer->setPdfRuntimeInitCallback(function (Mpdf $mpdf, ZugferdVisualizer $visualizer) use (&$oldPdfVersion, &$newPdfVersion) {
$oldPdfVersion = $mpdf->pdf_version;
Expand Down

0 comments on commit 4d24be6

Please sign in to comment.