screenshotmachine / screenshotmachine-bash

Simple example how to call screenshot machine's API using bash (curl) script.

Home Page:https://www.screenshotmachine.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

screenshotmachine-bash

This demo shows how to call online screenshot machine API using simple bash script.

Installation

First, you need to create a free/premium account at www.screenshotmachine.com website. After registration, you will see your customer key in your user profile. Also secret phrase is maintained here. Please, use secret phrase always, when your API calls are called from publicly available websites.

Set-up your customer key and secret phrase (if needed) in the script:

CUSTOMER_KEY="PUT_YOUR_CUSTOMER_KEY_HERE"
SECRET_PHRASE="" #leave secret phrase empty, if not needed

Website screenshot API

Set the options to fulfill your needs:

URL="https://www.google.com"
DIMENSION="1366x768" # or "1366xfull" for full length screenshot
DEVICE="desktop"
FORMAT="png"
CACHE_LIMIT="0"
DELAY="2000"
ZOOM="100"

More info about options can be found in our Website screenshot API.

Usage

Make this script executable by setting executable permissions and then run:

./run.sh

Captured screenshot will be saved as output.png file in current directory.

Website to PDF API

Set the PDF options:

URL="https://www.google.com"
PAPER="letter"
ORIENTATION="portrait"
MEDIA="print"
BG="nobg"
DELAY="2000"
SCALE="50"

More info about options can be found in our Website to PDF API.

Usage

Make this script executable by setting executable permissions and then run:

./run_pdf.sh

Captured screenshot will be saved as output.pdf file in current directory.

License

The MIT License (MIT)