# Markdown to PDF Converter Hub

Turn markdown - including AI-generated markdown - into a professionally formatted PDF (and HTML). A free web tool, an open HTTP API, an MCP server, and the open-source ReportLab components behind it. No sign-up, no key.

Source: https://www.tigzig.com/markdown-to-pdf

## For AI agents & AI coders

Building with an AI coder (Claude Code, Cursor) or an agent? You do not need to read this page. Copy the block below and paste it to your AI - it points at the open repos and the live endpoints, and your AI can take it from there.

```
I want to turn AI-generated markdown / analysis into a professionally formatted PDF
(and HTML) report. Tigzig runs this free and open-source. Open repos:

BACKENDS (services):
- Markdown-to-PDF converter (FastAPI + ReportLab; reusable PDF components, side-by-side
  tables, embedded charts, custom styling): https://github.com/amararun/shared-reportlab-md-to-pdf
- Technical Analysis backend (indicators + charts + AI commentary -> report):
  https://github.com/amararun/shared-fastapi-mcp-technical-analysis

FRONTENDS (live tools):
- Quants Agent (React; an AI agent builds a technical-analysis report end to end):
  https://github.com/amararun/shared-portfolio-analysis-react
- Portfolio Analysis Suite (Google-AI-Studio UI): https://github.com/amararun/shared-portfolio-analysis-googleui

LIVE, no-auth endpoints:
- Markdown -> PDF (base https://mdtopdf.tigzig.com):
    POST /api/convert/text {content, filename}   -> PDF (standard)
    POST /text-input       {text, image_path}    -> {pdf_url, html_url} (report style: side-by-side + charts)
    POST /api/upload-image multipart file        -> {image_path}
    MCP: https://mcp-md-to-pdf.tigzig.com/mcp (tool convert_markdown_to_pdf)
- Technical Analysis report: https://ta.tigzig.com (docs /docs) · MCP https://ta.tigzig.com/mcp (tool create_technical_analysis)
- Quants backends (MCP): quantstats-h.tigzig.com/mcp, qrep-api.tigzig.com/v1/mcp/http, ffn.tigzig.com/mcp, yfin-h.tigzig.com/mcp

Read the repos, then help me: produce clean structured markdown from my data and POST it
to the right endpoint to get a formatted report.
```

- shared-reportlab-md-to-pdf: https://github.com/amararun/shared-reportlab-md-to-pdf - The Markdown-to-PDF converter service (FastAPI + ReportLab). The reusable PDF building blocks: headings, lists, tables, side-by-side layouts, embedded charts, custom report styling.
- shared-fastapi-mcp-technical-analysis: https://github.com/amararun/shared-fastapi-mcp-technical-analysis - The Technical Analysis backend (FastAPI + MCP): computes indicators and charts, gets AI commentary, and drives the converter to build a formatted report end to end. The showcase backend.

## What you get

One markdown-to-PDF engine, exposed four ways - pick whichever fits how you work:

- **Free web tool** - paste markdown or drop a `.md` file, download a PDF. [mdtopdf.tigzig.com](https://mdtopdf.tigzig.com). No sign-up, no key.

- **Open HTTP API** - POST markdown, get a PDF (or a hosted report). No auth. Call it from any app, script, or no-code tool.

- **MCP server** - mount it in Claude, Cursor or n8n and let an agent produce PDFs as a tool call.

- **Open source** - the whole thing is on GitHub (FastAPI + ReportLab). Run it as your own service, or reuse the components to build your own report format.

Under the hood it is **ReportLab** - the same engine that renders every report across Tigzig. That is the difference from a quick markdown-to-HTML-to-PDF route: precise, professional, paginated layout you control.

## Two report styles

The converter gives you two output styles. Choose by what you are making:

- **Standard** (`/api/convert`, `/api/convert/text`) - a clean document layout for any markdown. Headings, lists, tables, code, blockquotes. Returns the PDF file directly. Best for docs, notes, generic reports.

- **Report style** (`/text-input`) - a richer report template with **side-by-side tables** and **embedded charts**, plus custom styling. Saves both a PDF and an HTML version and returns their URLs (the report is hosted for you). Best for analytical reports - this is what the Technical Analysis app uses.

Both accept the same markdown; the report style just adds the layout and hosting.

## APIs & MCP

### Technical Analysis report
The showcase - generate a full technical-analysis report (indicators, charts, AI commentary) for any ticker. API + MCP; full endpoint reference in the API catalog. A dedicated docs page is coming.

- API ta.tigzig.com (API) - Generate a technical-analysis report for a Yahoo Finance ticker. Swagger at /docs, spec at /openapi.json. [body: ticker + date range (see /docs); returns: HTML report URL]
- MCP ta.tigzig.com/mcp (MCP) - Same, as an MCP tool for Claude / Cursor / n8n. [body: tool: create_technical_analysis; returns: HTML report URL]

### Quants Agent backends
The backends behind the Quants Agent and Portfolio Analysis Suite. All no-auth, each an API + an MCP server.

- MCP quantstats-h.tigzig.com/mcp (MCP) - QuantStats portfolio analysis - tearsheet-style performance report vs a benchmark. [body: tool: create_portfolio_analysis; returns: HTML + CSV report URLs]
- MCP qrep-api.tigzig.com/v1/mcp/http (MCP) - QRep - compare up to 6 securities with 80+ QuantStats metrics. [body: tool: mcp_compare_securities; returns: HTML / PDF report URLs]
- MCP ffn.tigzig.com/mcp (MCP) - Security Performance Review - multi-security performance & risk report. [body: tool: analyze_portfolio; returns: HTML report + CSV URLs]
- MCP yfin-h.tigzig.com/mcp (MCP) - Yahoo Finance extractor - prices, profile, financials (~15 endpoints). [body: MCP tools + REST (/docs); returns: JSON / Excel data]

### Markdown to PDF
The converter this page is about. Base https://mdtopdf.tigzig.com. Standard returns the PDF directly; Report returns hosted PDF + HTML URLs.

- POST /api/convert/text (Standard) - Markdown text -> PDF (clean standard layout). Returns the PDF file directly. [body: { "content": "# Title\n\nYour **markdown**...", "filename": "output.pdf" }; returns: PDF file (binary download)]
- POST /api/convert (Standard) - Markdown FILE (multipart) -> PDF (clean standard layout). Returns the PDF file directly. [body: multipart/form-data: file=<your.md>; returns: PDF file (binary download)]
- POST /text-input (Report) - AI-generated markdown -> report-styled PDF + HTML, with side-by-side tables and embedded charts. Returns URLs (the report is hosted for you). [body: { "text": "# Report\n\n![Chart](charts/daily.png)\n\n## Analysis...", "image_path": "daily.png" }; returns: { "pdf_url": "...", "html_url": "..." }]
- POST /api/upload-image (Report) - Upload a chart/image first; reference it in your markdown, then POST to /text-input. [body: multipart/form-data: file=<chart.png>; returns: { "image_id": "...", "image_path": "chart.png" }]
- MCP mcp-md-to-pdf.tigzig.com/mcp (MCP) - The same converter as an MCP tool, for Claude / Cursor / n8n. Give it markdown, get back a PDF URL. [body: tool: convert_markdown_to_pdf; returns: PDF URL]

## Reusable building blocks

The converter is built from ReportLab flowables that almost nobody packages up as a ready-to-use service. Markdown maps straight onto them:

- **Headings** (H1-H6), **paragraphs**, **bold / italic**, **horizontal rules**, **blockquotes**.

- **Lists** - bulleted and numbered, nested.

- **Tables** - standard layout, and **side-by-side** table blocks (two columns of data or two charts next to each other).

- **Images / charts** - upload a PNG, reference it in the markdown, and it is embedded and sized for the page.

- **HTML-in-markdown** - embedded HTML tables and tags are allowed through an allowlist sanitizer, so it is safe to feed raw AI output.

Want a different look? Fork [the repo](https://github.com/amararun/shared-reportlab-md-to-pdf) and define your own styles, page template, or a new endpoint for a fixed report format. The components do the heavy lifting.

## Send AI output, get a formatted report

The pattern this page exists for: take data, have an AI turn it into **structured markdown**, then POST that to the converter and get a report back. The trick is getting the AI to return clean markdown (not prose with a markdown sample buried in it).

**1. Ask the AI for markdown only.** Tell it: "Return only GitHub-flavored markdown. Use `##` headings for sections, `-` for bullets, `| a | b |` tables for any data, and `![caption](chart.png)` for charts. No preamble, no explanation." A tight format instruction is what makes this reliable.

**2. (Optional) upload charts.** If your report has images, POST each to `/api/upload-image` first and use the returned `image_path` in the markdown.

**3. POST the markdown.** Standard PDF: `/api/convert/text`. Report style with charts and side-by-side tables: `/text-input`.

```
import requests

# Standard: markdown text -> PDF (returns the file)
r = requests.post("https://mdtopdf.tigzig.com/api/convert/text",
 json={"content": ai_markdown, "filename": "report.pdf"})
open("report.pdf", "wb").write(r.content)

# Report style: markdown + chart -> hosted PDF + HTML (returns URLs)
img = requests.post("https://mdtopdf.tigzig.com/api/upload-image",
 files={"file": open("daily.png", "rb")}).json()["image_path"]
out = requests.post("https://mdtopdf.tigzig.com/text-input",
 json={"text": ai_markdown, "image_path": img}).json()
print(out["pdf_url"], out["html_url"])
```

For a full worked example - compute indicators, render charts, get AI commentary, upload, convert - read [the Technical Analysis repo](https://github.com/amararun/shared-fastapi-mcp-technical-analysis). It does exactly this against this converter.

## FAQ

### Is it really free? Do I need to sign up or get a key?
Yes, free. No sign-up and no API key. The web tool, the HTTP API and the MCP server are all open and no-auth. For heavy or private use, run it yourself - the whole thing is open source.

### What can it convert?
Markdown text or a .md file into a formatted PDF (and, in the report style, an HTML version too). It handles headings, lists, tables, code, blockquotes, horizontal rules and embedded images.

### Web tool vs API vs MCP - which should I use?
Web tool for a one-off (paste, download). API to wire it into an app, script or no-code flow. MCP to let an AI agent (Claude, Cursor, n8n) generate PDFs as a tool call.

### Are there rate limits?
There is per-IP concurrency limiting for fair use on the shared instance. For volume, self-host - it is one open-source FastAPI service.

### What is the difference between the standard and report styles?
Standard (/api/convert, /api/convert/text) returns a clean PDF directly. Report style (/text-input) adds side-by-side tables, embedded charts and custom styling, saves a PDF and an HTML version, and returns their URLs (hosted for you).

### When should I use /text-input vs /api/convert/text?
Use /text-input when you want the analytical report look (charts, side-by-side blocks, a hosted HTML version). Use /api/convert/text when you just want a clean PDF of some markdown, returned as a file.

### Can I get HTML as well as PDF?
Yes - the report style (/text-input) returns both a pdf_url and an html_url.

### How do I send AI-generated markdown to the converter?
POST it as JSON. Standard: {"content": "...markdown...", "filename": "out.pdf"} to /api/convert/text. Report style: {"text": "...markdown...", "image_path": "chart.png"} to /text-input. See the Python example above.

### How do I get an AI to return the right markdown format?
Be explicit in the prompt: "Return only GitHub-flavored markdown - ## headings, - bullets, | a | b | tables for data, ![caption](chart.png) for images. No preamble." A strict format instruction is the single biggest thing that makes this reliable.

### How do I make sure the AI returns a clean, structured response I can convert (not prose)?
Ask for markdown ONLY, with no surrounding explanation, and give it the exact section structure you want. If you need machine-checkable output, ask it to wrap the markdown in a fenced block or return a JSON field whose value is the markdown, then pass that field to the converter.

### Can the AI output include data tables?
Yes. Standard markdown pipe-tables render as tables. For two tables (or two charts) side by side, use the report style.

### My report is long and multi-section - is that OK?
Yes. Headings define the structure and the converter paginates across pages. Long analytical reports are the main use case.

### Is it safe to feed raw AI/LLM output straight in?
Yes. Embedded HTML is passed through an allowlist sanitizer (safe tags/attributes only), so an AI cannot inject a script or a fake login page into your PDF.

### How do I embed a chart or image?
Upload it to /api/upload-image first (multipart file). Use the returned image_path in your markdown as ![caption](image_path), then POST to /text-input.

### Can I put two charts side by side?
Yes - the report style supports side-by-side blocks. The Technical Analysis reports place daily / weekly / combined charts this way.

### What image formats are supported?
Standard raster images such as PNG. Uploads are validated as real images before they are accepted.

### Can I run it as my own service?
Yes. It is a single open-source FastAPI app: clone the repo, pip install -r requirements.txt, uvicorn main:app. Use it as the PDF backend for your own apps - that is exactly how Tigzig uses it.

### Is there an MCP server I can mount?
Yes: https://mcp-md-to-pdf.tigzig.com/mcp (Streamable HTTP), tool convert_markdown_to_pdf. Add it to Claude, Cursor or n8n and an agent can produce PDFs directly.

### Can I call it from Excel?
Yes - CORS is configured for xlwings (addin.xlwings.org), so you can POST markdown to it from Python-in-Excel and get a PDF back.

### Can I build my own fixed report format?
Yes. Fork the converter repo and add your own ParagraphStyle / page template / endpoint. The ReportLab flowables (paragraphs, tables, side-by-side frames, images) are reusable building blocks - you assemble them into your template.

### Can you show a real end-to-end example?
The Technical Analysis app computes indicators, renders daily/weekly/combined charts, gets Gemini commentary as markdown, uploads the charts to /api/upload-image, POSTs everything to /text-input, and returns a hosted PDF + HTML report. The full code is in the shared-fastapi-mcp-technical-analysis repo.

### What is the general data to AI to report pattern?
Data in -> ask the AI for structured markdown (and optionally render charts) -> (upload charts) -> POST the markdown to the converter -> get a formatted PDF/HTML report. The converter is the last, reusable step you do not have to build.

### Pre-formatted report vs generic - what is the difference?
The report endpoint (/text-input) is a pre-built styled template. The generic endpoints (/api/convert*) just render whatever markdown you send. For a different fixed format, fork and add your own endpoint/template.

### What libraries does it use?
ReportLab for the PDF, Python-Markdown to parse markdown, BeautifulSoup to handle embedded HTML. FastAPI serves it. Python 3.8+.

### Why ReportLab instead of the quick markdown route?
ReportLab gives precise, professional, paginated layout control - tables, side-by-side frames, image sizing, custom styles. It is the recommended engine and what runs every report backend on Tigzig.

## Live tools

- [Quants Agent](https://www.tigzig.com/n8n-tech-analysis) - AI agent builds a technical-analysis report
- [Portfolio Analysis Suite](https://www.tigzig.com/portfolio-analysis-suite) - QuantStats + performance + technical analysis
- [Markdown to PDF (web tool)](https://mdtopdf.tigzig.com) - The generic converter

## Repos & code

- [shared-reportlab-md-to-pdf](https://github.com/amararun/shared-reportlab-md-to-pdf) (Backend) - The Markdown-to-PDF converter service (FastAPI + ReportLab). The reusable PDF building blocks: headings, lists, tables, side-by-side layouts, embedded charts, custom report styling.
- [shared-fastapi-mcp-technical-analysis](https://github.com/amararun/shared-fastapi-mcp-technical-analysis) (Backend) - The Technical Analysis backend (FastAPI + MCP): computes indicators and charts, gets AI commentary, and drives the converter to build a formatted report end to end. The showcase backend.
- [shared-portfolio-analysis-react](https://github.com/amararun/shared-portfolio-analysis-react) (Frontend) - Quants Agent - the React front end where an AI agent builds a technical-analysis report end to end, running on the two backends above.
- [shared-portfolio-analysis-googleui](https://github.com/amararun/shared-portfolio-analysis-googleui) (Frontend) - Portfolio Analysis Suite - the combined front end (QuantStats, security performance, technical analysis), built with Google AI Studio.

These open-source repos ship with basic security checks built in. They are point-in-time snapshots, so for the most current security guidelines and hardening practices, see the continuously-updated checklist at tigzig.com/security .
