Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/spawnia/md-to-pdf
A web service for converting markdown to PDF
https://github.com/spawnia/md-to-pdf
markdown markdown-converter pandoc pdf pdf-generator
Last synced: 6 days ago
JSON representation
A web service for converting markdown to PDF
- Host: GitHub
- URL: https://github.com/spawnia/md-to-pdf
- Owner: spawnia
- License: mit
- Created: 2020-03-04T21:09:18.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-11-07T21:15:50.000Z (3 months ago)
- Last Synced: 2025-01-24T08:06:50.878Z (13 days ago)
- Topics: markdown, markdown-converter, pandoc, pdf, pdf-generator
- Language: Rust
- Homepage: https://md-to-pdf.fly.dev
- Size: 224 KB
- Stars: 100
- Watchers: 4
- Forks: 12
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# md-to-pdf
A web service for converting markdown to PDF
## Web UI
For quick experimentation, you can use [the web version](https://md-to-pdf.fly.dev) hosted on [Fly.io](https://fly.io).
Just paste your markdown and download the converted PDF.Availability of the service is not guaranteed, see [Fly.io status](https://status.flyio.net) when it is down.
If you need guaranteed availability, [deploy it yourself](#deploy).## API
You can convert markdown by sending a `POST` request to `https://md-to-pdf.fly.dev`.
```shell
curl --data-urlencode 'markdown=# Heading 1' --output md-to-pdf.pdf https://md-to-pdf.fly.dev
```| Parameter | Required | Description |
|------------|----------|-------------------------------------------------------------------------------------------------------|
| `markdown` | Required | The markdown content to convert |
| `css` | Optional | CSS styles to apply |
| `engine` | Optional | The PDF conversion engine, can be `weasyprint`, `wkhtmltopdf` or `pdflatex`, defaults to `weasyprint` |Send data from files like this:
```shell
curl --data-urlencode "markdown=$(cat example.md)"
```## Deploy
A prebuilt container image is available at [Docker Hub](https://hub.docker.com/r/spawnia/md-to-pdf).
The container starts up the web service and listens for HTTP on port 8000.You can run it yourself like this:
```shell
docker run --publish=8000:8000 spawnia/md-to-pdf
```You may configure the webserver through [Rocket environment variables](https://rocket.rs/guide/v0.5/configuration#environment-variables).
For example, you could allow larger payloads by increasing the limit for form data:```dotenv
ROCKET_LIMITS={form="1MiB"}
```## Built with
- [Rocket - a web framework for Rust](https://rocket.rs)
- [Pandoc - a universal document converter](https://pandoc.org)
- [Codemirror - a text editor for the browser](https://codemirror.net)