Skip to content

Add element capture for images and PDFs - #2

Merged
stevebauman merged 5 commits into
masterfrom
feature/element-capture
Oct 14, 2026
Merged

stevebauman merged 5 commits into
masterfrom
feature/element-capture

Conversation

@stevebauman

Copy link
Copy Markdown
Member

I've added element() so you can capture a specific part of an HTML document, Blade view, or URL:

$source = Screenshot::url($url)->element('#invoice');

$source->png()->save($imagePath);
$source->pdf()->save($pdfPath);

Images crop to the first matching element's bounds, including padding and borders. PDFs move the selected element into the document body and print it using the configured paper, margins, and print styles. Stylesheets are retained, but styles that depend on removed parent elements may need adjustment.

Each output builder keeps the selector chosen when it was created. Image clipping and PDF preparation live in their respective capture classes.

@stevebauman
stevebauman merged commit a006f77 into master Oct 14, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant