Skip to content

RobotsAndPencils/ex-puppeteer-img

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PuppeteerImg

Wrapper for puppeteer-img. Generates screenshot of browser page at a given URL.

Installation

Install puppeteer-img with npm, using the following command:

npm i puppeteer-img -g

Then add the following dependency to your Elixir project

def deps do
  [
    {:puppeteer_img, "~> 0.1.3"}
  ]
end

Instructions

options = [
  type: "jpeg"
  path: "example.jpeg
]

case PuppeteerImg.generate_image("http://www.example.com", options) do
  {:ok, path} -> path # where "path" == final path where generated image is stored.
  {:error, error} -> error # where "error" == some error message.
end

Available Options

options = [
  type: "png", # The file type to generate. Options are "jpeg" or "png". Defaults to png.
  path: "/screenshots/example.png", # The file path to save the image to.
  width: 400, # The width of the browser viewport. Default is 800.
  height: 800 # The height of the browser viewport. Default is 600.
  scale_factor: 1 # Sets the device pixel scale factor when setting the viewport.  Defaults to 1.
]

About

Elixir Package to use the puppeteer-img command line tool to make website screenshots.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages