Convert Markdown to PDF
Convert → Convert Markdown to PDF
The Convert Markdown to PDF API converts Markdown into a PDF. You send the Markdown as Base64 (docContent), docName (e.g. sample.md), mdFilePath (path inside ZIP if using ZIP; empty for single file), and IsAsync. The API returns the PDF (or 202 + Location for async). Use the tester below to try it; more details are in the sections that follow.
Try the Convert Markdown to PDF API
:::note Quick reference
Endpoint: POST /api/v2/ConvertMdToPdf · Required: api-key, docContent, docName, mdFilePath, IsAsync
:::
:::info Try it live Use the form below to send your API key and Markdown (Base64). Set doc name and md file path; the response is the PDF (or polling URL when async). No code required—fill the fields and click Send request. :::
Overview, parameters, and use cases
- Overview
- Parameters
- Use cases
What is Convert Markdown to PDF?
This endpoint converts Markdown content into a PDF. You provide the Markdown (Base64; single file or ZIP with mdFilePath for path inside ZIP), docName (e.g. sample.md), mdFilePath (empty for single file), and IsAsync. The API preserves headers, lists, code blocks, and links. Returns the PDF or a Location URL for async.
Key features
- Single or ZIP – One Markdown file or ZIP with mdFilePath for path inside ZIP.
- Formatting – Preserves headers, lists, code blocks, links.
- Async – IsAsync returns 202 with Location URL for polling.
:::tip Best for Use when you need PDFs from Markdown (docs, README, technical writing). For HTML use Convert HTML to PDF; for URL use Convert URL to PDF. :::
API parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| api-key | string | Yes | Your PDF4me API key, Base64 encoded. Get it from the dashboard. |
| docContent | base64 | Yes | Markdown file content (Base64). |
| docName | string | Yes | Name of the source Markdown file (e.g. sample.md). |
| mdFilePath | string | Yes | Path to .md file inside ZIP (empty for single file). |
| IsAsync | boolean | Yes | Enable asynchronous processing. |
When to use Convert Markdown to PDF
- Documentation – Convert README or docs from Markdown to PDF.
- Technical writing – Turn Markdown articles or guides into PDF.
- Pipelines – Generate Markdown then convert to PDF for distribution.
:::info Need the full API? For request/response schemas and code samples, see Convert Markdown to PDF in the PDF4me API docs. :::
Prerequisites
Before using this endpoint, make sure you have:
- A valid PDF4me API key (Get your API Key)
- A Markdown file in Base64 format
Response Format
The API returns a PDF document:
- Status 200: Markdown to PDF conversion completed immediately - binary PDF content in response body
- Status 202: Request accepted and processing asynchronously - use the Location header URL to poll for results
For asynchronous requests, poll the Location URL until status 200 is returned with the PDF document.