# page2pdf

> convert a page url to pdf

Latest version **0.2.2** (published 2017-07-19) · ISC license · 0 weekly downloads

## Install

```sh
npm install page2pdf
pnpm add page2pdf
yarn add page2pdf
bun add page2pdf
```

Provides the command `page2pdf`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.2 |
| Published | 2017-07-19 |
| First published | 2017-07-14 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | zenxds |
| Maintainers | zenxds |
| Keywords | pdf |

## Links

- npm: https://www.npmjs.com/package/page2pdf
- Repository: https://git@github.com/zenxds/page2pdf
- Homepage: https://github.com/zenxds/page2pdf#readme
- Issues: https://github.com/zenxds/page2pdf/issues
- npm.io page: https://npm.io/package/page2pdf

## Dependencies (4)

- [lodash](https://npm.io/package/lodash.md) ^4.17.4
- [commander](https://npm.io/package/commander.md) ^2.11.0
- [chrome-launcher](https://npm.io/package/chrome-launcher.md) ^0.3.1
- [chrome-remote-interface](https://npm.io/package/chrome-remote-interface.md) ^0.24.1

## Alternatives

- [@cantoo/pdf-lib](https://npm.io/package/@cantoo/pdf-lib.md) — 297.9K weekly downloads
- [datatables.net-buttons](https://npm.io/package/datatables.net-buttons.md) — 200.1K weekly downloads
- [@ckeditor/ckeditor5-export-pdf](https://npm.io/package/@ckeditor/ckeditor5-export-pdf.md) — 167.0K weekly downloads
- [scanbot-web-sdk](https://npm.io/package/scanbot-web-sdk.md) — 15.0K weekly downloads
- [@syncfusion/ej2-angular-pdfviewer](https://npm.io/package/@syncfusion/ej2-angular-pdfviewer.md) — 8.8K weekly downloads

## Recent versions

- 0.2.2 (latest) — 2017-07-19
- 0.2.1 — 2017-07-19
- 0.1.3 — 2017-07-18
- 0.1.2 — 2017-07-18
- 0.1.1 — 2017-07-14
- 0.1.0 — 2017-07-14

## README

# page2pdf

convert a page url to pdf, depend on chrome's printToPDF

## install

install chrome first

```
npm install -g page2pdf
```

```
// Linux
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb
sudo apt-get -f install
sudo apt-get install fonts-wqy-microhei // install a chinese font
```


## useage

```
page2pdf https://www.baidu.com
page2pdf https://www.baidu.com -o baidu.pdf
page2pdf https://www.baidu.com -o baidu.pdf --delay 3000
```

## options

```
-o              output file, default page2pdf.pdf
--delay         delay ms for js execute, default 2000

--disable-gpu   disable-gpu option for chrome
--no-sandbox    no-sandbox option for chrome
--chrome-path   path for chrome browser, most time you don't need to use this option
```

## docker deploy

```
install chrome

npm run pkg

wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb

mv google-chrome-stable_current_amd64.deb pkg

docker build .
```

see [pkg](https://github.com/zeit/pkg)

## known issue

* can't launch chrome in docker environment : use --no-sandbox flag，if problem still exists, add --cap-add=SYS_ADMIN or --privileged to docker run
* canvas foggy : you can use canvas.toDataURL("image/png", 1), transform canvas to a image

---
_Source: https://npm.io/package/page2pdf · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
