https://github.com/aagam17/markdown-to-pdf-converter
This is a simple Node.js module that converts Markdown files to PDF.
https://github.com/aagam17/markdown-to-pdf-converter
Last synced: about 1 month ago
JSON representation
This is a simple Node.js module that converts Markdown files to PDF.
- Host: GitHub
- URL: https://github.com/aagam17/markdown-to-pdf-converter
- Owner: AAGAM17
- License: mit
- Created: 2023-12-21T07:39:36.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-21T11:07:39.000Z (over 1 year ago)
- Last Synced: 2024-03-23T01:23:49.606Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 42 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Markdown-to-PDF-Converter
This is a simple Node.js module that converts Markdown files to PDF. It uses `markdown-it` for Markdown to HTML conversion and `puppeteer` for HTML to PDF conversion.## Installation
You can install this package using npm:
```bash
npm install --save markdown-to-pdf-converter
```
https://www.npmjs.com/package/markdown-to-pdf-converterOr By Yarn:
```bash
yarn add markdown-to-pdf-converter
```This package has the following dependencies:
- `fs` and `path` (built-in Node.js modules)
- `markdown-it`
- `puppeteer`## Usage
Here's a simple example of how to use this module:
```javascript
const convertMarkdownToPDF = require('markdown-to-pdf-converter');const markdownFilePath = './path/to/your/markdown.md';
const pdfFilePath = './path/to/output.pdf';convertMarkdownToPDF(markdownFilePath, pdfFilePath);
```Replace `'./path/to/your/markdown.md'` and `'./path/to/output.pdf'` with the actual paths to your Markdown file and where you want the PDF to be saved, respectively.
## API
### `convertMarkdownToPDF(markdownFilePath, pdfFilePath)`
This function converts a Markdown file to a PDF file.
#### Parameters
- `markdownFilePath` (string): The path to the Markdown file to convert.
- `pdfFilePath` (string): The path where the generated PDF file should be saved.#### Returns
This function returns a Promise that resolves when the PDF file has been created successfully.
## License
This package is licensed under the MIT license.