Skip to content
MarkdownUploadPDFSecurity

Upload Local Markdown Files and Convert to PDF in Your Browser

How to upload and convert local .md files to PDF without uploading to a server: drag-and-drop, file limits, encoding, and client-side processing.

Uploading a local Markdown file should not require sending proprietary documentation to a third-party server. Most web-based PDF converters ask you to upload your files to their backend, where your text is processed, stored, and potentially retained.

md2pdf uses the browser’s native FileReader API. When you select a local .md file or drag it onto the interface, the content is read directly into browser memory. Nothing leaves your device, making it safe for confidential specifications, client proposals, and internal notes.

This guide explains supported file formats, size boundaries, character encoding expectations, and how to troubleshoot upload issues. If you prefer pasting text directly, see Paste and edit Markdown for quick PDF generation.

How local file uploads work in md2pdf

The upload pipeline in md2pdf is strictly client-side. The file selection triggers a browser change event that processes the file stream locally:

const reader = new FileReader();
reader.onload = (e) => {
  const markdownText = e.target.result;
  renderMarkdownToPreview(markdownText);
};
reader.readAsText(file, 'UTF-8');

The parsed text immediately populates the editor scratchpad and renders into the live preview pane. Because no HTTP POST request is dispatched to an API endpoint, the conversion works seamlessly even when your workstation is disconnected from the internet.

Supported file types and extension rules

md2pdf recognizes common plain-text Markdown extensions:

  • .md — Standard Markdown format.
  • .markdown — Explicit Markdown extension.
  • .txt — Plain text files containing Markdown syntax.

Files with binary formats (such as .docx, .rtf, or pre-compiled .pdf) are rejected. If you have documentation in HTML or Word format, convert it to standard Markdown before opening it in md2pdf.

Client-side size limits and encoding

To keep browser tabs responsive, md2pdf enforces sensible processing limits:

  • Per-file maximum size: 2 MB of UTF-8 plain text.
  • Character encoding: UTF-8 without BOM (Byte Order Mark).
  • Line endings: Automatically normalizes both CRLF (\r\n) and LF (\n).

A 2 MB Markdown file contains approximately 300,000 words—far larger than most technical manuals. If a file exceeds 2 MB, the interface displays an error message recommending that you split the document or use the Multi-file Markdown book builder.

Step-by-step: Uploading and printing a local Markdown file

Follow these steps to turn a local document into a clean PDF:

  1. Open the md2pdf homepage and locate the converter toolbar.
  2. Click Upload Markdown or drag and drop your .md file directly onto the editor.
  3. Verify that the file content appears in the editor pane and renders in the preview window.
  4. Select your preferred print theme: Clean, Business, Academic, or Dark.
  5. Toggle the Table of Contents if your document contains three or more headings.
  6. Click Print / Save as PDF to open the browser print dialog.
  7. Select Save as PDF as your destination, verify margins, and save.

For detailed print dialog configuration, review Master browser print settings for Markdown PDFs.

Handling missing relative assets in local files

When you upload a single local Markdown file, relative links to local images (such as ![Architecture](./images/arch.png)) cannot be accessed by the browser due to filesystem sandboxing security.

To ensure images appear in your PDF:

  • Host the images on a secure HTTPS server or repository and use absolute web URLs.
  • Use Base64 data URIs directly within your Markdown for self-contained images.
  • If your images live in a GitHub repository, use the GitHub README importer instead of local upload.

Common upload errors and troubleshooting

  • File encoding corruption: If special characters render as question marks or scrambled glyphs, re-save your file in your editor with explicit UTF-8 encoding.
  • Large file freezing: Documents with massive raw SVG strings or hundreds of nested tables may slow down initial rendering. Remove inline SVGs or split chapters.
  • File not accepted: Ensure the file extension is .md or .txt. Renamed binary files will fail parser validation.

Upload your local Markdown documents with confidence using md2pdf today.

Make your own README PDF

Free, no login, and entirely client-side.

Open the converter