Commit 7c46d40
Refactor: Reuse PDF class mPDF instance for single-page rendering
Instead of instantiating a second mPDF object inside
singlePageHtmlToPdfDownload(), build a PDF instance via the constructor and
reuse its $this->pdf. This leaves a single 'new Mpdf' call (and a single
SafeMpdfHttpClient guard) in the whole class.
To allow the zero-margin certificate layout through the constructor, the
constructor now honors 'margin_header'/'margin_footer' from $params instead of
hard-coding both to 8. Both still default to 8, so callers that don't pass
them are unaffected.
Behavior change: lp_tracking.php builds 'new PDF('A4', 'P', ['margin_footer' => 4, ...])';
that value was previously discarded (footer rendered at 8mm) and now takes
effect (4mm), matching the caller's original intent.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent becf842 commit 7c46d40
1 file changed
Lines changed: 17 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| |||
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
80 | | - | |
81 | | - | |
| 81 | + | |
| 82 | + | |
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
| |||
541 | 542 | | |
542 | 543 | | |
543 | 544 | | |
544 | | - | |
545 | | - | |
546 | | - | |
547 | | - | |
548 | | - | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
549 | 549 | | |
550 | 550 | | |
551 | 551 | | |
| |||
559 | 559 | | |
560 | 560 | | |
561 | 561 | | |
| 562 | + | |
562 | 563 | | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
572 | 569 | | |
573 | 570 | | |
574 | | - | |
575 | | - | |
| 571 | + | |
| 572 | + | |
576 | 573 | | |
577 | | - | |
| 574 | + | |
578 | 575 | | |
579 | | - | |
| 576 | + | |
580 | 577 | | |
581 | 578 | | |
582 | 579 | | |
| |||
0 commit comments