3.2.0 • Published 2 years ago

@runnerty/executor-puppeteer-export v3.2.0

Weekly downloads
5
License
MIT
Repository
github
Last release
2 years ago

NPM version Downloads Dependency Status

Puppeteer executor for Runnerty:

Puppeteer wrapper to export html to PDF/image with ejs template support.

Installation:

Through NPM

npm i @runnerty/executor-puppeteer-export

You can also add modules to your project with runnerty

npx runnerty add @runnerty/executor-puppeteer-export

This command installs the module in your project, adds example configuration in your config.json and creates an example plan of use.

If you have installed runnerty globally you can include the module with this command:

runnerty add @runnerty/executor-puppeteer-export

Configuration sample:

Add in config.json:

{
  "id": "puppeteer_default",
  "type": "@runnerty-executor-puppeteer-export"
}

Plan sample:

Add in plan.json:

{
  "id": "puppeteer_default",
  "html": "./workspace/templates/template_one.html",
  "pdf": {
    "path": "sample.pdf",
    "format": "a4",
    "printBackground": false
  }
}

Plan advanced:

Add in plan.json:

{
  "id": "puppeteer_default",
  "html": "./workspace/templates/template_one.html",
  "launch": {
    "headless": false,
    "executablePath": "/path/to/Chrome"
  },
  "authenticate": {
    "username": "my_usr_name",
    "password": "my_pass"
  },
  "userAgent": "Runnerty",
  "extraHTTPHeaders": {
    "my_header": "my_header_value"
  },
  "bypassCSP": false,
  "offlineMode": false,
  "cacheEnabled": true,
  "javaScriptEnabled": true,
  "cookie": {
    "name": "string",
    "value": "string"
  },
  "viewport": {
    "width": 1024,
    "height": 900
  },
  "geolocation": {
    "latitude": 36.6,
    "longitude": 2.36
  },
  "options": {
    "waitUntil": "load"
  },
  "pdf": {
    "path": "sample.pdf",
    "format": "a4",
    "printBackground": true,
    "margin": {
      "top": "20px",
      "left": "20px",
      "right": "20px",
      "bottom": "20px"
    }
  },
  "screenshot": {
    "path": "sample.png",
    "type": "png"
  },
  "args": {
    "subject": "Sample plan",
    "message": "Value for template one EJS var"
  }
}