Convert PDF and office document URLs to Markdown
Convert documents to Markdown with the request you already use for HTML: point it at a PDF, DOCX, XLSX or PPTX URL and readable Markdown comes back. Knowledge lives in annual reports, contracts, price sheets and slide decks as much as in web pages. One conversion path lets a RAG pipeline, a support bot or an internal search index ingest all of them.
PDF and DOCX files need their own parser, until they do not
Each format brings a library, a set of edge cases and a different output shape. A pipeline that handles HTML, PDF and DOCX ends up with three code paths that produce three flavors of text, and the chunker downstream has to cope with all of them.
Local parsers also mean binaries to install, patch and scale. One library flattens tables, another loses heading levels, a spreadsheet reader hands you arrays instead of text. Every new format a customer uploads becomes another integration to maintain.
Microlink converts a PDF with a text layer, or a docx, xlsx, pptx, odt, rtf or epub file, to an HTML document at fetch time and then serializes it exactly like a web page. The request is identical and only the url changes, which is the same idea behind the file conversion API.
How to convert a PDF or DOCX URL to Markdown
Nothing in the request identifies the format. Point it at a direct file URL and the conversion adapts, as the URL to Markdown guide describes for every supported source.
import createClient from 'microlink.io'
const microlink = createClient({
apiKey: process.env.MICROLINK_API_KEY
})
const markdown = await microlink.markdown(
'https://cdn.microlink.io/file-examples/sample.docx'
)The same method converts .pdf, .docx, .xlsx, .pptx, .odt, .rtf and .epub URLs and resolves to a Markdown string with the headings, lists and tables of the document.
import createClient from 'microlink.io'
const microlink = createClient({
apiKey: process.env.MICROLINK_API_KEY
})
const text = await microlink.text(
'https://example.com/reports/annual-report.pdf'
)The text method strips the markup and collapses whitespace, the smallest readable body for summarizers and classifiers that ignore headings and tables.
curl 'https://api.microlink.io/?url=https%3A%2F%2Fcdn.microlink.io%2Ffile-examples%2Fsample.docx&data.markdown.attr=markdown&meta=false&embed=markdown'embed=markdown returns the Markdown directly with a text/markdown content type. Without it, the converted document arrives in the data.markdown field of the JSON response.
- data data.markdown.attr=markdown serializes the fetched document as Markdown.
- embed Return the Markdown field as the response body instead of JSON.
- meta false skips metadata detection, useful for file URLs that expose little of it. Default true.
- headers Forward authorization when the document sits behind a login. Pro plans.
- ttl Documents rarely change, so cache the conversion for up to 31 days. Pro plans.
Image-only PDF scans, the legacy doc, xls and ppt formats and the ods and odp formats are not converted. The request still succeeds, but the field holds the raw response instead of Markdown, so validate the value before you index it.
Why one Markdown conversion path for pages and documents
Ingestion pipelines are simpler when every source produces the same shape, whether it started as HTML, a Word report or a spreadsheet.
Add metadata frontmatter with meta: true when the document exposes a title and an author you want to keep.
Large documents take longer to convert. The request timeout is 30 seconds on the free endpoint and 60 seconds on Pro, and a cached conversion skips the work entirely. For a folder of files, see bulk Markdown conversion.
When not to: for scanned documents, run a dedicated OCR step first and feed the resulting text or searchable PDF back in. For the reverse direction, saving web articles as PDF is a PDF API job.
FAQ
Which document formats can I convert to Markdown?
How do I convert a PDF URL to Markdown with an API?
What happens when I convert a scanned PDF to Markdown?
Can I convert a document behind a login to Markdown?
Do XLSX spreadsheets keep their tables in Markdown?
Solve the next problem with the same API
Markdown with metadata frontmatter
Bulk Markdown conversion with caching
Clean Markdown, no boilerplate
LLM context from any URL
YouTube transcripts as Markdown
Archive web articles as PDF
Ready to convert documents to Markdown?
PDFs, Word files, spreadsheets and decks through the same request as web pages. Start on the free tier and ingest your first document today.