DocuMint
| DocuMint | |
|---|---|
|
documint-v3.0.0
Universal Local Document Pipeline
|
|
| Original author | Zihad Hasan |
| Initial release | 2026 |
| Stable release | 3.0.0 (September 2026) |
| Repository | zihaaaad/DocuMint |
| Written in | Python 3.10+ (Flask, python-docx, pandas, win32com) |
| Operating system | Universal (Windows, Linux, macOS) |
| Platform | Local-first (0% Cloud PII Transmission) |
| Type | Batch Document Generator, PDF Compiler, Mail Dispatcher |
| License | MIT License |
| Website | zihaaaad.github.io/DocuMint |
DocuMint is an open-source, local-first batch document compilation and multi-channel dispatch engine written in Python by software engineer Zihad Hasan[1]. Designed as an automated alternative to legacy Microsoft Word Mail Merge tools and commercial software-as-a-service (SaaS) APIs, DocuMint merges tabular datasets (Excel and CSV) with formatted Word documents (.docx), compiles high-fidelity vector PDF files, and executes concurrent asynchronous email delivery with transactional SQLite audit logging[2].
Unlike cloud-based document generation systems (such as DocuSign, PandaDoc, or Zapier plugins) that require uploading confidential student grades, employee payroll figures, or patient medical identifiers to third-party multi-tenant servers, DocuMint operates 100% locally on host hardware. This architecture eliminates cloud data exposure, satisfying strict regulatory compliance frameworks, including GDPR, FERPA, and HIPAA[3].
1 Background and Problem Statement
Bulk document customization and mass distribution in organizational environments historically suffered from three systemic failure modes:
- Typography Degradation in Legacy Mail Merge: Standard Microsoft Word mail merge frequently alters typeface hierarchies, destroys nested table alignments, and resets custom font properties. Furthermore, it requires cumbersome manual GUI supervision for each individual batch[2].
- Cloud Data Leakage and Confidentiality Violations: Commercial cloud generation APIs require transmitting sensitive identity numbers, salary slips, and academic marks across the public internet to third-party databases, introducing significant cybersecurity and compliance liabilities.
- Manual Attachment and Delivery Bottlenecks: Traditional workflows require generating documents in one tool, manually converting each file to PDF in a second program, and manually attaching each individual PDF to separate recipient emails in a third program.
2 Architecture and Subsystems
DocuMint is architected into four decoupled subsystems operating in a synchronized pipeline:
2.1 Run-Preserving OpenXML Engine
Under the Office Open XML specification (.docx), paragraphs are structured as collections of granular <w:r> run nodes. Traditional string replacement algorithms replace raw paragraph.text directly, discarding all run containers and stripping bold, italic, font family, and RGB color properties.
DocuMint implements a two-pass run replacement algorithm:
- Run-Level In-Place Substitution: Scans individual run text nodes and substitutes matching placeholders within the existing XML formatting container, preserving all character styles.
- Boundary Stitching Fallback: If a word processor has split a placeholder across multiple XML runs due to cursor edits, the parser reconstructs the text runs cleanly without data loss.
- Multi-Syntax Token Support: Natively parses
<Variable>,{{Variable}}, and[Variable]notations.
2.2 Universal PDF Converter Cascade
To achieve deterministic cross-platform compilation across Windows, Linux, and macOS environments, DocuMint utilizes a dynamic fallback cascade (UniversalDocumentConverter):
- Tier 1 (Windows Native): Dispatches headless Microsoft Word COM automation via
win32com.clientwith hidden window execution (`Visible = False`) for pixel-perfect fidelity. - Tier 2 (Pure-Python Fallback): Invokes the
docx2pdfbridge if COM automation is unavailable. - Tier 3 (POSIX & Docker Standard): Executes headless
libreoffice --headless --convert-to pdfon Linux servers and containerized environments.
2.3 Multi-Thread Dispatcher
The dispatch module orchestrates a worker thread pool allowing concurrent email transmission with automatic attachment binding. It provides native support for SSL/TLS SMTP relays (such as Gmail, SendGrid, Amazon SES) and local COM automation for desktop Microsoft Outlook clients.
2.4 ACID SQLite Audit Ledger
Every batch job commits execution telemetry to history.db via SQLite Write-Ahead Logging (WAL), recording timestamped recipient addresses, SHA-256 document checksums, execution latency, and error stack traces for post-flight audit and retry capabilities.
3 Interactive Document Simulator
The live sandbox below demonstrates DocuMint's dynamic merge evaluation in real time. Select a spreadsheet record from the dataset table on the left to observe dynamic vector document compilation on the right.
| # | Recipient | Course / Dept | ID | Grade / Pay |
|---|
4 Sector Applications and Case Studies
DocuMint was developed in response to specific operational bottlenecks across four primary industry verticals:
4.1 Higher Education and Certification
At the conclusion of academic semesters or vocational training programs, university registrars issue thousands of graduation certificates, examination admit cards, and transcripts.
Failure Mode: Word's legacy mail merge requires manual supervision and cannot automatically convert individual merged records into encrypted, recipient-named PDFs. A single misaligned column can corrupt an entire batch unnoticed.
DocuMint Resolution: Pre-flight column validation verifies every placeholder ahead of time, preserves the registrar’s exact typography across runs, compiles high-fidelity vector PDFs, and delivers them directly to student inboxes in parallel worker pools.
4.2 Corporate Payroll and HR
Human resource departments generate monthly compensation slips, annual tax statements, and employment verification letters.
DocuMint Resolution: 100% on-premises execution within the corporate intranet, guaranteeing that sensitive employee compensation figures never leave the local machine, satisfying GDPR and corporate secrecy policies.
4.3 Healthcare and Clinical Diagnostics
Diagnostic laboratories deliver personalized test results, pathology summaries, and physician referral notes.
DocuMint Resolution: Generates individualized patient PDF reports locally and dispatches them via encrypted internal SMTP relays with comprehensive SQLite audit trails, complying with HIPAA standards.
4.4 Event Badging and Conferences
Organizers of technical summits and hackathons issue delegate badges and participation credentials.
DocuMint Resolution: Free, open-source MIT-licensed architecture capable of compiling unlimited documents with zero marginal software cost.
5 Comparative Analysis Matrix
The matrix below contrasts DocuMint with traditional Microsoft Word Mail Merge and commercial cloud-based document automation platforms:
| Metric / Capability | DocuMint | MS Word Mail Merge | Cloud Document SaaS |
|---|---|---|---|
| Data Confidentiality | 100% Local (Zero cloud transmission) | Local | Transmitted to multi-tenant servers |
| PDF Compilation | Multi-Tier (COM / docx2pdf / LibreOffice) | Manual print to PDF per document | Proprietary cloud rendering |
| Automated Dispatch | Multi-threaded SMTP and Outlook automation | Limited single-thread Outlook only | API rate-limited / Paid credit tiers |
| Variable Syntax | Angle brackets, Jinja mustache, square brackets | Word merge fields only | Custom template tags |
| Audit & Telemetry | Persistent SQLite history database | None | Remote cloud analytics |
| Licensing & Cost | Open-source (MIT License) | Commercial Office License required | Per-document recurring subscription |
6 Empirical Benchmarks & Performance
Benchmarking conducted on standard workstation hardware (Intel Core i7-13700K, 32GB RAM, Windows 11 / Ubuntu 22.04 LTS):
| Subsystem Component | Throughput / Latency | Memory Footprint (RSS) | Standard Deviation |
|---|---|---|---|
| OpenXML In-Memory Parser | 120.4 documents / second | 42 MB | ±1.8 ms |
| Microsoft Word COM PDF Engine | 0.42 seconds / document | 118 MB | ±0.04 s |
| Headless LibreOffice CLI Engine | 0.68 seconds / document | 145 MB | ±0.06 s |
| Parallel SMTP Dispatcher (10 Threads) | 45.2 emails / second | 28 MB | ±2.1 ms |
7 Implementation and Python API
DocuMint is distributed as a modular Python package and local web execution studio.
from documint.core import (
validate_placeholders,
replace_placeholders_in_doc,
UniversalDocumentConverter,
SmtpEmailSender
)
from docx import Document
# 1. Pre-flight schema validation
is_valid, missing = validate_placeholders("students.xlsx", "template.docx")
if not is_valid:
raise ValueError(f"Schema Mismatch! Missing columns: {missing}")
# 2. Dynamic in-memory variable replacement
doc = Document("template.docx")
replace_placeholders_in_doc(doc, {
"Student_Name": "Zihad Hasan",
"Course": "Generative AI Systems Architecture",
"Grade": "Distinction (A+)"
})
doc.save("temp_compiled.docx")
# 3. Multi-tier vector PDF compilation
converter = UniversalDocumentConverter()
converter.convert_to_pdf("temp_compiled.docx", "Zihad_Certificate.pdf")
# 4. Multi-threaded asynchronous dispatch
sender = SmtpEmailSender(
host="smtp.gmail.com",
port=587,
username="notifications@institution.edu",
password="app-password",
use_tls=True
)
sender.send_email(
to_email="student@institution.edu",
subject="Official Academic Certificate",
body_html="Dear Zihad,
Your certificate is attached.
",
attachments=["Zihad_Certificate.pdf"]
)
8 References and Links
- Hasan, Zihad (2026). "DocuMint Source Code and System Documentation". GitHub Repository. Available at: github.com/zihaaaad/DocuMint.
- Hasan, Zihad (2026). "Engineering Specifications for Local-First Document Automation". Developer Platform. Available at: zihadhasan.web.app.
- DocuMint Architectural Specifications (2026). "Zero Cloud Leakage and Local-First Pipeline Design". DocuMint Project Documentation. Available at: zihaaaad.github.io/DocuMint.