Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/cenfun/page-save-as

Page save as JPG/PNG/PDF
https://github.com/cenfun/page-save-as

jpg page pdf png puppeteer save

Last synced: 29 days ago
JSON representation

Page save as JPG/PNG/PDF

Awesome Lists containing this project

README

        

# Page Save As
> Page save as JPG/PNG/PDF

It uses Puppeteer([
puppeteer-chromium-resolver](https://github.com/cenfun/puppeteer-chromium-resolver)) API to save a page.

## Install
```
npm i page-save-as
```

## Node.js API
```
const PSA = require("page-save-as");
const option = await PSA({
url: "xxx",
name: "xxx",
type: "jpg/png/pdf"
});
```
see [test.js](./test/test.js)

## API Default Options
see [option.js](./lib/option.js)

## CLI
```sh
#global install:
npm i page-save-as -g
#execute command
psa --name filename --type jpg
#uses "npx psa ..." for local install
```

## CLI Options
* -n, --name `` save filename
* -t, --type `` file type: jpg(default)/png/pdf
* -w, --width `` page width
* -s, --scroll scroll to bottom
* -e, --edit edit mode")
* -o, --output `` output path
* -ds, --delay `` delay in seconds
* -ts, --timeout `` timeout in seconds

## CHANGELOG

* 1.0.5
* support local file
* updated PCR

* 1.0.4
* support edit for pdf format

* 1.0.3
* fixed filename

* 1.0.2
* fixed output
* added delay
* updated scroll logic
* updated edit complete logic
* updated puppeteer-chromium-resolver to latest

* 1.0.1
* fixed filename