Browsershot: Convert a webpage to an image or PDF using headless Chrome

The folks over at Spatie have just release Browsershot v3:

Browsershot is a PHP package which can convert a webpage to an image or pdf. The conversion is done behind the scenes by Puppeteer which controls a headless version of Google Chrome.

Conversion is easy-peasy, hence this example:

use Spatie\Browsershot\Browsershot;

// an image will be saved
Browsershot::url('https://example.com')
   ->save($pathToImage);

To save to a PDF give the target path a .pdf extension, or use the savePdf() method. Here’s an example with some more manipulations:

Browsershot::html($someHtml)
   ->paperSize($width, $height)
   ->margins($top, $right, $bottom, $left)
   ->save('example.pdf');

Don’t forget to install the required puppeteer:

npm install puppeteer

Browsershot →

Why does Chrome show a T-Rex when it’s offline?

With touching the topic “offline” in the previous post, I was reminded of the T-Rex that Chrome shows when it’s offline.

Most of us think it’s just a fun little pixel dinosaur which acts as facade for a game you can play whilst there’s no active internet connection, but there’s more to it.

The T-Rex is a reference to a scene from the 2007 film Meet the Robinsons. In it a T-Rex tries snapping up a boy, but fails at it due to his big head an little arms:

So the T-Rex in Chrome is there not because it’s a fun little pixel dinosaur, but BECAUSE IT CANNOT REACH THE BOY PAGE.

My inner geek rejoices 🙂

Servo: Next Generation Web Browser Engine by Mozilla and Samsung

Servo is an attempt to rebuild the Web browser from the ground up on modern hardware, rethinking old assumptions along the way. This means addressing the causes of security vulnerabilities while designing a platform that can fully utilize the performance of tomorrow’s massively parallel hardware to enable new and richer experiences on the Web. To those ends, Servo is written in Rust, a new, safe systems language developed by Mozilla along with a growing community of enthusiasts.

Written in Rust. No mention of what will happend to Gecko whatsoever in the announcement

Mozilla and Samsung Collaborate on Next Generation Web Browser Engine →
The Servo Parallel Browser Project (GitHub) →

Blink: A rendering engine for the Chromium project

blink

Google just announced it’ll fork Webkit for use with Chrome/Chromium as it has become too difficult to add features to it as Chrome uses quite a different multi-process architecture than other WebKit-based browsers:

When Chromium started, our goal was to change as little of WebKit as possible, easing integration with the WebKit codebase. With Blink we are excited to make large-scale architectural changes to the code, without having to worry about breaking other consumers of WebKit.

When Opera announced they’re dropping Presto in favor of Webkit, they actually meant Blink (src).

Blink →
Blink Announcement →

The Web as a Platform for Gaming

By leveraging this new JavaScript optimization technology (asm.js), Mozilla has been able to bring Epic’s Unreal Engine 3 to the Web. With this port, developers will soon be able to explore limitless possibilities when it comes to porting their popular gaming titles to the Web.

Mozilla is Unlocking the Power of the Web as a Platform for Gaming →

Bulletproof Demos thanks to Google Chrome Record Mode

Record modes let you record every request Chrome makes. Playback mode serves requests out of that recorded cache just as if they were being loaded on the spot. It doesn’t record where you click or what you open: everything will be served out of the recorded cache, even if your servers have exploded, a bug has been deployed, or the conference wifi has dropped out.

Bulletproof Demos →

OneTab extension for Chrome

onetab

Whenever you find yourself with too many tabs, click the OneTab icon to convert all of your tabs into a list. When you need to access the tabs again, you can either restore them individually or all at once.

Might be a good alternative when having about 100 tabs open and having to switch to an other profile/browser/build to keep things speedy …

OneTab extension for Chrome →