Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

puppeteer-screenshots

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

puppeteer-screenshots

Wrapper around Puppeteer for easier website screenshots.

  • 0.4.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
Maintainers
1
Weekly downloads
 
Created
Source

Puppeteer Screenshots

This package provides a simple way to take screenshots and PDFs of urls.

This is a wrapper around Google's Puppeteer package.

This package is in Alpha. This package follows SemVer.

Install

Install using

npm i puppeteer-screenshots

How to use

There is two ways to use puppeteer-screenshots, the first is by doing this in your app file

require('puppeteer-screenshots').init();

that way you can call your program from the command line like this

node app.js --url=https://www.google.com

and a screenshot will be made and into "image.png". You can optionally specify path with --path=/path/to/file.png.

The other way to use it is to do this

var ps = require('puppeteer-screenshots');

ps.screenshot({url: 'https://google.com', path: 'google.png'});

which will save a screenshot of Google in 'google.png'. Note that here we don't have the double hyphens as when using from the command line.

Options

The available options you can pass to 'puppeteer-screenshots' are as follows

--url - (required) the url to take screenshot of 
--path - (optional) the path to save the screenshot to, default is 'image.png' 
--viewportWidth - (optional) the viewport width, default value is 1280 pixels
--viewportHeight - (optional) the viewport height, default value is 768 pixels
--userAgent - (optional) the user agent to use
--mobile - (optional) if this is set to true it will use a mobile user agent and set the viewport width to 320px and the viewport height to 480px, note that this overrides viewportWidth, viewportHeight and userAgent
--pdf - (optional) if true saves the screenshot as pdf
--mediaTypePrint - (optional) if set emulates the media type as print
--hide - (optional) a comma separated list of css selectors of elements which to hide using JavaScript, e.g if there are any pop-ups you want to hide
--visibility (optional) a comma separated list of css selectors of elements which to hide using JavaScript this is different than `hide` in that it sets the visibility property to hidden rather than the display to none

Keywords

FAQs

Package last updated on 27 Jul 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc