[Bug]: Regression in v4 migration - Missing scale(), pageBreakMode() issues, and margins() ignored
Description
After upgrading from Filament v3 to v4, several core configuration methods for Html2Media are either missing from the codebase or no longer functioning as they did in the previous version. This breaks existing PDF/Image generation workflows.
Technical Details
- Filament Version: v4.x
- Package Version: v2.1.2
- PHP Version: 8.2
Identified Issues
1. Missing scale() Method
In v3, scale($n) was used to adjust the zoom/resolution. In v4, calling this method results in a:
BadMethodCallException: Call to undefined method ...::scale()
It appears the method was removed from the Traits (Concerns) during the refactor.
2. pagebreak() vs pageBreakMode()
The transition from pagebreak() to pageBreakMode() is currently undocumented. Furthermore, passing standard CSS values (e.g., 'avoid') to pageBreakMode() does not seem to trigger the expected behavior in the resulting output.
3. margins() Refactor
The change from margin() (singular) to margins() (plural) appears to have broken the data mapping to the underlying driver. Even when defined, the output uses default/zero margins.
Reproduction
Code Snippet
// Updated namespace
use Torgodly\Html2Media\Actions\Html2MediaAction;
// This implementation worked in v3 but fails/ignores settings in v4
Html2MediaAction::make('print')
->content(fn ($record, array $data) => view('page', ['record' => $record, 'data' => $data]))
->scale(2) // ERROR: Method does not exist
->pageBreakMode('avoid-all') // ISSUE: No effect on output
->margins(10, 10, 10, 10) // ISSUE: Ignored by renderer
->savePdf()
);
[Bug]: Regression in v4 migration - Missing scale(), pageBreakMode() issues, and margins() ignored
Description
After upgrading from Filament v3 to v4, several core configuration methods for
Html2Mediaare either missing from the codebase or no longer functioning as they did in the previous version. This breaks existing PDF/Image generation workflows.Technical Details
Identified Issues
1. Missing
scale()MethodIn v3,
scale($n)was used to adjust the zoom/resolution. In v4, calling this method results in a:BadMethodCallException: Call to undefined method ...::scale()It appears the method was removed from the Traits (Concerns) during the refactor.
2.
pagebreak()vspageBreakMode()The transition from
pagebreak()topageBreakMode()is currently undocumented. Furthermore, passing standard CSS values (e.g.,'avoid') topageBreakMode()does not seem to trigger the expected behavior in the resulting output.3.
margins()RefactorThe change from
margin()(singular) tomargins()(plural) appears to have broken the data mapping to the underlying driver. Even when defined, the output uses default/zero margins.Reproduction
Code Snippet