Markdown to PDF Converter
Markdown to PDF Converter turns Markdown into a PDF in two server-side stages. First it converts GitHub Flavored Markdown to HTML, which you can review, copy or download as markdown-converted.html. Then it renders that HTML into an A4 PDF that opens in a new tab. Press Generate PDF alone to run both stages, and convert again after editing your Markdown.
Gunakan Markdown to PDF Converter
Markdown to PDF
Convert Markdown into sanitized HTML, then generate a clean PDF using the backend PDF renderer.
Input Markdown
Converted HTML
Baca Isi
Markdown in, PDF out, with the HTML step in plain sight
The Markdown to PDF Converter turns Markdown text into a PDF document you can save, print or attach. It does this in two visible stages. First your Markdown becomes HTML, which you can inspect, copy or download. Then that HTML is rendered into a PDF on the server and opened in a new browser tab. You can run the stages one at a time, or press a single button and let the tool do both.
Seeing the middle step is the point of this tool. When a PDF looks wrong, the HTML usually tells you why: a table that never became a table, an image path that does not resolve, or text that was stripped because it was raw HTML.
The pipeline, step by step
| Stage | Where it runs | What happens |
|---|---|---|
| 1. Markdown to HTML | Server | Your Markdown is posted to the site's Markdown endpoint and converted with the league/commonmark library using GitHub Flavored Markdown, so tables, strikethrough, autolinks and task lists are understood. Front matter at the top is dropped, raw HTML tags in the Markdown are stripped, and if Sanitize HTML is on the result is filtered by HTML Purifier. |
| 2. Review | Your browser | The HTML appears in the Converted HTML editor. The status card switches to HTML ready. |
| 3. HTML to PDF | Server | The HTML is posted to the site's HTML-to-PDF endpoint. The server cleans it again with HTML Purifier, downloads any remote images referenced by full URL and embeds them, wraps the fragment in a simple page with a sans-serif body style, and draws it onto PDF pages with the tc-lib-pdf library. |
| 4. Delivery | Server, then your browser | The PDF is written to the site's temporary folder under a long random file name and a link to it opens in a new tab. |
By default the page is A4 in portrait orientation with 10 mm margins. There are no paper size, margin or orientation controls in this tool.
Privacy and file handling
Both conversions run on the server, so your text leaves your device. The Markdown step returns its result without saving it. The PDF step does save a file: the finished PDF is placed in a temporary public folder so your browser can open it, under a random name that is hard to guess. Anyone who has that exact link can open the file until the site's automatic cleanup removes it. Download the PDF promptly, and do not use the tool for documents that must never be stored on a third-party server, even briefly.
Using the converter
Quick route
- Paste your Markdown into Input Markdown, or press Paste.
- Press Generate PDF. If no HTML exists yet, the tool converts the Markdown first and then builds the PDF.
- Allow the pop-up if your browser asks. The PDF opens in a new tab, where you can save or print it.
Careful route
- Paste your Markdown and decide on Sanitize HTML (on by default).
- Press Convert HTML and read the Converted HTML panel. Check that headings, lists and tables came through as expected.
- Optionally press Copy HTML or Download HTML, which saves
markdown-converted.html. - Press Generate PDF. With HTML already present, the tool sends that HTML straight to the PDF renderer.
Copy Input copies your Markdown and Clear empties both editors. The PDF status card reads Will convert first when there is no HTML yet and PDF can be generated once there is.
One habit that prevents stale PDFs
Generate PDF always uses whatever is currently in the Converted HTML panel. If you convert, then edit your Markdown, then press Generate PDF, the PDF is built from the old HTML and your edits are missing. After any change to the Markdown, press Convert HTML again before generating, or press Clear and paste the final text so the tool converts fresh.
Writing Markdown that prints well
- Use headings for structure.
#,##and###give the PDF clear visual hierarchy. - Prefer absolute image URLs. The server fetches images from full web addresses and embeds them. A relative path such as
./img/chart.pngpoints at nothing on the server and will not appear. - Keep tables narrow. A portrait A4 page has limited width, and wide tables get squeezed.
- Avoid raw HTML. Tags typed into the Markdown are stripped during the first stage, so inline styling, colour and custom layout will not reach the PDF.
- Test special characters. If your document relies on non-Latin scripts, emoji or unusual symbols, generate a short test PDF first and check that they render.
The Sanitize HTML switch in this tool
The switch controls only the first stage. With it on, the HTML shown in the panel is filtered against an allowlist of safe tags. With it off, you see the converter's raw output, which can include extras such as table alignment attributes and task-list checkboxes. Whatever you choose, the PDF stage sanitises the HTML again before rendering, so the PDF itself is always produced from cleaned markup. In practice, turning the switch off mainly changes what you see and download as HTML.
Who uses it
- Developers who keep documentation in Markdown and need a PDF for a client, a tender or an offline reader.
- Students and researchers who write notes in Markdown and need to hand in a PDF.
- Writers drafting in Markdown editors who want a quick, clean printable copy without installing Pandoc or LaTeX.
- Support teams turning knowledge-base articles into attachments.
Limitations
- Markdown input is limited to 200,000 characters per conversion.
- No user controls for paper size, orientation, margins, headers, footers or page numbers.
- No custom CSS or themes; the PDF uses a plain default style.
- The PDF renderer is not a browser engine, so complex layouts, floats and advanced CSS are not reproduced.
- Only images reachable at a full public URL can be embedded.
- The PDF opens in a new tab with a random file name; rename it when you save it.
- A pop-up blocker can stop the new tab from opening.
Related tools
If you also need a file that opens in Microsoft Word, use the Markdown to PDF/Word Converter. If you only need the HTML, the Markdown to HTML Converter adds a CommonMark option and a live preview.
Frequently Asked Questions
Pertanyaan yang Sering Diajukan
Komentar (0)
Jelaskan masalah yang Anda alami agar kami dapat menyelidikinya dan meningkatkan alat ini.