Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
balaji-atoa committed Oct 29, 2024
1 parent 80decd8 commit 7433578
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[![npm version](https://badge.fury.io/js/puppe-pdf.svg)](https://badge.fury.io/js/puppe-pdf)
[![Node version](https://img.shields.io/node/v/puppe-pdf.svg?style=flat)](https://nodejs.org/download/)
![GitHub CI](https://github.com/balaji-atoa/puppe-pdf/actions/workflows/run-tests.yaml/badge.svg)
[![HitCount](https://hits.dwyl.com/balaji-atoa/puppe-pdf.svg?style=flat-square&show=unique)](http://hits.dwyl.com/balaji-atoa/puppe-pdf)
# puppe-pdf

convert HTML or any website to pdf flawlessly in seconds! puppe-pdf includes built-in TypeScript support, with type definitions provided for all exports.
Expand Down Expand Up @@ -33,13 +37,13 @@ const server = express()
const puppePdf = require('../src/index')
server.get('/', async (_, res) => {
const pdfBuffer = await puppePdf.forgePDF('https://pptr.dev/guides/what-is-puppeteer')
res.header('Content-Type', 'application/pdf')
res.status(200).send(pdfBuffer)
const pdfBuffer = await puppePdf.forgePDF('https://pptr.dev/guides/what-is-puppeteer')
res.header('Content-Type', 'application/pdf')
res.status(200).send(pdfBuffer)
})
server.listen(3000, () => {
console.log('Server initialized')
console.log('Server initialized')
})
```

Expand All @@ -64,16 +68,16 @@ Generates a PDF from a URL or HTML string, providing several customization optio
|-------------------------|---------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|
| `url` | `string` | The URL to visit for generating the PDF. Required if `html` is not provided. |
| `html` | `string` | HTML content to render directly on the page, which is faster than loading a URL. Required if `url` is not provided. |
| `launchOpts` | `LaunchOptions` | Puppeteer’s launch options for customizing the browser instance (headless mode, executable path, etc.). |
| `goToOptions` | `GoToOptions` | Options to configure Puppeteer’s `page.goto()` method, like navigation timeout or waitUntil conditions. |
| `launchOpts` | [LaunchOptions](https://pptr.dev/api/puppeteer.launchoptions) | Puppeteer’s launch options for customizing the browser instance (headless mode, executable path, etc.). |
| `goToOptions` | [GoToOptions](https://pptr.dev/api/puppeteer.gotooptions) | Options to configure Puppeteer’s `page.goto()` method, like navigation timeout or waitUntil conditions. |
| `waitForSelector` | `string` | CSS selector for an element that must be visible before the PDF generation begins. |
| `waitForSelectorOpts` | `WaitForSelectorOptions` | Options for waiting on the selector, such as visibility conditions and timeout. |
| `pdfOpts` | `PDFOptions` | Puppeteer’s PDF options, like page format, margins, and print background settings. |
| `waitForSelectorOpts` | [WaitForSelectorOptions](https://pptr.dev/api/puppeteer.waitforselectoroptions) | Options for waiting on the selector, such as visibility conditions and timeout. |
| `pdfOpts` | [PDFOptions](https://pptr.dev/api/puppeteer.pdfoptions) | Puppeteer’s PDF options, like page format, margins, and print background settings. |
| `saveToFile` | `boolean` | If `true`, saves the PDF to a file instead of returning it as a `Buffer`. Specify the file path in `pdfOpts`. |
| `raw` | `boolean` | When `true`, returns the PDF in `Uint8Array` format for direct binary manipulation. |
| `stream` | `boolean` | If `true`, returns the PDF as a readable stream instead of a `Buffer`. |
| `disableJavascript` | `boolean` | If `true`, disables JavaScript execution on the page, useful for static content. |
| `cookies` | `CookieParam[]` | List of cookies to inject into the page for authentication or session management. |
| `cookies` | [CookieParam[]](https://pptr.dev/api/puppeteer.cookieparam) | List of cookies to inject into the page for authentication or session management. |



Expand Down Expand Up @@ -103,9 +107,7 @@ Contributions are welcome! If you have ideas for new features, bug fixes, or gen
- **Clone your fork**: Clone the forked repository to your local machine.

```
git clone https://github.com/your-username/puppe-pdf.git
```

- **Make your changes**: Make changes directly in the `main` branch of your forked repository. Make sure to **add testcases**.
Expand Down

0 comments on commit 7433578

Please sign in to comment.