https://github.com/sonidelav/nest-micro-pdf-service
PDF Microservice based on NestJS
https://github.com/sonidelav/nest-micro-pdf-service
html2pdf microservice nestjs pdf puppeteer rest-api typescript
Last synced: 10 days ago
JSON representation
PDF Microservice based on NestJS
- Host: GitHub
- URL: https://github.com/sonidelav/nest-micro-pdf-service
- Owner: sonidelav
- Created: 2019-09-12T21:04:22.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-11-22T08:38:40.000Z (over 2 years ago)
- Last Synced: 2025-04-24T05:46:29.915Z (10 days ago)
- Topics: html2pdf, microservice, nestjs, pdf, puppeteer, rest-api, typescript
- Language: TypeScript
- Homepage:
- Size: 304 KB
- Stars: 11
- Watchers: 1
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
PDF Microservice
## Description
Is a HTML 2 PDF service powered by NestJS and Puppeteer (Headless Chrome)
## Installation
```bash
yarn install
```## Running the app
```bash
# development
yarn start# watch mode
yarn start:dev# production mode
yarn start:prod
```## Test
```bash
# unit tests
yarn test# e2e tests
yarn test:e2e# test coverage
yarn test:cov
```## Usage
### URL 2 PDF
```http
POST http://localhost:3000/pdf/render-url
``````js
{
"url": "https://www.google.gr", // Url to navigate and print to pdf.
"filename": "test.pdf", // Name of file to download.
"json": true, // false to force download stream file.
"options": {
"screen": false, // true for screen media and not print.
"page": {
"format": "A4", // Paper Format (A0, A1, A2 ...).
"landscape": false, // Orientation.
"height": null, // Custom Height of Page.
"width": null // Custom Width of Page.
}
}
}
```### HTML 2 PDF
```http
POST http://localhost:3000/pdf/render-html
``````js
{
"html": ".....", // HTML print when DOMReady event trigged.
"filename": "test.pdf", // Name of file to download.
"json": true, // false to force download stream file.
"options": {
"screen": false, // true for screen media and not print.
"page": {
"format": "A4", // Paper Format (A0, A1, A2 ...).
"landscape": false, // Orientation.
"height": null, // Custom Height of Page.
"width": null // Custom Width of Page.
}
}
}
```