Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Freek Van der Herten:
Introducing Browsershot v3: the best way to convert html to PDFs and images
Oct 23, 2017 @ 14:13:57

In a new post to his site Freek Van der Herten has an announcement about the release of the latest stable version of the "Browsershot" package, version 3.

To convert html to a pdf or an image using wkhtmltopdf and wkhtmltoimage tends to be the popular option. Unfortunately those tools contain an outdated browser engine to do their thing, so you can’t use any newish css syntax. A while ago Google added a headless mode to Chrome. They’ve also released a javascript library called Puppeteer that gives you programmatic and fine grained control over Chrome.

Wouldn’t it be great if we could just use Chrome and Puppeteer to convert html to PDFs and images? Browsershot is package that does exactly that. In this post I’d like to introduce v3 of Browsershot, which was recently released.

He starts with some basic usage of the package, taking screenshots of example URLs and saving them locally as PDFs. Version 3 now has integration with Puppeteer to perform more complex logic on what parts of the page should be captured and how it should be saved. There's examples of this and a look behind the scenes at what the package is doing with the page grabs are called.

tagged: browsershot package screenshot puppeteer version3 release

Link: https://murze.be/2017/10/introducing-browsershot-v3-best-way-convert-html-pdfs-images/

Freek Van der Herten:
Easily convert webpages to images using PHP
Jul 03, 2017 @ 16:53:35

Freek Van der Herten has an article posted to his site showing how you can use the Browsershot package to convert web pages to images with a bit of PHP.

Browsershot is a package that can easily convert any webpage into a image. Under the hood the conversion is made possible new headless options in Chrome 59. In this post I’d like to show you how you can use Browsershot v2.

He starts with a bit of history about the package and the recent switch from PhantomJS (a now abandoned project) over to Chrome's screenshot handling for creating the web page captures. He then shows how to install Chrome 59, the first version to include this feature, into a unix-based environment. Next comes the package and some example code of it in use: making a simple capture, setting the window size, manipulate the image post-capture and change it to grayscale.

tagged: convert webpage image capture screenshot browsershot package

Link: https://murze.be/2017/07/easily-covert-webpages-to-images-using-php/


Trending Topics: