aboutsummaryrefslogtreecommitdiffstats

likha-pdf

a simple web app that converts markdown to pdf.

likha-pdf screenshot

features

  • markdown to pdf export
  • local browser image storage with markdown snippet insertion
  • paper size, margin, font, line spacing, and page number options
  • syntax-highlighted code blocks
  • always produces a pdf (reportlab fallback if weasyprint fails)

requirements

  • python 3.10+
  • system packages: libcairo2 libpango-1.0-0 libpangocairo-1.0-0 libgdk-pixbuf2.0-0 shared-mime-info
  • gunicorn (installed from requirements.txt)

image usage

  1. store an image locally from the page
  2. click insert into markdown
  3. generate pdf

run

local

python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cd src/
python3 app.py

production (vps + nginx)

cd src/
../.venv/bin/gunicorn \
    --bind 127.0.0.1:5001 \
    --worker-class gthread \
    --workers 1 \
    --threads 2 \
    --timeout 240 \
    --graceful-timeout 30 \
    --keep-alive 5 \
    --max-requests 300 \
    --max-requests-jitter 50 \
    --access-logfile - \
    --error-logfile - \
    app:app

nginx should reverse proxy to 127.0.0.1:5001 and pass:

  • X-Forwarded-For
  • X-Forwarded-Proto
  • X-Forwarded-Host