Sign inSign up

blakegt/html-md-to-pdf-api

By blakegt

•Updated over 1 year ago

Convert HTML or Markdown (MD) to PDF easily using an API

Image
API management
0

994

blakegt/html-md-to-pdf-api repository overview

⁠html-md-to-pdf-api

Easily convert HTML or Markdown (MD) to PDF using an API

⁠⭐ Quick Start

Download and install⁠ Docker

šŸ‘‰šŸ» Start in developer mode:

⁠Port: 3000
pnpm dev

šŸ‘‰šŸ» Use with docker:

docker run --restart unless-stopped -dp 9000:3000 --name container-name blakegt/html-md-to-pdf-api:latest

ā šŸ“Ž Endpoint

Method POST / Header Content-Type: text/plain

⁠Query params
ParameterTypeDescriptionExample Values
sizestringDefines the paper size for the output PDF. Available options include letter, legal, tabloid, a0, a1, a2, a3, a4, a5, a6. For more see https://pptr.dev/api/puppeteer.lowercasepaperformat⁠a4, letter
marginnumberSpecifies the margin size (in millimeters) for the PDF document.10, 15, 20
outputstringDetermines the format of the output. Can be either pdf (for file download) or base64 (for base64-encoded string).pdf, base64
filenamestringThe desired name for the output file (only applicable if output=pdf).document.pdf
downloadnumberIndicates whether the PDF should be downloaded automatically (1) or just generated (0).1, 0
⁠CURL Example
curl --location 'http://localhost:3000?size=letter&margin=5&output=pdf&filename=document.pdf&download=0' \
--header 'Content-Type: text/plain' \
--data '<h1>Hello, World!</h1><p>This is an example HTML content for PDf conversion</p>'

Tag summary

Content type

Image

Digest

sha256:2a37f4351…

Size

743.9 MB

Last updated

over 1 year ago

docker pull blakegt/html-md-to-pdf-api