Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/doggy8088/html-to-pdf
A simple HTML to PDF tool using Playwright
https://github.com/doggy8088/html-to-pdf
playwright
Last synced: about 2 months ago
JSON representation
A simple HTML to PDF tool using Playwright
- Host: GitHub
- URL: https://github.com/doggy8088/html-to-pdf
- Owner: doggy8088
- Created: 2021-09-02T07:01:44.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-09-02T14:30:06.000Z (over 3 years ago)
- Last Synced: 2024-12-19T22:55:34.124Z (about 2 months ago)
- Topics: playwright
- Language: JavaScript
- Homepage:
- Size: 2.93 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# html-to-pdf
This is a simple HTML to PDF tool using [Playwright](https://playwright.dev/).
## Usage
1. Download & Install
```sh
git clone https://github.com/doggy8088/html-to-pdf.git
cd html-to-pdfnpm install
```2. Put your HTML files to `./Manual/docs` folder.
3. Run this tool
```sh
npm start
```The PDF output will be located at `./Manual/pdf/` folder.
## Development Notes
1. Initialize package.json
```sh
npm init -y
```2. Install [Playwright](https://playwright.dev/)
```sh
npm i --save playwrightnpx playwright install
```3. Playwright Initialize
```js
const browser = await pw.chromium.launch({ headless: true });const context = await browser.newContext();
const page = await context.newPage();
// do something ...
await browser.close();
```