Recursive AI

Open XML SDK vs C# document conversion libraries

Use the Open XML SDK to edit Office markup, a renderer to lay out PDF pages, or both in one pipeline.

OneDocument is a free, open-source .NET document library from Recursive AI, licensed under MIT or Apache-2.0 (NuGet · GitHub).

Install · .NET 10
dotnet add package RecursiveAI.OneDocument.Rendering --version 1.0.0
dotnet add package DocumentFormat.OpenXml --version 3.5.1

In a .NET 10 console project, replace Program.cs and run dotnet run.

Program.cs
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Wordprocessing;
using RecursiveAI.OneDocument;
 
using (var doc = WordprocessingDocument.Create("report.docx", WordprocessingDocumentType.Document))
{
    var part = doc.AddMainDocumentPart();
    var status = new Text("Status: draft");
    part.Document = new Document(new Body(new Paragraph(new Run(status))));
    // This stands in for editing an existing document.
    status.Text = "Status: approved";
    Console.WriteLine(part.Document.Body!.InnerText);
}
 
Office.Convert("report.docx", "report.pdf");
Console.WriteLine(File.ReadAllText("report.pdf", System.Text.Encoding.Latin1)[..5]);
Console output
Status: approved
%PDF-

The SDK saves the edited report.docx when the using block ends. OneDocument then opens that file and writes a one-page report.pdf. Text extracted from the PDF with pdftotext was Status: approved.

Why Open XML SDK doesn’t turn DOCX into PDF

Open XML SDK gives you strongly typed classes for Office Open XML parts and elements. In the example, Text becomes a WordprocessingML text element inside a run and a paragraph. That’s enough to save the edit, but it doesn’t tell you exactly where the text will appear on a page.

The SDK does not include a PDF renderer. A renderer resolves fonts and styles, breaks lines, lays out pages, then paints them into a fixed-layout file. OneDocument’s layout pipeline does this without changing the input document. Changing a file extension or saving the package again does not perform that work.

Which C# library fits the output?

Open XML SDK 3.5.1

Create or edit DOCX parts and elements. Keep the SDK if your existing editing code already works.

License or edition: MIT

OneDocument Rendering 1.0.0

Render Word documents, Excel workbooks, and PowerPoint presentations to PDF with the same Office.Convert entry point.

License or edition: MIT or Apache-2.0; targets .NET 10.

Aspose.Words 26.11.0

The vendor documents loading a Word document and using Document.Save to export PDF.

License or edition: Free trial and purchased licenses. The trial adds an evaluation watermark and limits document size.

GemBox.Document 2026.11.103

The vendor documents DocumentModel.Load and Save for DOCX-to-PDF conversion.

License or edition: Free and Professional editions. The Free edition is limited to 20 paragraphs.

Test layout separately from editing

If your service fills a template and sends both a DOCX and a PDF, keep the DOCX as the editable copy and render the saved file as a separate step. Test that the markup edit reached the DOCX, then check the PDF for page breaks, table wrapping, and header and footer placement. A one-page text extraction check proves the handoff, not that a complex document matches Word page for page.

Run that second check where you deploy. A substituted font can change where a line wraps, which can move content to the next page. For OneDocument, the layout result reports font substitutions and skipped content; the 1.0.0 layout notes also list gaps such as automatic hyphenation. If the PDF is your only output and you don’t need low-level OOXML edits, go straight to the conversion library.

See the OneDocument getting-started guide and the layout and PDF reference.