Convert Markdown to PDF with one REST call. Send CommonMark or GitHub Flavored Markdown (GFM), pick one of 11 built-in templates or bring your own CSS and HTML, and get a print-ready PDF back. Free to try, no credit card.
Three steps
Every conversion is a single POST to the Processor API md_to_pdf endpoint. The response body is the PDF.
Create a free account and copy the key from the dashboard. No credit card.
Send JSON with a markdown string, a raw text/markdown body, or a multipart request with images and fonts.
The response is the finished PDF. Write it to disk, store it, or stream it to the user.
This example will convert inline Markdown to a styled PDF using the default template.
Try it out in three steps
your_api_key_here with your Nutrient API key.result.pdf to view the generated document.curl -X POST https://api.nutrient.io/processor/md_to_pdf \ -H "Authorization: Bearer your_api_key_here" \ -H "Content-Type: application/json" \ -o result.pdf \ --fail \ -d '{ "markdown": "# Hello World\n\nThis is **bold** and *italic*.\n\n- Item one\n- Item two", "template": "built-in:default" }'curl -X POST https://api.nutrient.io/processor/md_to_pdf ^ -H "Authorization: Bearer your_api_key_here" ^ -H "Content-Type: application/json" ^ -o result.pdf ^ --fail ^ -d "{\"markdown\": \"# Hello World\n\nThis is **bold** and *italic*.\n\n- Item one\n- Item two\", \"template\": \"built-in:default\"}"package com.example.pspdfkit;
import java.io.File;import java.io.IOException;import java.nio.file.FileSystems;import java.nio.file.Files;import java.nio.file.StandardCopyOption;
import org.json.JSONObject;
import okhttp3.MediaType;import okhttp3.OkHttpClient;import okhttp3.Request;import okhttp3.RequestBody;import okhttp3.Response;
public final class PspdfkitApiExample { public static void main(final String[] args) throws IOException { final JSONObject json = new JSONObject() .put("markdown", "# Hello World\n\nThis is **bold** and *italic*.\n\n- Item one\n- Item two") .put("template", "built-in:default");
final RequestBody body = RequestBody.create( MediaType.parse("application/json"), json.toString() );
final Request request = new Request.Builder() .url("https://api.nutrient.io/processor/md_to_pdf") .method("POST", body) .addHeader("Authorization", "Bearer your_api_key_here") .addHeader("Content-Type", "application/json") .build();
final OkHttpClient client = new OkHttpClient() .newBuilder() .build();
final Response response = client.newCall(request).execute();
if (response.isSuccessful()) { Files.copy( response.body().byteStream(), FileSystems.getDefault().getPath("result.pdf"), StandardCopyOption.REPLACE_EXISTING ); } else { throw new IOException(response.body().string()); } }}using System;using System.IO;using System.Net.Http;using System.Text;using System.Text.Json;using System.Threading.Tasks;
namespace PspdfkitApiDemo{ class Program { static async Task Main(string[] args) { using var client = new HttpClient(); client.DefaultRequestHeaders.Add( "Authorization", "Bearer your_api_key_here" );
var payload = new { markdown = "# Hello World\n\nThis is **bold** and *italic*.\n\n- Item one\n- Item two", template = "built-in:default" };
var content = new StringContent( JsonSerializer.Serialize(payload), Encoding.UTF8, "application/json" );
var response = await client.PostAsync( "https://api.nutrient.io/processor/md_to_pdf", content );
if (response.IsSuccessStatusCode) { await using var stream = await response.Content.ReadAsStreamAsync(); await using var fileStream = File.Create("result.pdf"); await stream.CopyToAsync(fileStream); } else { Console.WriteLine(await response.Content.ReadAsStringAsync()); } } }}// This code requires Node.js. Do not run this code directly in a web browser.
const fs = require('fs')
const payload = JSON.stringify({ markdown: "# Hello World\n\nThis is **bold** and *italic*.\n\n- Item one\n- Item two", template: "built-in:default"})
;(async () => { try { const response = await fetch('https://api.nutrient.io/processor/md_to_pdf', { method: 'POST', headers: { 'Authorization': 'Bearer your_api_key_here', 'Content-Type': 'application/json' }, body: payload })
if (!response.ok) { console.log(await response.text()) return }
const buffer = Buffer.from(await response.arrayBuffer()) fs.writeFileSync('result.pdf', buffer) } catch (e) { console.error(e) }})()import requestsimport json
response = requests.post( 'https://api.nutrient.io/processor/md_to_pdf', headers={ 'Authorization': 'Bearer your_api_key_here', 'Content-Type': 'application/json' }, json={ 'markdown': '# Hello World\n\nThis is **bold** and *italic*.\n\n- Item one\n- Item two', 'template': 'built-in:default' }, stream=True)
if response.ok: with open('result.pdf', 'wb') as fd: for chunk in response.iter_content(chunk_size=8096): fd.write(chunk)else: print(response.text)<?php
$payload = json_encode([ 'markdown' => '# Hello World\n\nThis is **bold** and *italic*.\n\n- Item one\n- Item two', 'template' => 'built-in:default']);
$FileHandle = fopen('result.pdf', 'w+');
$curl = curl_init();
curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.nutrient.io/processor/md_to_pdf', CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_POSTFIELDS => $payload, CURLOPT_HTTPHEADER => array( 'Authorization: Bearer your_api_key_here', 'Content-Type: application/json' ), CURLOPT_FILE => $FileHandle,));
$response = curl_exec($curl);
curl_close($curl);
fclose($FileHandle);POST https://api.nutrient.io/processor/md_to_pdf HTTP/1.1Content-Type: application/jsonAuthorization: Bearer your_api_key_here
{ "markdown": "# Hello World\n\nThis is **bold** and *italic*.\n\n- Item one\n- Item two", "template": "built-in:default"}Send Markdown and receive a production-ready PDF. Choose from 11 built-in templates, or provide custom CSS and HTML templates for full control over the output.
Full CommonMark compliance with GitHub Flavored Markdown extensions: tables, task lists, alerts, footnotes, strikethrough, highlights, and syntax-highlighted code blocks.
Send JSON with inline Markdown, upload raw .md files, or use multipart for Markdown with images and custom fonts. Control page size, orientation, and margins.
Templates, CSS, and layout
Pick a template with the template parameter: eight built-in: report templates (built-in:default, built-in:minimal, built-in:corporate, built-in:elegant, built-in:executive, built-in:nordic, built-in:nordic-report, built-in:technical) and three presentation templates with larger type. Append your own rules with css; set page size, orientation, and margins with layout; and choose a code theme with markdown_options.syntax_highlight. For complete control, upload an HTML template with a {{content}} placeholder. See the template reference for page sizes and fonts.
{ "markdown": "# Q3 report\n\n| Region | Revenue |\n| --- | ---: |\n| EMEA | 1.2M |\n| NA | 2.4M |", "template": "built-in:corporate", "css": "h1 { color: #1a3b6e; }", "layout": { "orientation": "landscape", "margin": { "top": 20, "bottom": 20 } }, "markdown_options": { "syntax_highlight": { "theme": "github" } }}Where it fits
Markdown is what documentation tools, note apps, and large language models write. PDF is what customers, auditors, and printers accept. The API sits between the two, without a headless browser, a LaTeX install, or a Pandoc toolchain on your servers. Pair it with the PDF-to-Markdown API to go the other way: parse a PDF, edit or summarize the Markdown, and render it back to PDF.
Turn reports and briefings an LLM or agent drafted in Markdown into PDFs.
Export documentation, READMEs, release notes, and changelogs as PDF.
Render invoices and statements from templated Markdown.
Package knowledge base articles as PDFs for offline distribution.
Getting started
The Markdown-to-PDF API supports built-in templates, custom CSS overrides, uploaded images and fonts, and full HTML template control. Follow these steps in the guide to go from a basic conversion to a fully customized document.
Most common next steps
Related conversions:
Get started:
Platform resources:
Nutrient’s Markdown-to-PDF API converts Markdown text or .md files into PDF documents with a single REST call. It’s part of the Processor API, so it runs in Nutrient’s cloud and returns a finished PDF: no browser automation, LaTeX, or Pandoc to install and maintain.
Post the Markdown to https://api.nutrient.io/processor/md_to_pdf with your API key, and save the response body as a PDF. The samples on this page do it in shell, Windows shell, Python, JavaScript, Java, C#, and PHP. For options such as templates, CSS, page layout, and uploaded assets, read the Markdown-to-PDF guide.
Yes, Nutrient’s Markdown-to-PDF API is CommonMark compliant and supports the GFM extensions: pipe tables with column alignment, task lists, strikethrough, autolinks, alerts, footnotes, superscript, subscript, highlights, and description lists. Fenced code blocks get syntax highlighting.
Yes. Choose one of 11 built-in templates (eight report styles and three presentation styles), append custom CSS with the css parameter, set page size, orientation, and margins with layout, and pick a syntax-highlighting theme. Custom fonts and images are uploaded as multipart assets and referenced by file name. See the template reference.
Yes. Send an HTML template as the html part of a multipart request. The rendered Markdown is inserted at the {{content}} placeholder, and any uploaded stylesheets, fonts, or images can be referenced from the template. When an HTML template is used, the css parameter is ignored. See custom HTML templates.
Pandoc and the md-to-pdf npm package run on your machine and need a LaTeX distribution or a headless browser. Nutrient’s API runs the conversion in the cloud and returns a PDF over HTTPS, so there’s nothing to install on servers or in CI, and output is the same from every environment. Choose a local tool when the documents never leave your laptop; choose the API when conversions run inside an application, a pipeline, or an AI agent.
Yes. Agents call the Markdown-to-PDF endpoint directly over HTTPS with the same API key, from a script, a skill, or a tool definition. Nutrient MCP covers the build-based Processor operations and Data Extraction, not this endpoint. Markdown is the format most models write, so the API is a direct path from a generated draft to a shareable PDF.
Yes. A free Nutrient account includes an API key and $5 of usage every month to test the Markdown-to-PDF API, with no credit card required. Paid plans are listed on the API pricing page.
Nutrient’s infrastructure is SOC 2 Type 2 audited and GDPR compliant. See our privacy policy and security documentation for details on data handling.
All communication between your application and Nutrient is done via HTTPS to ensure your data is encrypted when it’s sent to us.
All payments are handled by Paddle. Nutrient DWS Processor API never has direct access to any of your payment data.
Create an account to get your DWS Processor API key and start making API calls.