This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /blog/teaching-llms-to-read-pdfs.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Teaching LLMs to read PDFs: Convert PDF to HTML and Markdown with Claude Code and Nutrient DWS MCP Server

Table of contents

    Teaching LLMs to read PDFs: Convert PDF to HTML and Markdown with Claude Code and Nutrient DWS MCP Server
    TL;DR

    The Nutrient DWS MCP Server(opens in a new tab) adds PDF conversion to HTML, Markdown, and PDF/Universal Accessibility (PDF/UA), injecting structure where the PDF format strips it away — and making documents readable by large language models (LLMs) and AI tools while improving accessibility.

    My first tests connecting Claude Code with Nutrient DWS MCP Server led me to create what might be the most interesting website known to mankind: the “US Tax Forms Browser” — every US citizen’s favorite tax forms rendered in HTML. Behind this tongue-in-cheek project is something useful: Claude Code can now talk directly to document processing tools, which changes how we work with documents. API specifications no longer have to stay locked up in the PDF format, and you no longer need conversion scripts to extract key information for your application.

    PDFs run the world, but that world is human-based

    PDFs are everywhere in business and government. Tax forms, legal documents, reports, manuals — critical information trapped in a format designed for viewing, but not autonomously processing.

    Here at Nutrient, we’ve been solving this problem for customers for years, and now we’re solving this problem for AI.

    PDFs create several challenges:

    • Web unfriendly — PDFs don’t play well with responsive design.
    • AI hostile — LLMs struggle with the unstructured nature and formatting of PDFs.
    • Accessibility barriers — Many PDFs fail basic accessibility standards.
    • Search limitations — Content is locked away from modern search experiences.
    • Mobile pain — PDF viewing on mobile devices is tricky, which takes us back to the responsive design issue.

    Bridging the gap between development and documents

    The latest release of Nutrient Document Web Services (DWS) MCP Server(opens in a new tab) introduces conversion capabilities that solve many of the unstructured issues mentioned above.

    The new output formats enable these workflows:

    1. HTML conversion — Transform PDFs into responsive web content.
    2. Markdown output — Create LLM-friendly, structured text.
    3. PDF/UA generation — Generate PDF/UA output. Then validate it and review its accessibility.

    The next section walks through a real-world example using Claude Code and Nutrient DWS MCP Server.

    Ready to try document processing at scale?

    Get started with Nutrient DWS Processor API and receive $5 of free usage every month, with watermarked evaluation output. Enable pay-as-you-go or choose a paid plan for watermark-free processing.

    Building a tax forms browser: From PDFs to a web app

    I was frustrated by the experience of browsing US tax forms. All the official forms exist only as PDFs, which require downloads and create a poor experience on mobile devices and for LLMs that need to process the content.

    Here’s how the new DWS MCP Server capabilities helped solve that in 20 minutes.

    Step 1 — Project setup with Claude Code

    To set up DWS MCP Server with Claude Code, you’ll first need an API key from nutrient.io(opens in a new tab). Then, add the server to your project:

    Terminal window
    # Add DWS MCP Server to your Claude Code project.
    claude mcp add dws-mcp-server -e NUTRIENT_DWS_API_KEY=<your-dws-api-key> -- npx -y @nutrient-sdk/dws-mcp-server --sandbox <your-project-dir>

    Once configured, the MCP servers become available in Claude Code (/mcp command):

    Terminal window
    # MCP servers now available in Claude Code.
    1. dws-mcp-server ✓ connected

    Now Nutrient DWS MCP Server can access any file within your project directory and send it off for processing.

    Step 2 — Mass PDF-to-HTML conversion

    With a folder full of tax form PDFs organized by category, converting them to HTML took a single request to Claude:

    Terminal window
    Please convert all the tax forms in the `irs-forms` directory to HTML.

    Previously, I would’ve had to find a program or library to convert all these documents, and then write a script to do so. Now I just ask Claude Code to do it. This works beyond forms: documentation Claude Code needs access to, business logic that’s locked up in documents, and even screenshots with code snippets, which it can process with optical character recognition (OCR).

    You’ll see Claude Code making MCP calls to the DWS MCP Server for each file, and the HTML output appears:

    Terminal window
    ⏺ dws-mcp-server:document_processor (MCP)(instructions:
    {"parts":[{"file":"irs-forms/schedules/f1040s2.pdf"
    }],"output":{"type":"html","layout":"reflow"}},
    outputPath:
    "converted-forms/schedules/f1040s2.html")
    ⎿ File processed successfully using build API and saved to: .../u
    s-tax-forms/converted-forms/schedules/f1040s2.html

    Form as PDF

    Step 3 — Building the web interface

    With HTML files ready to go, the final step was one more request to Claude Code:

    Terminal window
    Please can you take each converted HTML file and serve these as part of a small web application to allow users to better browse US tax forms. The landing page should display all the forms available in the applicable categories.

    The result was a web app where tax forms load instantly, organized by category, with a responsive layout and clear navigation. It took 20 minutes from PDF folder to working app.

    Tax Form App Landing Page

    Markdown for AI workflows

    HTML solved the PDF viewing problem, but LLMs still struggle with PDFs: They can’t parse the structure, miss formatting, and often hallucinate content. Converting a PDF to Markdown addresses that, because Markdown gives a model structured text it can reason over.

    Say your company has years of technical documentation trapped in PDFs. API specs, architecture decisions, compliance documents — all locked away from your AI tools. With DWS MCP Server and Claude Code, you can drop those documents into your project and make that knowledge available with a single command:

    Terminal window
    Please can you convert the PDFs in the `docs` directory to Markdown.

    The converted Markdown is available to Claude Code and other AI tools. Check the text, tables, and reading order against the source PDFs before using it for retrieval or answers.

    For a no-code route, the PDF-to-Markdown skill runs the same conversion on demand. To convert from application code, use the Nutrient PDF-to-Markdown API, which is powered by the Data Extraction API.

    Beyond developers: Universal document access

    This post focused on the developer experience, but the same approach works beyond coding workflows. The Model Context Protocol isn’t limited to Claude Code; it’s an open standard. That means these same document processing capabilities work in Claude Desktop and any application that’s MCP compatible.

    Your customer support team can convert product manuals. Legal departments can review and digitally sign contracts. And HR can extract resume information for additional processing. All it takes is natural language and DWS MCP Server.

    For more on the capabilities, including PDF merging, splitting, and watermarking, see the original release blog post, which includes a video walkthrough.

    Feeding that structured output into a question-answering system? See how to build a chat-with-PDF app and multimodal RAG.

    Get started with Nutrient DWS MCP Server

    Use Nutrient DWS MCP Server to convert documents to HTML and Markdown and give your LLMs the structured data they need. Get your API key and start building(opens in a new tab).

    Nick Winder

    Nick Winder

    Core Staff Software Engineer

    When Nick started tinkering with guitar effects pedals, he didn’t realize it’d take him all the way to a career in software. He has worked on products that communicate with space, blast Metallica to packed stadiums, and enable millions to use documents through Nutrient, but in his personal life, he enjoys the simplicity of running in the mountains.

    Try for free Ready to get started?