In all examples it is assumed that you imported this namespace at the top of your file
use Spatie\Browsershot\Browsershot;
Browsershot can read the HTML of a URL and do something with it, for example convert it to pdf
Browsershot::url('https://example.com')->save('example.pdf');
Alternatively, you can use an arbitrary html input, using the html
function:
Browsershot::html('<h1>Hello world!!</h1>')->save('example.pdf');
Here are the things that Browsershot can produce for you: