Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

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

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-pdf

npm 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 playwright

npx 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();
```