DocumentAtom
DocumentAtom provides a light, fast library for breaking input documents into constituent parts (atoms), useful for text processing, analysis, and artificial intelligence.
- 54
- C#
- MIT
- 4 d ago

C# SDK for DocumentAtom
Repo DocumentAtom/sdk-csharp, read from GitHub 2 d ago. DocumentAtom has not joined Take My Repo.
DocumentAtom/sdk-csharp is a public repo on GitHub by DocumentAtom. C# SDK for DocumentAtom. It declares the MIT license on GitHub. It is written mainly in C#, has 0 stars and last changed on 2025-11-28. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read from GitHub on 2026-11-20.
In the maintainer's words. Shown from GitHub; Take My Repo does not keep a copy.
DocumentAtom.Sdk is a C# SDK that provides a simple and efficient way to interact with DocumentAtom server instances. It enables document atomization, type detection, and health monitoring through a clean, async API.
IMPORTANT - DocumentAtom.Sdk assumes you have deployed the DocumentAtom REST server. If you are integrating a DocumentAtom library directly into your code, use of this SDK is not necessary.
DocumentAtom.Sdk allows you to:
Install the package via NuGet:
Install-Package DocumentAtom.Sdk
Or via .NET CLI:
dotnet add package DocumentAtom.Sdk
using DocumentAtom.Sdk;
using DocumentAtom.Core.Atoms;
// Initialize the SDK
var sdk = new DocumentAtomSdk("http://localhost:8000");
// Check server health
bool isHealthy = await sdk.Health.IsHealthy();
Console.WriteLine($"Server is healthy: {isHealthy}");
// Process a document
byte[] documentData = await File.ReadAllBytesAsync("document.pdf");
List<Atom>? atoms = await sdk.Atom.ProcessPdf(documentData);
if (atoms != null)
{
foreach (var atom in atoms)
{
Console.WriteLine($"Atom Type: {atom.Type}, Content: {atom.Text}");
}
}
var sdk = new DocumentAtomSdk("http://localhost:8000");
sdk.LogRequests = true;
sdk.LogResponses = true;
sdk.Logger = (severity, message) => Console.WriteLine($"[{severity}] {message}");
The main SDK class that provides access to all functionality.
public DocumentAtomSdk(string endpoint)
endpoint: DocumentAtom server endpoint URLEndpoint: Server endpoint URLTimeoutMs: Request timeout in milliseconds (default: 300000)LogRequests: Enable request loggingLogResponses: Enable response loggingLogger: Custom logger delegateAtom: Document processing methodsTypeDetection: Document type detectionHealth: Server health and statusProcess various document types and extract atoms:
ProcessCsv(byte[] data, bool extractOcr = false)ProcessExcel(byte[] data, bool extractOcr = false)ProcessHtml(byte[] data)ProcessJson(byte[] data)ProcessMarkdown(byte[] data)ProcessOcr(byte[] data)ProcessPdf(byte[] data, bool extractOcr = false)ProcessPng(byte[] data)ProcessPowerPoint(byte[] data, bool extractOcr = false)ProcessRtf(byte[] data, bool extractOcr = false)ProcessText(byte[] data)ProcessWord(byte[] data, bool extractOcr = false)ProcessXml(byte[] data)// Process a PDF document
byte[] pdfData = await File.ReadAllBytesAsync("document.pdf");
List<Atom>? pdfAtoms = await sdk.Atom.ProcessPdf(pdfData, extractOcr: true);
// Process a Word document
byte[] wordData = await File.ReadAllBytesAsync("document.docx");
List<Atom>? wordAtoms = await sdk.Atom.ProcessWord(wordData, extractOcr: true);
// Process an Excel spreadsheet
byte[] excelData = await File.ReadAllBytesAsync("spreadsheet.xlsx");
List<Atom>? excelAtoms = await sdk.Atom.ProcessExcel(excelData);
Automatically detect document types:
// Detect document type
byte[] documentData = await File.ReadAllBytesAsync("unknown-document");
TypeResult? result = await sdk.TypeDetection.DetectType(documentData);
if (result != null)
{
Console.WriteLine($"MIME Type: {result.MimeType}");
Console.WriteLine($"Extension: {result.Extension}");
Console.WriteLine($"Document Type: {result.Type}");
}
// With content type hint
TypeResult? resultWithHint = await sdk.TypeDetection.DetectType(
documentData,
contentType: "application/pdf"
);
Check server health and status:
// Check if server is healthy
bool isHealthy = await sdk.Health.IsHealthy();
// Get server status
string? status = await sdk.Health.GetStatus();
Console.WriteLine($"Server status: {status}");
The SDK returns Atom objects that contain structured document content:
GUID: Unique identifierParentGUID: Parent atom identifier (for hierarchical structures)Type: Atom type (Text, Image, Binary, Table, List)PageNumber: Page number where availablePosition: Ordinal positionLength: Content lengthText: Text contentMD5Hash, SHA1Hash, SHA256Hash: Content hashesQuarks: Sub-atomic particles (chunks)TableAtom: Contains table data with rows and columnsImageAtom: Contains image data and OCR textBinaryAtom: Contains binary dataListAtom: Contains ordered or unordered listsThe SDK handles errors gracefully and returns null for failed operations:
try
{
List<Atom>? atoms = await sdk.Atom.ProcessPdf(documentData);
if (atoms == null)
{
Console.WriteLine("Failed to process document or no atoms extracted");
}
else
{
Console.WriteLine($"Successfully extracted {atoms.Count} atoms");
}
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
var sdk = new DocumentAtomSdk("http://localhost:8000");
sdk.TimeoutMs = 600000; // 10 minutes
var sdk = new DocumentAtomSdk("http://localhost:8000");
sdk.LogRequests = true;
sdk.LogResponses = true;
sdk.Logger = (severity, message) =>
{
// Custom logging implementation
File.AppendAllText("sdk.log", $"[{DateTime.UtcNow}] [{severity}] {message}\n");
};
The SDK requires a running DocumentAtom server instance. You can:
jchristn/documentatom Docker image# Using Docker
docker run -p 8000:8000 jchristn/documentatom
# Or run the DocumentAtom.Server project locally
# Default endpoint: http://localhost:8000
using DocumentAtom.Sdk;
using DocumentAtom.Core.Atoms;
public class DocumentProcessor
{
private readonly DocumentAtomSdk _sdk;
public DocumentProcessor(string endpoint)
{
_sdk = new DocumentAtomSdk(endpoint);
_sdk.Logger = (severity, message) => Console.WriteLine($"[{severity}] {message}");
}
public async Task ProcessDocumentAsync(string filePath)
{
try
{
// Check server health
if (!await _sdk.Health.IsHealthy())
{
throw new Exception("DocumentAtom server is not healthy");
}
// Read document
byte[] documentData = await File.ReadAllBytesAsync(filePath);
// Detect document type
TypeResult? typeResult = await _sdk.TypeDetection.DetectType(documentData);
Console.WriteLine($"Detected type: {typeResult?.Type}");
// Process based on type
List<Atom>? atoms = typeResult?.Type switch
{
DocumentTypeEnum.Pdf => await _sdk.Atom.ProcessPdf(documentData, extractOcr: true),
DocumentTypeEnum.Word => await _sdk.Atom.ProcessWord(documentData, extractOcr: true),
DocumentTypeEnum.Excel => await _sdk.Atom.ProcessExcel(documentData),
DocumentTypeEnum.PowerPoint => await _sdk.Atom.ProcessPowerPoint(documentData, extractOcr: true),
DocumentTypeEnum.Html => await _sdk.Atom.ProcessHtml(documentData),
DocumentTypeEnum.Markdown => await _sdk.Atom.ProcessMarkdown(documentData),
DocumentTypeEnum.Json => await _sdk.Atom.ProcessJson(documentData),
DocumentTypeEnum.Xml => await _sdk.Atom.ProcessXml(documentData),
DocumentTypeEnum.Csv => await _sdk.Atom.ProcessCsv(documentData),
DocumentTypeEnum.Text => await _sdk.Atom.ProcessText(documentData),
DocumentTypeEnum.Rtf => await _sdk.Atom.ProcessRtf(documentData, extractOcr: true),
DocumentTypeEnum.Png => await _sdk.Atom.ProcessPng(documentData),
_ => throw new NotSupportedException($"Document type {typeResult?.Type} is not supported")
};
if (atoms != null)
{
Console.WriteLine($"Extracted {atoms.Count} atoms from {filePath}");
// Process atoms
foreach (var atom in atoms)
{
ProcessAtom(atom);
}
}
}
catch (Exception ex)
{
Console.WriteLine($"Error processing {filePath}: {ex.Message}");
}
}
private void ProcessAtom(Atom atom)
{
Console.WriteLine($"Atom: {atom.Type} - {atom.Text?.Substring(0, Math.Min(100, atom.Text.Length ?? 0))}...");
// Process based on atom type
switch (atom.Type)
{
case AtomTypeEnum.Table:
Console.WriteLine($" Table: {atom.Rows} rows, {atom.Columns} columns");
break;
case AtomTypeEnum.Image:
Console.WriteLine($" Image: {atom.Binary?.Length ?? 0} bytes");
break;
case AtomTypeEnum.Text:
Console.WriteLine($" Text: {atom.Text?.Length ?? 0} characters");
break;
}
}
public void Dispose()
{
_sdk?.Dispose();
}
}
Please refer to CHANGELOG.md for version history.
Contributions are welcome! Please feel free to submit issues, enhancement requests, or pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.
For support, please:
DocumentAtom/sdk-csharp is a public repo on GitHub by DocumentAtom. C# SDK for DocumentAtom.
It declares the MIT license on GitHub.
Its maker has not tagged a system, so it is unknown here. Its README says what it needs.
Open "Take it" on its page: Take My Repo writes an install plan for your machine and hands it to your AI agent (Claude Code, Codex or Cursor), which asks you before each step. Take My Repo has not tested it on any machine.
Its last change on GitHub was on 2025-11-28. Take My Repo does not judge from that whether it is maintained.
Nobody has reviewed it on Take My Repo yet, which says nothing about its quality.
DocumentAtom provides a light, fast library for breaking input documents into constituent parts (atoms), useful for text processing, analysis, and artificial intelligence.
Take My Repo has not tested this on your machine. Requirements come from the project's own documentation.