Printdown

Convert PDF, Word and slides to Markdown for AI and RAG

By ·

Chat assistants such as ChatGPT, Claude and Gemini can work with long documents, but the answer can only be as good as the text they receive. Copy text out of a PDF viewer and you get a line break at the end of every line, words cut in half by hyphens, page numbers in the middle of sentences and tables flattened into a stream of cells. Converting the file to Markdown first gives you clean text that keeps the document’s structure, and that you can check and trim before it goes anywhere. Here is what to expect from each file type, how to clean the result and how to use it in prompts and RAG.

Why Markdown is a good input format

  • Structure survives. Headings, lists and tables are marked with a few plain characters (##, -, |), so the hierarchy of the document is still there as text.
  • Little overhead. HTML wraps every element in tags and attributes; Markdown marks the same structure with a character or two, so more of what you send is actual content.
  • Headings are handles. You can point a model at “the Exceptions section”, ask it to cite the heading it used, or cut the file at each heading for retrieval.

What to expect from each file type

Open Any file to Markdown and drop a file. The result appears in an editable text box with Copy, Download .md and Open in editor → PDF buttons.

PDF

The PDF converter rebuilds paragraphs, headings and tables from the page layout, inferring headings from font size. Running headers and page numbers that repeat on every page are usually dropped, but the first copy of a header can stay at the top of the file. Words hyphenated at a line break come out split, as in con- tracts. Multi-column or heavily designed layouts need more cleanup, and pictures are not extracted.

Word

The Word converter keeps headings, bold and italic text, lists, tables, links and footnotes, and also reads old .doc files. Headings only come through if the document uses heading styles: a line of big bold text stays a bold paragraph. Word’s Title style and Heading 1 both become #, and the page headers and footers set in Word are left out. (If the document is going to GitHub rather than to a chat, see Turn a Word document into a GitHub README.)

PowerPoint, including speaker notes

The PowerPoint converter processes slides in order. Slide titles become ## headings, bullet points become lists, tables become Markdown tables and speaker notes are added as a blockquote after their slide:

## Why change pricing

- Small accounts churn in 90 days

- Seat-based plans confuse buyers

  - Competitors bundle onboarding

> Mention the three lost deals. Keep it under two minutes.

A slide without a title placeholder gets no heading, so its text ends up under the previous slide’s heading. Charts and SmartArt are not converted.

Excel, CSV and EPUB

The Excel converter turns each sheet into a table, with a ## Sheet name heading when there are several. Cells hold the last calculated value rather than the formula, displayed with the cell’s number format (5% rather than 0.05). CSV files use the first line as the header row, whatever the delimiter. An EPUB becomes one file in reading order with chapter headings; DRM-protected books cannot be read.

Long tables are easy to misread, for people and models alike: paste only the rows you need and check key figures against the original.

Clean-up checklist before you paste

Read the converted text once from top to bottom and fix these:

  • Leftover headers and boilerplate: a running header at the top, a cover page, confidentiality notices, a table of contents. A table of contents is headings without content: noise in a prompt, useless chunks in a knowledge base.
  • Stray page numbers or “Page 3 of 12” lines inside a paragraph.
  • Split words. Click Open in editor → PDF, click in the Markdown pane and press Ctrl+F (Cmd+F on a Mac). Tick regexp, search for (\p{Ll})- (\p{Ll}) and replace with $1$2. Review matches one by one: north-east broken at its own hyphen, or “pre- and post-war”, must keep the hyphen.
  • Fake headings: bold lines that are really section titles. Put ## in front of them.
  • Broken tables: compare PDF tables with the original. If one is beyond repair, copy it into a spreadsheet, save it as CSV and convert that.
  • Images: leave Include images off for AI work, so each picture is replaced by its alt text. With it on, the downloaded .md embeds pictures as base64 data: long runs of characters that fill the context and mean nothing to a text model. If a chart matters, describe it in a sentence.
  • Anything the model does not need, such as appendices, legal boilerplate or personal data.

A typical PDF result, straight from the converter:

Quarterly Business Review · Confidential

# Q3 Business Review

## Revenue

Sales grew everywhere except the north-east, where two con- tracts slipped.

And after clean-up:

# Q3 Business Review

## Revenue

Sales grew everywhere except the north-east, where two contracts slipped.

Prompt patterns that use the structure

Put the document first, inside clear delimiters, and your instructions and question after it. Asking for the section heading makes every answer easy to check:

Answer using only the document below. If the answer is not in it,
say so. After each answer, give the heading of the section you used.

<document>
# Refund policy
## Who can request a refund
…
</document>

Question: Can an enterprise customer get a refund after 45 days?

Other patterns that make use of Markdown:

  • Section by section: “Summarize each ## section in two bullet points and keep the headings.”
  • Speaker notes: “Lines starting with > are speaker notes. Turn each slide and its notes into a paragraph of a written report.”
  • Comparisons: paste two documents, each under its own # heading, and ask for a table of differences.
  • Long files: if a document does not fit in one message, send one ## section at a time rather than cutting at random.

Splitting Markdown into chunks for RAG

Retrieval-augmented generation (RAG) tools store a document as many small chunks and give the model only those that match a question. A chunk that starts halfway through one topic and ends halfway through the next matches poorly; headings are natural cut points.

  • Split at ## headings; split very long sections again at ### or between paragraphs.
  • Never cut inside a table, list or code block. If you must split a long table, repeat its header row.
  • Store the heading path with each chunk (Refund policy > Exceptions) so it makes sense on its own.
  • Keep the file name and date as metadata, so answers can point back to the source.
  • For slide decks, one slide per chunk usually works.

Many RAG frameworks and knowledge-base tools include a Markdown or heading-based splitter; the same rules apply. If yours does not, this Python script (standard library only) prints one JSON line per section:

import json, re, sys

def split_by_headings(md, max_level=2):
    """Cut Markdown at headings up to max_level (2 = # and ##)."""
    chunks, path, buf, in_code = [], [], [], False

    def flush():
        text = "\n".join(buf).strip()
        if text and not re.fullmatch(r"#{1,6}\s+.+", text):  # skip empty sections
            chunks.append({"section": " > ".join(t for _, t in path), "text": text})

    for line in md.splitlines():
        if line.lstrip().startswith(("```", "~~~")):
            in_code = not in_code
        m = None if in_code else re.match(r"(#{1,6})\s+(.+)", line)
        if m and len(m.group(1)) <= max_level:
            flush()
            level = len(m.group(1))
            path = [(l, t) for l, t in path if l < level] + [(level, m.group(2).strip())]
            buf = [line]
        else:
            buf.append(line)
    flush()
    return chunks

name = sys.argv[1]
with open(name, encoding="utf-8") as f:
    for chunk in split_by_headings(f.read()):
        print(json.dumps({"source": name, **chunk}, ensure_ascii=False))

Save it as split_md.py and run python split_md.py report.md > chunks.jsonl. Since Word’s Title style and Heading 1 both become #, change the extra # headings to ## first if you want the document title in every path.

Privacy: what stays on your device

The conversion runs inside your browser tab with WebAssembly; the file is never uploaded. That changes the moment you paste: the text then goes to the AI service you use, under its terms. Converting first lets you see every word you are about to share and delete names, account numbers or whole sections before sending.

Limits and troubleshooting

  • Scanned PDFs need OCR, which the converter does not do. A message lists the affected pages; add a text layer with an OCR app, then convert.
  • Password-protected files must be unlocked in the original app; DRM-protected e-books cannot be converted.
  • Files over 50 MB are rejected. Split the document or export a lighter version.
  • One file at a time: there is no batch mode. Convert each document and paste them into one file, each under its own # heading.
  • “The file is too complex to convert safely in the browser” means a safety limit was reached; try smaller parts.
  • Jumbled reading order in a PDF usually comes from columns or floating text boxes. If you have the original Word or PowerPoint file, convert that instead: its structure is read directly, not guessed from positions on the page.

More guides