apyhub
Cover illustration for Online DOCX to PDF Conversion and How to Handle It
Engineering

Online DOCX to PDF Conversion and How to Handle It

Online Word to PDF API: What Breaks in DOCX Conversion and How to Handle It

The short version: converting a Word document to PDF is one API call. Deciding how to do it is the actual question, and there are four routes with genuinely different trade-offs.

This covers those four, what breaks in conversion regardless of which you pick, and what changed once agents started making the call.

Updated September 2026. Rewritten with working examples, a current view of the alternatives, the conversion failures worth knowing before you ship, and a new section on what changed once AI agents started doing the converting.

01The Two Ways People Build This, and Why They Hurt

Before the API, the two approaches teams reach for first.

Run LibreOffice headless on your server. It works. It is also a full office suite running as a subprocess in your web application, and it brings a specific set of problems: it is slow to start, it is memory-hungry, it occasionally hangs on a malformed file and never returns, and it needs every font your documents reference installed on the machine. Concurrency is the killer. Two simultaneous conversions on a small instance is often enough to exhaust memory.

Automate Microsoft Word. Fidelity is perfect, because it is Word. Microsoft explicitly does not support Office automation from a service, it requires a Windows machine with a licensed install, and it does not scale. Some teams do it anyway and maintain a Windows VM they are afraid to touch.

The API version is one HTTP call. Which is the point, but it does not make the underlying problems disappear. It moves them somewhere they are somebody else's to solve.

02What Actually Breaks

DOCX and PDF describe documents in fundamentally different ways. DOCX describes structure and reflows. PDF describes fixed marks on a fixed page. Something has to decide where everything lands, and these are the six places that decision goes wrong.

Fonts that are not embedded. A DOCX references fonts by name and assumes the machine has them. If your document uses Calibri and the converter does not have Calibri, it substitutes. Substituted fonts have different metrics, so line breaks move, then paragraph breaks move, then a three-page document becomes four. This is the single most common conversion complaint and it is almost always this.

Tracked changes and comments. A document with unresolved tracked changes may convert with the markup visible, the changes accepted, or the changes rejected. All three are defensible and only one is what you wanted. Accept or reject before converting rather than finding out afterwards.

Embedded objects. Charts pasted from Excel, embedded spreadsheets, OLE objects, SmartArt. These are not part of the document text, they are attachments with their own rendering. Some converters render them, some render a placeholder, some drop them.

Fields that were never updated. Page numbers, cross-references, tables of contents and date fields are computed values. If the document was saved without refreshing them, the converter has no reason to recalculate. Your table of contents converts with the page numbers it had last time someone pressed F9.

Section and page breaks. Word reflows content to fit the page. If the converter uses a different page size or margin default, breaks land in different places, and a document formatted for A4 converting at Letter shifts everything.

Headers, footers and watermarks. Usually fine, occasionally not, particularly with different-first-page or different-odd-and-even settings.

The practical consequence: test with your real documents, not a sample. A one-page memo converts perfectly in every tool. A fifty-page report with a table of contents, embedded charts and a corporate template is where converters differ, and that is what your users will upload.

03Four Ways to Convert, Compared

ApproachWhat it isGood whenCost of ownership
Library in-processAspose, GroupDocs, Syncfusion running inside your appYou cannot make network calls, or volume is enormousPer-developer licence, plus you own the runtime, fonts and memory
Self-hosted serviceLibreOffice headless or Gotenberg in a containerYou want control and no per-call costYou operate it, including everything in the section above
Dedicated conversion APIConvertAPI, Nutrient, CloudConvertConversion is central to your productPer-conversion pricing, another vendor relationship
Catalog APIOne endpoint among many on a shared keyConversion is one step in a bigger pipelineFewer conversion-specific knobs

Most teams overthink this. If you convert documents occasionally as part of something else, the last row is correct and the decision is not worth a week. If conversion is the product, the third row deserves a proper evaluation with your own documents.

04What a Conversion Endpoint Should Give You

Four things worth checking before you commit, in rough order of how often they matter.

Input flexibility. A file upload covers the obvious case. A remote URL matters more than people expect, because most documents are already in object storage and uploading them to a converter is a pointless round trip. Base64 matters if your documents arrive inside JSON payloads.

Output shape. Getting the PDF back directly is right for a download button. Getting a link is right when the file is stored, shared, or generated in a batch. An endpoint offering only one of these forces awkwardness on half your use cases.

A size ceiling you can plan around. Uploads always cap somewhere. What matters is whether there is a documented path for larger documents, usually a URL-based endpoint that avoids the upload entirely.

Predictable failure. Clear status codes, and a rate limit you can back off against rather than guess at.

The Convert Word to PDF API covers all four: file, URL and base64 input, either a binary response or a signed link, .doc, .docx, .odt and .rtf, a documented 100MB upload cap with URL endpoints for anything larger, and an optional landscape flag. Six endpoints total, which is really a three-by-two grid of input by output shape.

For very large documents, FlowDocs publishes a job-based Word to PDF endpoint in the same catalog, submitting and polling rather than converting inside the request.

Try the Word to PDF API | Get a free API key

05What Changed in 2026: The Caller Is Often an Agent

This section did not exist when this article was first published, and it is now the part that most affects how you build.

A year ago a Word-to-PDF call was made by code someone wrote. Increasingly it is made by an agent that decided, mid-task, that it needed a PDF.

Three things follow from that.

The agent has to find the endpoint before it can call it. It was not handed a list. Every endpoint in the ApyHub catalog is available over MCP, so an agent connects once, searches for the capability it needs, reads what the endpoint accepts and what it costs, and calls it. No wrapper, no tool definition written by hand.

Generating a converter costs far more than calling one. Ask a coding agent to convert a document and it will try. It writes code, hits a missing dependency, rewrites, hits a font problem, tries a third approach. Every attempt burns tokens and every failed attempt stays in the context window, re-read on every subsequent turn.

One call is a few hundred tokens and returns the actual file. This is the same argument as the maintenance question that applies to any generated utility, and it gets sharper the heavier the task. Document conversion is heavy.

The agent cannot verify what it produced. A model that writes its own conversion code has no way to know the fonts substituted or the table of contents kept stale page numbers. It returns a PDF and reports success. A managed endpoint at least fails loudly, with a status code an agent can act on.

The practical upshot: the properties that make this endpoint good for an agent are the same ones that make it good for a person. Discoverable, one call, clear errors, predictable output. We covered how agents sequence multi-step work in API Chaining in 2026.

See the MCP setup | Browse the file conversion catalog

06The Alternatives, Honestly

The earlier version of this article compared this API against Smallpdf, iLovePDF and Adobe Acrobat. Those are consumer tools. If you are reading this you want an API, so here is the actual field.

OptionBest forAgent-callableTrade-off
ConvertAPIBreadth of formats, long track recordVia custom wrapperPriced per conversion, broad rather than deep
Nutrient (formerly PSPDFKit)Document-heavy products needing SDKs and viewersVia custom wrapperEnterprise pricing and scope
Aspose / GroupDocsConversion in-process, no network callNo, it is a libraryPer-developer licensing, and you own the runtime
SyncfusionTeams already in that ecosystemVia custom wrapperLicensing model, less useful standalone
Gotenberg (open source)Full control, no per-call costSelf-hosted, you build itYou operate it, including the memory and font problems above
CloudConvert200+ formats when you need obscure onesVia custom wrapperBroad rather than specialised
ApyHubOne call, one key, MCP-nativeYes, discoverable over MCPFewer conversion-specific knobs than a dedicated vendor

The agent column is new this year and it is the one that changed. Every option above can be called by an agent if someone writes a wrapper and maintains it. Only the MCP-native one can be found and called without that step.

The honest split: if document conversion is your product, a specialist vendor with tuning options and an SLA is the right purchase. If conversion is one step inside something else, a call on a key you already have is less to manage.

07Conversion Is Rarely the Whole Job

Word to PDF alone is uncommon. The chains that show up:

Generate, then convert. Build a document from a template, convert it, deliver it. Markdown to PDF and HTML to PDF often replace the Word step entirely if you control the source.

Convert, then secure. A PDF going to a customer often wants a watermark or a password-protected archive.

Convert, then extract. Sometimes you need both the PDF and its contents indexed. Text extraction after conversion.

Convert the other direction. PDF to Word when the requirement is editability, which is a materially harder problem than going the other way. Tables are the hard part, and we wrote about why in The Hard Part of PDF-to-Excel Isn't the Text, It's the Table.

Batch it properly. A hundred conversions is not a hundred sequential calls. Parallelise, respect the rate limit, and back off on 429. API Chaining in 2026 covers the patterns.

For very large documents, FlowDocs publishes a job-based Word to PDF endpoint in the same catalog, which submits and polls rather than converting inside the request.

08The One Error Worth Designing For

Whichever route you take, rate limiting is the failure you will meet most.

In batch conversion, hitting the limit is the normal case rather than an exception. A hundred documents fired in parallel will exceed something. The fix is exponential backoff: wait, retry, double the wait. Retrying immediately makes it worse and is how accounts get throttled harder.

Everything else is ordinary. A malformed request, a bad key, a briefly unavailable backend. Those announce themselves clearly and are fixed once.

09Conclusion

Converting Word to PDF is one request. The difficulty is not the call, it is the fidelity.

Fonts that are not embedded move your line breaks. Tracked changes convert in a state you did not choose. Fields keep values from the last time someone opened the document. None of that shows up on a clean sample and all of it shows up on a real one.

Whichever tool you pick, convert three of your genuinely awkward documents first and open the output. That test tells you more than any comparison table.

And if an agent will be doing the calling rather than your code, add one more criterion: can it find the endpoint on its own. Everything else about a conversion API is unchanged since 2025. That part is not.

Browse the file conversion catalog | Start free, no card

10FAQ

How do I convert Word to PDF programmatically?

Send the document to a conversion API. One POST with the file attached returns the PDF, either as binary or as a signed link. The ApyHub Word to PDF API accepts a file upload, a remote URL, or a base64 string, and handles .doc, .docx, .odt and .rtf.

Can I convert DOCX to PDF without Microsoft Word?

Yes, and you should. Microsoft does not support automating Office from a server process. Use a conversion API, or run LibreOffice headless if you are willing to operate it, including the font and memory issues that come with it.

Why does my converted PDF look different from the Word document?

Almost always fonts. A DOCX references fonts by name and assumes the machine has them. When the converter does not, it substitutes a different font with different metrics, so line breaks shift and page counts change. Embedding fonts in the source document is the reliable fix.

What happens to tracked changes when converting to PDF?

It depends on the converter, which is the problem. Markup may be rendered visibly, accepted, or rejected. Accept or reject changes in the source document before converting rather than discovering which behaviour you got.

What file formats can I convert to PDF?

The ApyHub endpoint accepts .doc, .docx, .odt and .rtf. Other endpoints in the same catalog handle Markdown, HTML, Excel and images to PDF.

Is there a file size limit for Word to PDF conversion?

Uploads are capped at 100MB per request. Beyond that, host the document somewhere fetchable and use the URL-based endpoint, which avoids the upload entirely.

Should the API return the PDF or a link to it?

Take the binary when the file goes straight to a user and you do not need to keep it. Take the link when the PDF is stored, shared, or accessed more than once, or when you are running a batch and do not want connections held open.

Should I use a library, self-host, or call an API?

Use a library when you cannot make network calls or your volume genuinely justifies the licence. Self-host when you want control and are willing to operate it, including fonts and memory. Use an API when conversion is one step in something larger, which covers most teams. The deciding question is whether document conversion is your product or a feature of it.

Can I convert Word documents to PDF in bulk?

Yes, but not as a hundred sequential calls. Parallelise within your rate limit and handle 429 responses with exponential backoff. For very large individual documents, a job-based endpoint that submits and polls is a better fit than one that converts inside the request.

Can an AI agent convert documents for me?

Yes, if the endpoint is discoverable. Every service in the ApyHub catalog is available over MCP, so an agent can search for a conversion capability, read what it accepts, and call it without anyone writing a wrapper first. Without a discovery protocol an agent can only use tools it was handed up front.

Why not let an AI just write the conversion code?

Because generating costs more than calling and the result is less reliable. A coding agent asked to convert a document writes code, hits a missing dependency, rewrites, hits a font problem, and tries again, with every failed attempt staying in its context window. It also has no way to verify that the fonts did not substitute or that the table of contents is current. One call returns the actual file.

Is converting Word to PDF via an API secure?

Depends on the provider, and it is worth checking rather than assuming. Look for TLS in transit, a stated retention period for uploaded files and generated output, and where processing happens. ApyHub runs on EU infrastructure and every service carries machine-readable certification covering data handling and retention.

11Further Reading

12About ApyHub

ApyHub is a curated API catalog for developers, teams, and AI agents. The file conversion category covers Word, Excel, PowerPoint, Markdown, HTML, image and video conversion, alongside file manipulation, data extraction, AI and OCR and more across 20 categories.

One subscription covers the whole catalog, with headroom pooled across every API rather than locked to individual services. Every service carries machine-readable certification covering data handling, retention, and standards alignment including GDPR, SOC 2, and ISO 27001. Every endpoint is MCP-ready by default.

ApyHub is headquartered in Amsterdam, with offices in the Netherlands, Greece, and India, and runs on EU infrastructure. The catalog holds 450+ services and 1,500+ endpoints, with new APIs and providers onboarded continuously. The free tier requires no credit card, and every service page has a playground for testing before you build.