įinal note: The Homepage is made with MVP.css and is super simple to use. The source can be found at and the working version checked out at. I used apidoc to create the documentation inline of my code, once I build the documentation it is available under /docs ( preview). It is very simple and consists of two endpoints: /api/shot and /api/pdf. By default, puppeteer will always start chromium with a new, empty page (or tab) with the url about:blank. ![]() It saves the screenshot locally to a file named 'google.png'. I decided to spawn up a simple NodeJS service with ExpressJS. This puppeteer script launches a new instance of headless chrome, navigates to the url ' and captures a screenshot of the page. The basics - a simple NodeJS application spawning a puppeteer controlled headless browser to capture screenshots and images from a website - where already in place, but now I wanted to make it a bit more versatile and consumable. ![]() ![]() I could have created a simple NodeJS application ( like described in this article) just to solve the problem at a time but thought: “Why do I not make it a simple service?”. Next, call page.screenshot() along with the path option to capture a screenshot of the page. The screenshot.png should be on the directory that you run the node offline-login-check.js command. As a developer I wanted to create a simple service which creates dynamic websites and have them easily sharable via screenshots and PDF. There are blurry edges on both the words and images within the snapshot, I am wondering if there are ways to increase the quality of the snapshot image using puppeteer without increasing the deviceScaleFactor, as I need the images to be of specific dimensions. By the way, the ads are probably not loaded because headless browsers might block them, and the video is not loaded because Puppeteer uses Chromium which does not support the rendering of MP4 videos.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |