From 3782473d90e095f70c59ec284f8d21c9fcb4a7b8 Mon Sep 17 00:00:00 2001 From: azeeee05 Date: Tue, 25 Aug 2026 16:36:05 +0530 Subject: [PATCH] feat: add ProductHub component for document editing and conversion --- ...ument_Conversion_Engine_Research_Report.md | 1056 +++++++++++++++++ frontend/.env | 3 +- frontend/src/App.tsx | 14 + frontend/src/components/ProductHub.tsx | 87 ++ frontend/src/components/TopBar.tsx | 4 +- 5 files changed, 1162 insertions(+), 2 deletions(-) create mode 100644 DocQube_Document_Conversion_Engine_Research_Report.md create mode 100644 frontend/src/components/ProductHub.tsx diff --git a/DocQube_Document_Conversion_Engine_Research_Report.md b/DocQube_Document_Conversion_Engine_Research_Report.md new file mode 100644 index 0000000..0be3403 --- /dev/null +++ b/DocQube_Document_Conversion_Engine_Research_Report.md @@ -0,0 +1,1056 @@ +# DocQube Document Conversion Engine — Comprehensive Technology Research Report + +**Product:** DocQube ([https://docqube.com/](https://docqube.com/)) +**Document Type:** Enterprise Architecture & Technology Evaluation +**Audience:** Engineering Leadership & Executive Management +**Research Date:** August 2026 +**OCR Decision (Locked):** Mistral OCR 4 (`mistral-ocr-4-0`) as primary document extraction engine +**Open-Source License Scope (Locked):** MIT + BSD + ISC + HPND only (Apache 2.0, GPL, LGPL, AGPL, MPL excluded from primary recommendations) + +--- + +## 1. Executive Summary + +DocQube requires a production-grade **Document Conversion Engine** that converts between business document formats while preserving layout, tables, images, charts, metadata, hyperlinks, and headers/footers—complementing the already-selected **Mistral OCR** extraction layer. + +**Critical distinction:** Mistral OCR extracts text/structure from documents. It is **not** a format converter (PDF↔DOCX). DocQube needs **both** layers. + +**Key finding:** Under a permissive open-source license policy (MIT/BSD/ISC/HPND), **no single open-source library delivers high-fidelity bidirectional PDF ↔ Microsoft Office conversion**. The viable path is a **cost-optimized hybrid architecture**: + + +| Layer | Role | Recommended Technology | +| ----- | ---- | ---------------------- | +| Extraction (OCR) | Scanned/image PDFs → structured text/tables/blocks | **Mistral OCR 4** — $4/1k pages API, **$2/1k Batch** | +| Open-source conversion (default) | HTML/MD/TXT/CSV/JSON, generate Office/PDF, images, AI Markdown | **python-docx + openpyxl + python-pptx + pypdf + reportlab + WeasyPrint + Pillow + MarkItDown** | +| Paid conversion — low cost | Most format conversions at lowest API spend | **ConvertAPI** (~$0.007–$0.035 / conversion) | +| Paid conversion — fidelity | High-fidelity PDF ↔ DOCX/PPTX/XLSX | **Aspose** (Cloud; Docker self-host at scale) | +| On-prem / air-gapped SKU | Regulated customers needing data residency | **Apryse** or **Nutrient** (not for cost optimization) | + + +**Investment posture:** Default to OSS for free API cost → ConvertAPI for cheap paid conversions → Aspose only when layout fidelity matters → Apryse/Nutrient later for Enterprise on-prem. Use Mistral OCR 4 **Batch API** for async pipelines to cut OCR cost 50%. Avoid AGPL dependencies (PyMuPDF via pdf2docx). + +--- + +## 1A. Decision Shortlist — Best Open-Source, Mistral OCR 4 Costing & Lowest-Cost Paid Conversion + +> This section is the management-ready buy list for DocQube under the locked OCR and license constraints. + +### 1A.1 Open-Source Best Choices (MIT + BSD + ISC + HPND Only) + +There is **no single OSS conversion engine**. Use this **composed stack**: + + +| Use | Library | License | Why pick it | +| --- | ------- | ------- | ----------- | +| DOCX | `python-docx` | MIT | Best MIT Word create/edit | +| XLSX | `openpyxl` | MIT | Best MIT Excel | +| PPTX | `python-pptx` | MIT | Best MIT PowerPoint | +| PDF utilities | `pypdf` | BSD | Merge/split/metadata | +| PDF generate | `reportlab` | BSD | Build PDFs from data | +| HTML → PDF | `WeasyPrint` | BSD | Best permissive HTML→PDF | +| Images | `Pillow` | HPND | PNG/JPEG/TIFF | +| → Markdown (AI/search) | `MarkItDown` | MIT | Feeds DocQube AI indexing | + + +**Do not use on OSS path:** `pdf2docx` (project is MIT, but depends on **PyMuPDF = AGPL**). + +**What OSS handles well:** HTML/MD/TXT/CSV/JSON, generate Office/PDF, images, AI Markdown. +**What OSS cannot do well:** high-fidelity PDF → editable DOCX/PPTX/XLSX — that needs paid APIs. + +### 1A.2 Mistral OCR 4 Costing (Locked Extraction Layer) + +Official Mistral OCR 4 pricing (announced June 2026): + + +| Product | Model ID | Price | Per page | +| ------- | -------- | ----- | -------- | +| **OCR 4 API** | `mistral-ocr-4-0` | **$4 / 1,000 pages** | **$0.004** | +| **OCR 4 Batch API** | same | **$2 / 1,000 pages** (50% off) | **$0.002** | +| **Document AI** (schema JSON on top of OCR) | OCR + annotation | **$5 / 1,000 pages** | **$0.005** | + + +**Volume examples — OCR only (assume 10 pages/document):** + + +| Docs/day | Pages/month (approx) | OCR 4 API | OCR 4 Batch | +| -------- | -------------------- | --------- | ----------- | +| 100 | 30,000 | **$120** | **$60** | +| 1,000 | 300,000 | **$1,200** | **$600** | +| 10,000 | 3,000,000 | **$12,000** | **$6,000** | +| 100,000 | 30,000,000 | **$120,000** | **$60,000** | + + +**Guidance:** Use the **Batch API** for non-interactive DocQube pipelines to cut OCR cost in half. Self-host OCR 4 is available for enterprise (infra cost only; contact Mistral sales). OCR returns markdown/blocks/confidence — it does **not** replace PDF↔Office conversion. + +### 1A.3 Paid Conversion — Best Low-Cost Choices + +Ranked for **cost efficiency first**, then quality: + + +| Rank | Vendor | Role | Approx cost | Quality | Verdict | +| ---- | ------ | ---- | ----------- | ------- | ------- | +| **1** | **ConvertAPI** | Primary low-cost converter | ~**$0.007–$0.035 / conversion** | Good–Strong | **Best cheap paid pick** for most DocQube conversions | +| **2** | **Aspose Cloud** | Fidelity PDF↔Office when quality matters | ~**$0.007–$0.09 / call** (drops at volume) | Excellent | **Best quality/price at scale** | +| **3** | **Foxit API** | Predictable mid-volume | Business ≈ **$0.03 / op** ($4,500/yr ÷ 150k credits) | Strong | Good if volume is steady | +| **4** | **Cloudmersive** | Budget multi-API + convert | Plans from **~$20/mo**; ~**$0.002–$0.01** effective | Medium–Good | Cheap; quality below Aspose/Adobe | +| Avoid as primary if cost-sensitive | Adobe (~$0.05/txn) | Premium fidelity | Expensive at scale | Excellent | Only if Adobe brand/quality is required | +| Avoid for low cost | Apryse / Nutrient | On-prem enterprise | Often **$25k–$150k+/yr** | Excellent | Only for Enterprise on-prem | + + +#### ConvertAPI plan math (published) + + +| Plan | $/mo | Conversions included | Effective $/doc | +| ---- | ---- | -------------------- | --------------- | +| Developer | ~$35 | 1,000 | ~$0.035 | +| Startup | ~$95 | 5,000 | ~$0.019 | +| Growth | ~$175 | 15,000 | ~$0.012 | +| Business | ~$350 | 50,000 | ~$0.007 | + + +#### Aspose Cloud (official tiers — purchase.aspose.cloud) + + +| Band | Rate | +| ---- | ---- | +| 0–150 calls | Free | +| Next 1,000 | $30 flat | +| Next 14,000 | $0.09 / call | +| Next 15,000 | $0.07 / call | +| Next 60,000 | $0.05 / call | +| Beyond | **$0.007 / call** | + + +At high volume, Aspose approaches ConvertAPI pricing **with better Office↔PDF fidelity**. + +### 1A.4 Side-by-Side: OCR vs Conversion Cost + +Example: **1,000 docs/day**, 10 pages/doc, 30-day month: + + +| Layer | Est. monthly | +| ----- | ------------ | +| Mistral OCR 4 (API) | ~**$1,200** | +| Mistral OCR 4 (Batch) | ~**$600** | +| ConvertAPI (all conversions on Business plan) | ~**$350** (+ overage if >50k) | +| Aspose (all conversions) | ~**$2,300** | +| **Hybrid: ~60% OSS + ConvertAPI for most paid + Aspose for fidelity** | ~**$800–$1,000** conversion + OCR separate | + + +OCR can cost more than conversion at scale — that is normal. They solve different problems. There is **no Mistral-priced conversion API** from Mistral; the closest low-cost conversion analogs are **ConvertAPI** (cents per file) or **OSS** (~$0 API). + +### 1A.5 What DocQube Should Build + + +``` +┌─────────────────────────────────────────────┐ +│ DocQube Document Engine │ +├─────────────────────────────────────────────┤ +│ EXTRACTION (locked) │ +│ Mistral OCR 4 → $0.002–$0.004 / page │ +│ Use Batch API for async pipelines │ +├─────────────────────────────────────────────┤ +│ CONVERSION – Open source (default, ~$0 API) │ +│ python-docx + openpyxl + python-pptx │ +│ + pypdf + reportlab + WeasyPrint + Pillow │ +│ + MarkItDown │ +├─────────────────────────────────────────────┤ +│ CONVERSION – Paid (only when needed) │ +│ ConvertAPI → low-cost default paid path │ +│ Aspose → PDF↔DOCX/PPTX/XLSX fidelity │ +└─────────────────────────────────────────────┘ +``` + +### 1A.6 Cost-Optimized Routing Rules + +1. **Scanned / extract text** → Mistral OCR 4 (Batch if possible) +2. **HTML/MD/TXT/CSV/JSON / generate Office/PDF** → OSS (cheapest) +3. **Most format conversions** → **ConvertAPI** (lowest paid cost) +4. **Customer-facing high-fidelity PDF↔Word/Excel/PPT** → **Aspose** +5. **On-prem Enterprise later** → Apryse/Nutrient (not for cost optimization) + +### 1A.7 Direct Answers + + +| Question | Answer | +| -------- | ------ | +| Best OSS stack? | Composed MIT/BSD fabric in §1A.1 | +| Best cheap paid converter? | **ConvertAPI** | +| Best paid for quality still cost-aware? | **Aspose** (especially after volume hits $0.007 tier) | +| Is there a “Mistral-cheap” conversion API? | Not from Mistral — OCR is extraction only. Closest: **ConvertAPI** or **OSS** | +| Mistral OCR 4 cost? | **$4/1k pages** API, **$2/1k** Batch, **$5/1k** Document AI | + +--- + +## 2. Technology Comparison Tables + +### 2.1 Open-Source vs Commercial at a Glance + + +| Dimension | Permissive OSS Fabric | Commercial APIs/SDKs | +| ----------------------------------- | -------------------------------------------- | --------------------------------------------------- | +| Bidirectional PDF ↔ Office fidelity | Weak / incomplete | Strong (Adobe, Aspose, Apryse, Nutrient, Foxit) | +| License risk for SaaS | Low (if deps audited) | Commercial license / SaaS ToS | +| Cost at 100 docs/day | Near $0 API + infra | Low–moderate | +| Cost at 100k docs/day | Infra-dominant | API-dominant unless self-hosted SDK | +| Format breadth | Narrow–medium | Very broad | +| Layout preservation | Fair for generate paths; poor for PDF→Office | Excellent | +| Ops burden | Higher (you run workers) | Lower for cloud APIs; higher for self-hosted SDKs | +| Data residency | Full control | Cloud APIs send files off-box; SDKs keep data local | + + +### 2.2 Recommended Hybrid Routing Matrix + + +| Conversion Path | Preferred Engine | Fallback | +| ------------------------------------ | -------------------------- | --------------------- | +| DOCX/PPTX/XLSX → PDF (high fidelity) | Aspose | ConvertAPI / Foxit | +| PDF → DOCX/PPTX/XLSX | Aspose | ConvertAPI | +| Most format conversions (cost-first) | **ConvertAPI** | Aspose / CloudConvert | +| HTML/Markdown → PDF | WeasyPrint (OSS) | ConvertAPI / Aspose | +| Office ↔ Markdown/JSON (search/LLM) | MarkItDown + OSS parsers | — | +| Images ↔ PDF / raster | Pillow + pypdf / reportlab | ConvertAPI | +| Scanned PDF → text/tables | **Mistral OCR 4** (Batch preferred) | Document AI ($5/1k) | +| CSV/XML/JSON ↔ tabular | openpyxl + stdlib | — | +| Exotic / long-tail formats | ConvertAPI / CloudConvert | Zamzar | + + +--- + +## 3. Open-Source Analysis (MIT + BSD + ISC + HPND) + +### 3.1 License Scope & Exclusions + +**In scope:** MIT, BSD (2/3-clause), ISC, HPND +**Out of scope for primary stack:** Apache 2.0, GPL, LGPL, AGPL, MPL + +**Explicitly excluded (notable):** LibreOffice (MPL/LGPL), Pandoc (GPL), Ghostscript (AGPL), ImageMagick (ImageMagick License / historically restrictive for some deployments), Apache PDFBox / POI (Apache 2.0), Unstructured (Apache 2.0), pdfjs (Apache 2.0). + +**Critical dependency warning:** `pdf2docx` itself is MIT (relicensed March 2026), but depends on **PyMuPDF (AGPL)**. Using it in closed-source SaaS without an Artifex commercial license creates AGPL network-copyleft risk. **Not recommended** for DocQube OSS path. + +--- + +### 3.2 Candidate Profiles + +#### A. python-docx + + +| Attribute | Assessment | +| -------------------------------- | ---------------------------------------------------------------------------------------------- | +| **License** | MIT | +| **GitHub** | [https://github.com/python-openxml/python-docx](https://github.com/python-openxml/python-docx) | +| **Language** | Python | +| **Last Active** | Aug 2026 (active) | +| **Stars / Forks** | ~5.7k / ~1.3k | +| **Production Readiness** | High — de facto standard for DOCX generation/edit | +| **Performance** | Good for create/edit; not a PDF converter | +| **Conversion Quality** | N/A for PDF; excellent for programmatic DOCX | +| **Formatting / Tables / Images** | Strong for authored docs; limited round-trip from PDF | +| **OCR Compatibility** | Consumes structured OCR output to rebuild DOCX | +| **Formats** | DOCX (primary) | +| **Deployment** | Library in worker containers | +| **Scalability** | Excellent (stateless CPU workers) | +| **Advantages** | Mature, MIT, no Office install, FastAPI-friendly | +| **Limitations** | Cannot convert PDF→DOCX with layout fidelity | +| **Enterprise Readiness** | High for generation pipelines | +| **Recommendation** | **Core — include** | + + +#### B. openpyxl + + +| Attribute | Assessment | +| ------------------------ | ----------------------------------------------------------------------------------------------------------- | +| **License** | MIT/Expat | +| **Repository** | [https://foss.heptapod.net/openpyxl/openpyxl](https://foss.heptapod.net/openpyxl/openpyxl) (PyPI: openpyxl) | +| **Language** | Python | +| **Last Active** | Mature / maintained (v3.1.x) | +| **Stars / Forks** | Widely adopted (Heptapod host; not GitHub-primary) | +| **Production Readiness** | High | +| **Performance** | Good; memory grows with large workbooks | +| **Conversion Quality** | Excellent for XLSX create/edit; CSV↔XLSX | +| **Tables / Images** | Tables strong; charts/images partial | +| **OCR Compatibility** | Good target for tabular OCR JSON → sheets | +| **Formats** | XLSX, XLSM, XLTX, XLTM | +| **Deployment** | Library | +| **Scalability** | High; stream/write carefully for huge files | +| **Advantages** | MIT, no Excel install, formula support | +| **Limitations** | Not a PDF engine; chart fidelity limited | +| **Enterprise Readiness** | High | +| **Recommendation** | **Core — include** | + + +#### C. python-pptx + + +| Attribute | Assessment | +| ------------------------ | ------------------------------------------------------------------------------ | +| **License** | MIT | +| **GitHub** | [https://github.com/scanny/python-pptx](https://github.com/scanny/python-pptx) | +| **Language** | Python | +| **Last Active** | Last major push Aug 2024 (stable; slower cadence) | +| **Stars / Forks** | ~3.5k / ~730 | +| **Production Readiness** | High for generation | +| **Performance** | Good | +| **Conversion Quality** | Strong for create/edit PPTX; weak as PDF→PPTX | +| **Formatting / Images** | Good for authored slides | +| **OCR Compatibility** | Can place OCR text/images onto slides | +| **Formats** | PPTX | +| **Deployment** | Library | +| **Scalability** | High | +| **Advantages** | MIT, no PowerPoint install | +| **Limitations** | Maintenance cadence slower; not a PDF converter | +| **Enterprise Readiness** | Medium–High | +| **Recommendation** | **Core — include** | + + +#### D. pypdf + + +| Attribute | Assessment | +| -------------------------------- | ------------------------------------------------------------------ | +| **License** | BSD-3-Clause | +| **GitHub** | [https://github.com/py-pdf/pypdf](https://github.com/py-pdf/pypdf) | +| **Language** | Python | +| **Last Active** | Aug 2026 (very active) | +| **Stars / Forks** | ~10.1k / ~1.6k | +| **Production Readiness** | High | +| **Performance** | Good for merge/split/rotate; pure Python | +| **Conversion Quality** | Structural ops excellent; text extract OK; layout→Office poor | +| **Formatting / Tables / Images** | Limited semantic reconstruction | +| **OCR Compatibility** | Pair with Mistral OCR for scanned pages | +| **Formats** | PDF | +| **Deployment** | Library; Lambda-friendly | +| **Scalability** | Excellent | +| **Advantages** | Permissive, zero heavy native deps, active community | +| **Limitations** | Not a fidelity conversion engine | +| **Enterprise Readiness** | High for PDF utilities | +| **Recommendation** | **Core — include** | + + +#### E. reportlab + + +| Attribute | Assessment | +| -------------------------------- | -------------------------------------------------------------------- | +| **License** | BSD (Open Source); commercial ReportLab PLUS available | +| **Site / PyPI** | [https://www.reportlab.com/](https://www.reportlab.com/) / reportlab | +| **Language** | Python | +| **Last Active** | Actively maintained | +| **Stars / Forks** | Long-standing industry standard | +| **Production Readiness** | Very High for PDF generation | +| **Performance** | Excellent | +| **Conversion Quality** | Best-in-class for *generated* PDFs from code/data | +| **Formatting / Tables / Images** | Excellent when you control layout | +| **OCR Compatibility** | Can render OCR results into PDFs | +| **Formats** | PDF (output) | +| **Deployment** | Library | +| **Scalability** | Excellent | +| **Advantages** | Proven at enterprise report scale | +| **Limitations** | Not PDF→Office; steeper API for complex layouts | +| **Enterprise Readiness** | Very High | +| **Recommendation** | **Core — include** for generate-to-PDF | + + +#### F. WeasyPrint + + +| Attribute | Assessment | +| -------------------------------- | -------------------------------------------------------------------------- | +| **License** | BSD-3-Clause | +| **GitHub** | [https://github.com/Kozea/WeasyPrint](https://github.com/Kozea/WeasyPrint) | +| **Language** | Python | +| **Last Active** | Aug 2026 (active) | +| **Stars / Forks** | ~9.5k / ~860 | +| **Production Readiness** | High | +| **Performance** | Good; CSS layout is CPU-bound | +| **Conversion Quality** | Strong HTML/CSS → PDF | +| **Formatting / Tables / Images** | Strong for web-like documents | +| **OCR Compatibility** | Indirect (HTML wrapping OCR HTML) | +| **Formats** | HTML/CSS → PDF | +| **Deployment** | Needs system libs (Pango/Cairo/GDK); Dockerize carefully | +| **Scalability** | Horizontal workers; watch memory | +| **Advantages** | Best permissive HTML→PDF option | +| **Limitations** | Native deps; not Office conversion | +| **Enterprise Readiness** | High (with hardened containers) | +| **Recommendation** | **Core — include** for HTML/MD→PDF path | + + +#### G. Pillow + + +| Attribute | Assessment | +| ------------------------ | ---------------------------------------------------------------------------------- | +| **License** | HPND (permissive, MIT-like) | +| **GitHub** | [https://github.com/python-pillow/Pillow](https://github.com/python-pillow/Pillow) | +| **Language** | Python | +| **Last Active** | Aug 2026 | +| **Stars / Forks** | ~13.7k / ~2.5k | +| **Production Readiness** | Very High | +| **Performance** | Excellent | +| **Conversion Quality** | Image format conversion excellent | +| **Formats** | PNG, JPEG, TIFF, WebP, etc. | +| **Deployment** | Library | +| **Scalability** | Excellent | +| **Advantages** | Universal image I/O | +| **Limitations** | Not a document layout engine | +| **Enterprise Readiness** | Very High | +| **Recommendation** | **Core — include** | + + +#### H. MarkItDown (Microsoft) + + +| Attribute | Assessment | +| --------------------------- | ---------------------------------------------------------------------------------- | +| **License** | MIT | +| **GitHub** | [https://github.com/microsoft/markitdown](https://github.com/microsoft/markitdown) | +| **Language** | Python | +| **Last Active** | Jul 2026 | +| **Stars / Forks** | ~172k / ~12.5k | +| **Production Readiness** | High for LLM/search ingestion | +| **Performance** | Fast for text extraction paths | +| **Conversion Quality** | **Lossy** for human-fidelity export; strong for structure→Markdown | +| **Formatting Preservation** | Headings/lists/tables/links prioritized; not pixel-perfect | +| **Formats** | PDF, DOCX, PPTX, XLSX, images, HTML, etc. → Markdown | +| **Deployment** | Library / CLI | +| **Scalability** | High | +| **Advantages** | Perfect for DocQube AI indexing & chat | +| **Limitations** | Not a fidelity conversion engine for customer “Download as DOCX” | +| **Enterprise Readiness** | High for AI pipelines | +| **Recommendation** | **Core — include** for search/AI; **not** for fidelity exports | + + +#### I. pdf2docx (evaluated — not recommended as OSS) + + +| Attribute | Assessment | +| ------------------------ | ------------------------------------------------------------------------------------------ | +| **License** | MIT (project) — **runtime depends on PyMuPDF AGPL** | +| **GitHub** | [https://github.com/ArtifexSoftware/pdf2docx](https://github.com/ArtifexSoftware/pdf2docx) | +| **Stars / Forks** | ~3.5k / ~494 | +| **Last Active** | Artifex ceased active maintenance (Mar 2026); relicensed MIT | +| **Production Readiness** | Medium historically; **maintenance risk now High** | +| **Conversion Quality** | Better than naive PDF→DOCX OSS options | +| **Enterprise Readiness** | **Blocked** without commercial PyMuPDF license | +| **Recommendation** | **Do not use** on OSS path; optional only with Artifex commercial license | + + +#### J. Supporting permissive libraries + + +| Library | License | Role | +| -------------- | ------- | ---------------------------- | +| markdown-it-py | MIT | Markdown → HTML intermediate | +| BeautifulSoup4 | MIT | HTML/XML parse | +| lxml | BSD | XML/HTML performance layer | +| XlsxWriter | BSD | Fast XLSX write alternative | + + +--- + +### 3.3 Best MIT/BSD Open-Source Stack for DocQube + +**Recommended composed stack (“DocQube Permissive Conversion Fabric”):** + +``` +python-docx + openpyxl + python-pptx ++ pypdf + reportlab + WeasyPrint + Pillow ++ MarkItDown + markdown-it-py + BeautifulSoup4 +``` + +**What this stack does well** + +- Programmatic Office document creation/editing +- HTML/Markdown → PDF +- PDF utility ops (merge, split, rotate, metadata) +- Image conversions +- Lossy structured Markdown for AI/search +- CSV/JSON/XML tabular flows via openpyxl/stdlib + +**What this stack does NOT do well** + +- High-fidelity PDF → editable DOCX/PPTX/XLSX +- Complex chart/header/footer/font subset preservation on reverse conversions +- Pixel-perfect Office ↔ PDF without commercial engines + +**Overall OSS recommendation:** Adopt the fabric above as **Tier-1 default** for eligible jobs; escalate fidelity jobs to commercial Tier-3. + +--- + +## 4. Commercial API Analysis + +### 4.1 Adobe PDF Services API + + +| Attribute | Detail | +| ------------------------- | ------------------------------------------------------------------------------------------------------------ | +| **Pricing Model** | Document Transactions (operation-based) | +| **API Pricing** | Free 500 txn/month; paid via VIP/ETLA (historically cited ~$0.05/txn in Adobe materials; confirm with sales) | +| **Free Tier** | 500 Document Transactions / month | +| **Enterprise Pricing** | Custom (ETLA / VIP) | +| **Deployment** | Cloud API | +| **On-Premise** | Not primary (Adobe PDF Library via partners for on-prem) | +| **Self-Hosted** | Limited via partner SDKs, not the SaaS API | +| **Security & Compliance** | Enterprise Adobe trust/compliance portfolio; SOC/ISO via Adobe | +| **Formats** | PDF ↔ DOC/DOCX/PPTX/XLSX/RTF/JPEG/PNG; Extract; Markdown | +| **Conversion Quality** | Excellent (Adobe engine) | +| **Speed / Scalability** | Strong cloud scale | +| **SDK / REST** | SDKs + REST | +| **Batch / Large Files** | Supported with content limits per licensing docs | +| **Watermark** | Free tier usage limits, not always watermarked output | +| **OCR / AI** | Extract / accessibility / related AI services available | +| **Pros** | Best-in-class PDF fidelity; brand trust | +| **Cons** | Cloud-centric; opaque enterprise pricing; transaction metering complexity | +| **Best Use Cases** | Premium PDF↔Office where Adobe quality is a selling point | + + +### 4.2 Aspose (Cloud + Self-Hosted) + + +| Attribute | Detail | +| ------------------------- | ---------------------------------------------------------------------------------------- | +| **Pricing Model** | Pay-as-you-go API calls (same model for self-host Docker billing except storage calls) | +| **API Pricing** | 150 free/mo; next 1,000 = $30 flat; then $0.09 → $0.07 → $0.05 → $0.007 / call by volume | +| **Free Tier** | 150 API calls / month | +| **Enterprise** | Volume discounts; self-host options | +| **Deployment** | Cloud + Docker self-host | +| **On-Prem / Self-Hosted** | Yes | +| **Security** | Cloud DPA; self-host keeps files local | +| **Formats** | Extremely broad (Words/Cells/Slides/PDF/HTML/EPUB/images/etc.) | +| **Quality** | Excellent Office ↔ PDF bidirectional | +| **Speed / Scale** | High; self-host for predictable throughput | +| **SDK / REST** | Java, .NET, Python, Node, PHP, Go, Ruby, etc. + REST | +| **Batch / Large Files** | Strong | +| **OCR / AI** | Available in product family | +| **Pros** | Best balance of fidelity, format breadth, SDK maturity, self-host option | +| **Cons** | Cost rises until high-volume $0.007 tier; multiple products to license for full suite | +| **Best Use Cases** | **DocQube primary commercial conversion engine** | + + +### 4.3 Apryse (PDFTron) + + +| Attribute | Detail | +| ------------------------- | ---------------------------------------------------------------------------------------------------------- | +| **Pricing Model** | Quote-only modular SDK licensing | +| **API Pricing** | No public list; packages from ~$1,500 entry (vendor claim); enterprise typically five–six figures annually | +| **Free Tier** | Trial keys | +| **Enterprise** | Custom OEM / per-server / volume | +| **Deployment** | Client-side WebViewer, Server SDK, Mobile; on-prem & private cloud | +| **On-Prem / Self-Hosted** | Excellent | +| **Security** | Strong for regulated / air-gapped | +| **Formats** | PDF + Office conversion modules + CAD/OCR add-ons | +| **Quality** | Excellent | +| **SDK / REST** | SDKs primary; server processing | +| **Pros** | Best-in-class self-hosted control; modular | +| **Cons** | Sales cycle; cost opacity; module add-ons (OCR/Office) | +| **Best Use Cases** | Enterprise on-prem DocQube SKUs | + + +### 4.4 Foxit PDF SDK / Foxit APIs + + +| Attribute | Detail | +| ------------------ | ------------------------------------------------------------------------------------------------------------- | +| **Pricing Model** | Cloud: credit plans; SDK: quote-based | +| **Cloud Pricing** | Free 500 credits/year; Startup $1,750/yr (3,500 credits); Business $4,500/yr (150,000 credits); Volume custom | +| **Metering** | Typically 1 credit per operation (convert to/from PDF, merge, OCR, etc.) | +| **On-Prem** | PDF SDK + Conversion add-on (sales quote) | +| **Formats** | Office ↔ PDF, HTML, images, etc. | +| **Quality** | Strong | +| **Pros** | Predictable 1-op=1-credit cloud math; solid PDF vendor | +| **Cons** | Annual credit pools; SDK conversion modular licensing | +| **Best Use Cases** | Mid-volume cloud conversion; alternative to Adobe | + + +### 4.5 Nutrient (formerly PSPDFKit) + + +| Attribute | Detail | +| ---------------------------------------- | ------------------------------------------------------------------------------------------------ | +| **Pricing Model** | Component annual subscriptions; DWS cloud usage credits | +| **Enterprise Bands (secondary sources)** | Cloud often $15k–$150k+/yr; self-host Document Engine commonly $25k–$200k+/yr depending on scope | +| **Deployment** | Web SDK, Document Engine (self-host/managed), DWS APIs | +| **On-Prem** | Yes (including air-gapped offline licenses) | +| **Formats** | 100+ via conversion SDK; Office without requiring MS Office install | +| **Quality** | Excellent fidelity claims (fonts/colors/layout/metadata) | +| **Pros** | Viewer + processing + conversion platform; strong enterprise story | +| **Cons** | Quote-heavy; can overlap Apryse in procurement | +| **Best Use Cases** | Full document platform (view + convert + process) on-prem | + + +> Note: Nutrient and PSPDFKit are the same product line post-rebrand—evaluate once, not twice. + +### 4.6 CloudConvert API + + +| Attribute | Detail | +| ------------------ | -------------------------------------------------------------------------------------------- | +| **Pricing** | Free 10/day; packages (credits never expire) + subscriptions (monthly reset, cheaper/credit) | +| **Credit Rules** | Base credits by type: General 1, Office→PDF 2, PDF→Office **4**; + time-based credits | +| **Enterprise** | Custom, SLA, SSO, DPA | +| **Deployment** | Cloud | +| **Formats** | Extremely broad (200+) | +| **Quality** | Good utility conversion; not always Adobe-class layout | +| **Pros** | Format breadth; flexible packages | +| **Cons** | PDF→Office expensive in credits; subscription credits expire | +| **Best Use Cases** | Long-tail formats; secondary fallback | + + +### 4.7 Microsoft Graph Conversion APIs + + +| Attribute | Detail | +| ------------------ | ---------------------------------------------------------------------------------------------------------------- | +| **Pricing** | Included with Microsoft 365 / Graph (not a per-conversion metered conversion fee for standard `content?format=`) | +| **Formats** | Many sources → **PDF** or **JPG**; HTML limited | +| **Constraint** | File must live in OneDrive/SharePoint | +| **Quality** | Strong Office→PDF (Microsoft renderer) | +| **Pros** | High quality Office→PDF if already on M365 | +| **Cons** | Not a general converter; reverse PDF→Office not the model; tenancy coupling | +| **Best Use Cases** | Optional path for M365-connected enterprise tenants | + + +### 4.8 [PDF.co](http://PDF.co) + + +| Attribute | Detail | +| ------------------ | --------------------------------------------------------------------------------------------------- | +| **Pricing** | Credit subscriptions (e.g., ~$9–$270+/mo tiers; Enterprise custom); credits vary per endpoint/pages | +| **Deployment** | Cloud REST | +| **Formats** | PDF-centric convert/merge/split/OCR | +| **Pros** | Developer-friendly; OCR + PDF utilities | +| **Cons** | Credit complexity (sync vs async job/check costs); less “suite” than Aspose | +| **Best Use Cases** | PDF utility automation, not primary Office fidelity engine | + + +### 4.9 Zamzar API + + +| Attribute | Detail | +| ------------------ | ---------------------------------------------------------------------------------------------------------- | +| **Pricing** | Free test 100 credits; Startup $25/mo (500); Growth $99 (2,500); Scale $299 (10,000); overages $0.03–$0.05 | +| **Deployment** | Cloud | +| **Formats** | Broad classic converter set | +| **Pros** | Simple; long market presence | +| **Cons** | Not premium layout engine; file retention windows | +| **Best Use Cases** | SMB / long-tail / low complexity | + + +### 4.10 ConvertAPI + + +| Attribute | Detail | +| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------- | +| **Pricing** | Free 250 trial; Developer ~$35/mo (1k); Startup ~$95 (5k); Growth ~$175 (15k); Business ~$350 (50k); Enterprise custom; annual −20% | +| **Deployment** | Cloud REST; AWS Marketplace | +| **Formats** | 200+ | +| **Quality** | Strong practical conversions; good developer DX | +| **Pros** | Clear plans; NDA/DPA on paid tiers; concurrent limits scale with plan | +| **Cons** | Cloud-only; overage risk if undersized | +| **Best Use Cases** | **Recommended secondary commercial** for DocQube | + + +### 4.11 Other Notes + + +| Vendor | Note | +| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | +| **Gotenberg** | Useful Docker PDF API wrapping LibreOffice/Chromium — **LibreOffice license out of primary OSS scope**; optional ops discussion only | +| **Iron Software** | Commercial .NET suite; alternative if DocQube backend is .NET-first | +| **Datalogics / Adobe PDF Library** | On-prem Adobe engine partner route | + + +--- + +## 5. Pricing & Cost Comparison + +### 5.1 Assumptions + +- Average document = **10 pages** +- **1 conversion = 1 billable API call/credit** unless vendor rules say otherwise +- CloudConvert PDF→Office counted as **4 base credits** +- Adobe modeled at **$0.05 / Document Transaction** (public historical reference; confirm with Adobe sales) +- OSS cost = **infrastructure only** (illustrative) +- Currency: USD +- Month = 30 days + +### 5.2 Monthly Volume Scenarios + + +| Daily Volume | Monthly Conversions | +| ------------ | ------------------- | +| 100 | 3,000 | +| 1,000 | 30,000 | +| 10,000 | 300,000 | +| 100,000 | 3,000,000 | + + +### 5.3 Estimated Monthly API Spend (Conversion Only) + + +| Vendor | 3,000/mo | 30,000/mo | 300,000/mo | 3,000,000/mo | +| ----------------------------------- | ----------------------------------------------------------------------- | --------------------------- | --------------------------------------------------- | ------------------ | +| **Aspose Cloud** | ~$197 | ~$2,330 | ~$6,810 | ~$25,700 | +| **Adobe (~$0.05)** | ~$150 | ~$1,500 | ~$15,000 | ~$150,000 | +| **Foxit** | Business plan territory (~$375/mo annualized) if within 150k credits/yr | Business OK until ~12.5k/mo | **Volume custom** | **Volume custom** | +| **ConvertAPI** | Startup $95 (5k incl.) | Growth/Business $175–$350 | Enterprise (~$700+ listed 100k tier; custom beyond) | Custom | +| **Zamzar** | Scale $299 + overage | Custom / expensive overage | Not ideal | Not ideal | +| **CloudConvert (PDF→Office @4 cr)** | Credits ≈ 12k → mid subscription/package | High | Enterprise | Enterprise | +| **Microsoft Graph** | $0 conversion fee* | $0* | $0* | $0* | +| **Apryse / Nutrient** | N/A usage; annual license | Annual license | Self-host wins TCO | Self-host wins TCO | + + +Requires M365 + OneDrive/SharePoint storage/ops costs; not free total cost. + +#### Aspose tier math (reference) + + +| Band | Rate | +| ----------- | -------- | +| 0–150 | Free | +| Next 1,000 | $30 flat | +| Next 14,000 | $0.090 | +| Next 15,000 | $0.070 | +| Next 60,000 | $0.050 | +| Additional | $0.007 | + + +### 5.4 Hybrid Cost Model (Recommended) + +Assume routing mix at mature DocQube scale: + +- **60% OSS** (HTML/MD/TXT/CSV/JSON, generated PDFs, simple rasters, AI Markdown) +- **35% Aspose** (PDF ↔ Office fidelity) +- **5% ConvertAPI** (long-tail) + + +| Daily Total | Monthly Total | Est. Aspose Calls (35%) | Est. Aspose $/mo | ConvertAPI (5%) | OSS Infra* | **Total Est.** | +| ----------- | ------------- | ----------------------- | ---------------- | --------------- | ---------- | ------------------------------------------- | +| 100 | 3,000 | 1,050 | ~$30–$100 | ~$35 | ~$150 | **~$250–$350** | +| 1,000 | 30,000 | 10,500 | ~$900 | ~$95 | ~$800 | **~$1.8k–$2.2k** | +| 10,000 | 300,000 | 105,000 | ~$2.6k | Enterprise | ~$4k–$8k | **~$8k–$15k** | +| 100,000 | 3,000,000 | 1,050,000 | ~$8.5k | Custom | ~$25k–$60k | **Prefer self-host Aspose/Apryse/Nutrient** | + + +Infra = K8s workers, Redis queue, object storage, egress, observability (order-of-magnitude). + +### 5.5 Hidden & Operational Costs + + +| Cost Type | Examples | +| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | +| **Hidden API** | Retries, multi-step pipelines (merge+convert+OCR = multiple charges), CloudConvert PDF→Office 4× credits, PDF.co job/check credits | +| **Infrastructure** | GPU rarely needed for conversion; CPU/RAM for WeasyPrint/Office rebuild; storage of originals+derivatives | +| **Maintenance** | Dependency upgrades, font packs, malformed file handling, regression golden-file tests | +| **Compliance** | DPA, SOC2 evidence, regional residency, customer data processing agreements | +| **Support** | Enterprise vendor SLAs; on-call for conversion failures | +| **Licensing traps** | AGPL transitive deps (PyMuPDF), font licensing, OEM redistribution clauses | + + +### 5.6 Token-Based Pricing + +Classic document converters are **not token-billed**. Token economics apply to **Mistral OCR / LLM extraction**, not to Aspose/Adobe/ConvertAPI conversion. Model OCR tokens separately in the extraction budget; do not conflate with conversion COGS. + +--- + +## 6. Feature Comparison Matrix + + +| Capability | OSS Fabric | Aspose | Adobe | Apryse | Nutrient | Foxit | ConvertAPI | CloudConvert | Graph | Zamzar | PDF.co | +| -------------------- | --------------------------------------- | --------- | -------------- | ------------ | ------------ | ------------ | ---------- | ------------ | ----------- | ------- | --------- | +| PDF→DOCX fidelity | Poor | Excellent | Excellent | Excellent | Excellent | Strong | Good | Good | N/A | Fair | Fair–Good | +| DOCX→PDF | Good (via HTML/reportlab) / Fair native | Excellent | Excellent | Excellent | Excellent | Strong | Good | Good | Excellent | Good | Good | +| PPTX/XLSX ↔ PDF | Limited | Excellent | Excellent | Excellent | Excellent | Strong | Good | Good | →PDF strong | Fair | Fair | +| HTML→PDF | **WeasyPrint strong** | Strong | Strong | Strong | Strong | Strong | Strong | Strong | Limited | Fair | Fair | +| Markdown | MarkItDown / Weasy | Via HTML | PDF→MD extract | Via pipeline | Via pipeline | Via pipeline | Yes | Yes | →PDF | Yes | Limited | +| EPUB/ODT/RTF | Limited | Strong | Partial | Strong | Strong | Partial | Strong | Strong | Partial | Strong | Partial | +| Images PNG/JPEG/TIFF | Pillow strong | Strong | Strong | Strong | Strong | Strong | Strong | Strong | JPG out | Strong | Strong | +| SVG | Limited | Strong | Partial | Strong | Strong | Partial | Good | Good | No | Fair | Fair | +| JSON/XML/CSV | Strong (OSS) | Strong | Partial | Partial | Partial | Partial | Good | Good | Partial | Fair | Partial | +| Tables | Generate strong; reverse weak | Excellent | Excellent | Excellent | Excellent | Strong | Good | Good | N/A reverse | Fair | Fair | +| Charts | Weak reverse | Strong | Strong | Strong | Strong | Strong | Fair | Fair | N/A | Weak | Weak | +| Headers/Footers | Weak reverse | Strong | Strong | Strong | Strong | Strong | Fair | Fair | N/A | Weak | Weak | +| Hyperlinks/Metadata | Partial | Strong | Strong | Strong | Strong | Strong | Fair | Fair | Partial | Fair | Fair | +| Digital signatures | Limited | Strong | Strong | Strong | Strong | Strong | Limited | Limited | M365 | Limited | Limited | +| Batch | DIY queue | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Limited | Yes | Yes | +| On-prem | Yes (OSS) | Yes | Limited | **Yes** | **Yes** | SDK Yes | No | No | M365 cloud | No | No | + + +--- + +## 7. Performance Benchmark Comparison + +> **Note:** Figures below are architecture-grade comparisons from vendor documentation, industry practice, and engineering judgment—not a controlled lab benchmark on DocQube hardware. Run a golden-file bake-off before locking vendor contracts. + + +| Criterion | OSS Fabric | Aspose | Adobe | Apryse/Nutrient | ConvertAPI/CloudConvert | +| -------------------------------------------- | ------------------------------------ | ------------- | ---------------- | -------------------- | ----------------------- | +| Conversion accuracy (fidelity) | Medium (generate) / Low (PDF→Office) | Very High | Very High | Very High | Medium–High | +| Layout / formatting | Medium | Very High | Very High | Very High | Medium–High | +| Table accuracy | Medium | Very High | Very High | Very High | Medium–High | +| Image quality | High (Pillow) | High | High | High | High | +| Chart preservation | Low | High | High | High | Medium | +| Hyperlink / header-footer / fonts / metadata | Partial | High | High | High | Medium | +| Digital signatures | Low | High | High | High | Low–Medium | +| Speed | Fast for simple jobs | Fast | Fast | Fast (local) | Network-bound | +| Memory / CPU | Moderate; WeasyPrint heavier | Moderate–High | Cloud-managed | Tunable | Cloud-managed | +| GPU | Not required | Not required | N/A | Optional OCR modules | N/A | +| Parallel / batch / multi-thread | Excellent via workers | Excellent | Excellent | Excellent | Plan concurrency limits | +| Large documents | Careful streaming | Strong | Strong w/ limits | Strong | Plan file-size caps | +| Cloud scalability | K8s HPA | High | High | High (self-host) | High | + + +--- + +## 8. Licensing Comparison + + +| Technology | License / Model | SaaS Redistribution Notes | +| ------------------------------------------------- | ------------------------- | ------------------------------------- | +| python-docx / openpyxl / python-pptx / MarkItDown | MIT | Safe | +| pypdf / reportlab / WeasyPrint / lxml | BSD | Safe | +| Pillow | HPND | Safe | +| pdf2docx + PyMuPDF | MIT + **AGPL dependency** | **Unsafe without commercial PyMuPDF** | +| LibreOffice / Pandoc / Ghostscript | MPL/LGPL / GPL / AGPL | Out of policy for primary stack | +| Aspose / Adobe / Foxit / Apryse / Nutrient | Commercial | Contract + OEM clauses matter | +| ConvertAPI / CloudConvert / Zamzar / PDF.co | SaaS ToS | Data processing agreements required | + + +**Policy recommendation:** Maintain an automated SBOM + license allowlist CI check. Block AGPL/GPL transitive deps in conversion workers. + +--- + +## 9. Integration Analysis + + +| Platform | OSS Fabric | Aspose | Adobe | Apryse/Nutrient | ConvertAPI | Notes | +| ------------------------ | ---------------------------- | ----------------- | --------- | ---------------------- | ---------- | ---------------------------------------------------- | +| **Python / FastAPI** | Native fit | Official SDKs | SDKs | SDKs / REST | REST | **Best primary backend** for DocQube OSS workers | +| **Node.js** | Partial (ports/wrappers) | SDK | SDK | SDK | REST | Use for API gateway; heavy convert in Python workers | +| **Java / .NET** | Via services | Excellent SDKs | SDKs | Excellent | REST | Strong if enterprise customers demand JVM/.NET | +| **Docker** | Required for WeasyPrint deps | Official images | N/A cloud | Document Engine images | N/A | Standardize worker images | +| **Kubernetes** | HPA on queues | Sidecar/self-host | External | Self-host | External | Queue-based autoscaling | +| **AWS / Azure / GCP** | ECS/EKS/GKE + S3/Blob/GCS | All | All | All | All | Keep object storage regional | +| **REST / Microservices** | Yes | Yes | Yes | Yes | Yes | Conversion as async microservice | + + +**Integration recommendation:** FastAPI orchestration service + Redis/SQS/RabbitMQ queue + Python conversion workers + pluggable provider adapters (`OssProvider`, `AsposeProvider`, `ConvertApiProvider`). + +--- + +## 10. Architecture Recommendation for DocQube + +### 10.1 Target Architecture + +```mermaid +flowchart TB + Client[DocQubeClients] --> API[APIGateway_Auth_RateLimit] + API --> Upload[DocumentUploadService] + Upload --> Virus[MalwareScan_Validation] + Virus --> StoreRaw[ObjectStorage_Raw] + Virus --> Classify[DocumentClassifier] + Classify --> Queue[ConversionQueue] + Queue --> Router[ConversionRouter] + + Router -->|scanned_image_pdf| OCR[MistralOCR] + Router -->|simple_permissive| OSS[OSSWorkerPool] + Router -->|fidelity_office_pdf| ASP[AsposeProvider] + Router -->|long_tail_formats| CAP[ConvertAPIProvider] + Router -->|onprem_tenant| APR[Apryse_or_Nutrient] + + OCR --> Meta[Metadata_StructuredExtract] + OSS --> Meta + ASP --> Meta + CAP --> Meta + APR --> Meta + + Meta --> StoreOut[ObjectStorage_Derivatives] + Meta --> Index[SearchIndex_OpenSearch] + Meta --> DB[Jobs_Metadata_DB] + + Queue --> Monitor[Metrics_Logs_Traces] + Router --> DLQ[DeadLetterQueue_Retry] +``` + + + +### 10.2 Component Responsibilities + + +| Component | Responsibility | +| ----------------------- | -------------------------------------------------------------------------------- | +| **Upload Service** | Multipart upload, signed URLs, tenant isolation | +| **File Validation** | MIME/magic bytes, size limits, extension allowlist, encryption detection | +| **Classification** | MIME + heuristics: scanned vs digital PDF, Office family, HTML/MD, spreadsheet | +| **OCR Layer** | Mistral OCR for scans → text/tables/JSON; feeds indexing & optional DOCX rebuild | +| **Conversion Engine** | Router + providers; never block HTTP on long jobs | +| **Queue / Workers** | Celery/RQ/Arq/Sidekiq-equivalent; concurrency caps per provider | +| **Storage** | Raw + derivatives + retention policies | +| **Metadata Extraction** | Author, dates, page count, language, hashes | +| **Search Indexing** | MarkItDown/OCR text → OpenSearch/Elasticsearch | +| **Monitoring** | Success rate, p95 latency, cost per conversion, provider error budgets | +| **Retry / DLQ** | Exponential backoff; max attempts; human review for poison files | +| **Security** | OAuth/OIDC, RBAC, KMS encryption, per-tenant keys, audit logs | +| **Rate Limiting** | Per tenant / plan tier (aligns with DocQube Standard/Pro/Enterprise) | +| **Horizontal Scaling** | Stateless workers; autoscaling on queue depth | + + +### 10.3 End-to-End Workflow + +1. User uploads document (or syncs from cloud storage). +2. Virus scan + validation; store raw object. +3. Classifier tags file type and conversion complexity. +4. Job enqueued with target format(s). +5. Router selects provider: + - Scanned → Mistral OCR (+ optional rebuild) + - Simple → OSS fabric + - Fidelity Office/PDF → Aspose + - Exotic → ConvertAPI + - Air-gapped enterprise → Apryse/Nutrient +6. Workers convert; write derivative; extract metadata; update index. +7. API notifies client (webhook/websocket); audit log recorded. +8. Failures retry; persistent failures → DLQ + support tooling. + +--- + +## 11. Best Technology Stack Recommendation + +### 11.1 Ranking — Best Open-Source (Permissive) + + +| Rank | Technology | Performance | Quality | Enterprise | Scale | Integration | Community | Maintenance | Score | +| ---- | ------------------------------------------------------------------------------------------- | ----------- | ------------- | ---------------------- | ------ | ----------- | --------- | ---------------- | ---------------- | +| 1 | **Composed Fabric** (docx/xlsx/pptx + pypdf + reportlab + WeasyPrint + Pillow + MarkItDown) | High | Medium* | High | High | Excellent | Excellent | Strong | **Best overall** | +| 2 | pypdf | High | Utility | High | High | Excellent | Excellent | Excellent | PDF utilities | +| 3 | WeasyPrint | Medium–High | High HTML→PDF | High | High | Good | Strong | Strong | HTML→PDF | +| 4 | python-docx / openpyxl / python-pptx | High | High generate | High | High | Excellent | Strong | Strong | Office generate | +| 5 | MarkItDown | High | Lossy | High AI | High | Excellent | Very High | Strong | AI/search only | +| — | pdf2docx | Medium | Medium–High | **Blocked (AGPL dep)** | Medium | Good | Medium | **Unmaintained** | Avoid | + + +Medium for fidelity conversion; High for generation paths. + +### 11.2 Ranking — Best Commercial + + +| Rank | Platform | Enterprise Features | Cost Efficiency | Quality | API Maturity | Security | Support | Scale | +| ---- | ---------------------- | ------------------- | ------------------------------------------ | ----------- | ------------- | ------------------- | --------- | --------- | +| 1 | **Aspose** | Excellent | Excellent at high volume ($0.007) | Excellent | Excellent | Strong (+self-host) | Strong | Excellent | +| 2 | **Adobe PDF Services** | Excellent | Good at low–mid; weak at huge cloud volume | Excellent | Excellent | Excellent | Excellent | Excellent | +| 3 | **Apryse** | Excellent on-prem | Good when self-hosted at scale | Excellent | Excellent SDK | Excellent | Strong | Excellent | +| 4 | **Nutrient** | Excellent platform | Mid–High cost | Excellent | Excellent | Excellent | Strong | Excellent | +| 5 | **Foxit** | Strong | Predictable credits | Strong | Strong | Strong | Strong | Strong | +| 6 | **ConvertAPI** | Good | Excellent mid-volume | Good–Strong | Strong | Good (DPA/NDA) | Good | Good | +| 7 | **CloudConvert** | Good | Medium (PDF→Office costly) | Good | Strong | Good | Good | Good | +| 8 | **Microsoft Graph** | Strong in M365 | Excellent if already licensed | Strong →PDF | Strong | Strong | Strong | Strong | +| 9 | **PDF.co** | Medium | Good small–mid | Medium | Good | Medium | Medium | Medium | +| 10 | **Zamzar** | Medium | OK small | Medium | Mature | Medium | Medium | Medium | + + +--- + +## 12. Risk Analysis + + +| Risk | Impact | Likelihood | Mitigation | +| ------------------------------------------- | -------------------------- | ------------------- | ----------------------------------------------------------------- | +| AGPL transitive dependency (PyMuPDF) | Legal / forced open-source | Medium if unchecked | SBOM allowlist; ban pdf2docx without commercial license | +| Commercial price shocks / opaque quotes | Margin erosion | Medium | Hybrid routing; dual-vendor (Aspose + ConvertAPI); volume commits | +| Conversion quality regressions | Customer trust | Medium | Golden-file visual/diff QA suite per release | +| Cloud data residency objections | Lost Enterprise deals | Medium | Self-host Aspose Docker or Apryse/Nutrient SKU | +| OSS maintenance gaps (python-pptx cadence) | Feature lag | Low–Medium | Abstraction layer; vendor fallback | +| Malformed / malicious documents | Outages / RCE | Medium | Sandboxed workers, seccomp, size limits, virus scan | +| Single-vendor lock-in | Negotiation weakness | Medium | Provider interface + secondary ConvertAPI | +| Cost runaway at 100k docs/day on pure cloud | Unsustainable COGS | High if all-cloud | Shift fidelity load to self-hosted SDK | + + +--- + +## 13. Future Roadmap + + +| Phase | Timeline | Actions | +| ------------------------ | ------------ | -------------------------------------------------------------------------------------------------------------------------------- | +| **P0 — Foundation** | 0–90 days | Ship OSS fabric workers; integrate Mistral OCR; Aspose Cloud adapter; job queue; golden-file tests for top 20 conversion pairs | +| **P1 — Productization** | 90–180 days | ConvertAPI long-tail; quality router scoring; per-tenant cost metering; customer-facing format matrix | +| **P2 — Enterprise** | 6–12 months | On-prem Apryse or Nutrient option; regional processing; advanced compliance packs | +| **P3 — Differentiation** | 12–18 months | Layout QA ML judge; smart reflow; conversion confidence scores; selective field-preserving exports tied to DocQube AI extraction | +| **P4 — Optimization** | Ongoing | Self-host Aspose at volume tipping point; continuous bake-offs; font/CJK pack expansion | + + +--- + +## 14. Final Recommendation (with Justification) + +### 14.1 Hybrid Stack for DocQube + +1. **Extraction:** **Mistral OCR 4** (`mistral-ocr-4-0`) — $4/1k pages API, **$2/1k Batch**, $5/1k Document AI +2. **Open-source conversion fabric (permissive):** python-docx + openpyxl + python-pptx + pypdf + reportlab + WeasyPrint + Pillow + MarkItDown +3. **Primary low-cost commercial conversion:** **ConvertAPI** (~$0.007–$0.035 per conversion) +4. **Fidelity commercial conversion:** **Aspose** (Cloud now; Docker self-host when volume/compliance requires) +5. **Enterprise on-prem track:** **Apryse Server SDK** or **Nutrient Document Engine** (procure when Enterprise SKU demands air-gap/data residency — not for cost optimization) + +### 14.2 Why This Architecture + +- Matches DocQube’s product promise (AI extraction + conversion + enterprise controls) +- Respects permissive license policy without pretending OSS can replace Adobe-class PDF↔Office fidelity +- Optimizes COGS: OSS default → ConvertAPI for cheap paid jobs → Aspose only for fidelity +- Uses Mistral OCR 4 Batch to keep extraction costs near **$0.002/page** +- Preserves negotiation leverage with dual commercial providers +- Scales from Standard/Pro cloud plans to Enterprise on-prem + +### 14.3 Technical Trade-offs + + +| Trade-off | Choice | +| ---------------------------- | ------------------------------------------------------------------------------------ | +| Build one mega-OSS converter | Rejected — license/quality gaps | +| All-commercial always | Rejected — unnecessary cost for simple jobs | +| ConvertAPI for everything | Rejected — use Aspose when customer-facing PDF↔Office fidelity matters | +| Adobe as primary | Rejected for cost-sensitive DocQube (~$0.05/txn); optional premium path only | +| pdf2docx for PDF→DOCX | Rejected on OSS path due to AGPL PyMuPDF | + + +### 14.4 Cost Implications + +- Early stage: hybrid keeps monthly conversion COGS low (OSS + ConvertAPI); OCR 4 Batch keeps extraction cheap. +- At mid volume: ConvertAPI Business (~$350/mo for 50k conversions) is the cost floor for paid conversion. +- At 10k–100k docs/day: migrate hot fidelity paths to **self-hosted** Aspose/Apryse/Nutrient; keep OCR on Batch or self-host Mistral OCR 4. + +### 14.5 Scalability, Maintenance, Enterprise Suitability, Extensibility + +- **Scalability:** Queue-based workers scale horizontally; provider concurrency isolated. +- **Maintenance:** Thin adapter interfaces; golden-file CI; SBOM license gates. +- **Enterprise:** Cloud + on-prem dual mode covers DocQube Enterprise “on-premise deployment options.” +- **Extensibility:** New formats = new provider adapter; OCR remains Mistral OCR 4 behind extraction interface. + +### 14.6 Decision for Leadership + +**Approve the cost-optimized hybrid conversion architecture** documented in **§1A**. Fund (1) OSS worker platform, (2) ConvertAPI as primary low-cost paid converter, (3) Aspose for fidelity PDF↔Office, (4) Mistral OCR 4 with Batch for async extraction, (5) a short bake-off of ConvertAPI vs Aspose quality on DocQube’s top conversion pairs, (6) on-prem SDK shortlist (Apryse vs Nutrient) for Enterprise roadmap. + +See **§1A** for the full shortlist tables, Mistral OCR 4 price sheet, ConvertAPI/Aspose cost math, and routing rules. + +--- + +## Appendix A — Sources & Research Notes + +- Mistral OCR 4 announcement & pricing: https://mistral.ai/news/ocr-4/ ($4/1k pages API, $2/1k Batch, $5/1k Document AI; model `mistral-ocr-4-0`) +- Mistral OCR docs: https://docs.mistral.ai/capabilities/document_ai/basic_ocr +- Mistral API pricing page: https://mistral.ai/pricing/api/ +- Aspose Cloud pricing: https://purchase.aspose.cloud/cloud/pricing +- ConvertAPI pricing: https://www.convertapi.com/pricing (AWS Marketplace plan dollars cross-checked) +- Foxit API pricing: https://app.developer-api.foxit.com/pricing +- Adobe PDF Services pricing / Document Transactions documentation (developer.adobe.com) +- CloudConvert, Zamzar, PDF.co, Cloudmersive public pricing pages +- Apryse / Nutrient public pricing pages + Vendr/secondary market bands for quote-only products +- Microsoft Graph `driveItem` content format conversion docs +- GitHub repositories: python-docx, python-pptx, pypdf, MarkItDown, WeasyPrint, Pillow, pdf2docx (stats retrieved Aug 2026) +- DocQube product site: [https://docqube.com/](https://docqube.com/) + +**Disclaimer:** Commercial list prices and secondary-market annual bands change frequently. Validate all quotes with vendor sales before procurement. Conversion quality claims should be confirmed with DocQube-specific golden-file benchmarks. + +--- + +*End of Report* \ No newline at end of file diff --git a/frontend/.env b/frontend/.env index e5771d2..8cd0a93 100644 --- a/frontend/.env +++ b/frontend/.env @@ -1 +1,2 @@ -VITE_GATEWAY_URL=http://127.0.0.1:8765 +# VITE_GATEWAY_URL=http://127.0.0.1:8765 +VITE_GATEWAY_URL=https://pdfapi-dev.maskantech.in \ No newline at end of file diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 3fa1d56..66e02f6 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -31,6 +31,7 @@ import { UnlockModal } from './components/UnlockModal'; import type { UnlockModalState } from './components/UnlockModal'; import { CompareModal } from './components/CompareModal'; import { CompareWorkspace } from './components/CompareWorkspace'; +import { ProductHub } from './components/ProductHub'; import type { DocumentInfo, SearchResult, EditOperation, DocumentMetadata, FontInfo, OutlineItem, PDFPermissions, CompareResponse, DocumentSummary } from './lib/gatewayService'; import { viewportRectToPdf } from './lib/coordinateMapping'; import type { Rect } from './lib/coordinateMapping'; @@ -42,6 +43,7 @@ const rid = (p: string) => `${p}_${Math.random().toString(36).substring(2, 11)}` function App() { const viewerRef = useRef(null); + const [productView, setProductView] = useState<'chooser' | 'editor' | 'conversion'>('chooser'); const [documents, setDocuments] = useState([]); const [activeDoc, setActiveDoc] = useState(null); @@ -1198,6 +1200,17 @@ function App() { }], 'Annotation updated'); }; + if (productView !== 'editor') { + return ( + setProductView('editor')} + onOpenConversion={() => setProductView('conversion')} + onBack={() => setProductView('chooser')} + /> + ); + } + return (
viewerRef.current?.scrollToPage(p)} onSave={handleSave} isRemote={isRemote} + onBackToHome={() => setProductView('chooser')} />
diff --git a/frontend/src/components/ProductHub.tsx b/frontend/src/components/ProductHub.tsx new file mode 100644 index 0000000..d7d6bd4 --- /dev/null +++ b/frontend/src/components/ProductHub.tsx @@ -0,0 +1,87 @@ +import React, { useRef, useState } from 'react'; + +type ProductView = 'chooser' | 'conversion'; + +interface ProductHubProps { + view: ProductView; + onOpenEditor: () => void; + onOpenConversion: () => void; + onBack: () => void; +} + +type ConversionFormat = { + name: string; + description: string; + extension: string; + status: 'available' | 'planned'; +}; + +const formatGroups: { label: string; formats: ConversionFormat[] }[] = [ + { + label: 'Office', + formats: [ + { name: 'Word', description: 'Editable document', extension: 'DOCX', status: 'available' }, + { name: 'Excel', description: 'Spreadsheet tables', extension: 'XLSX', status: 'available' }, + { name: 'PowerPoint', description: 'Presentation slides', extension: 'PPTX', status: 'available' }, + ], + }, + { + label: 'Web and text', + formats: [ + { name: 'HTML', description: 'Web-ready document', extension: 'HTML', status: 'available' }, + { name: 'Markdown', description: 'Structured plain text', extension: 'MD', status: 'available' }, + { name: 'Plain text', description: 'Extracted text', extension: 'TXT', status: 'available' }, + ], + }, + { + label: 'Images', + formats: [ + { name: 'PNG', description: 'One image per page', extension: 'PNG', status: 'available' }, + { name: 'JPEG', description: 'Compact page images', extension: 'JPG', status: 'available' }, + { name: 'TIFF', description: 'High-quality page images', extension: 'TIFF', status: 'available' }, + ], + }, + { + label: 'More formats', + formats: [ + { name: 'EPUB', description: 'E-book format', extension: 'EPUB', status: 'planned' }, + { name: 'ODT / RTF', description: 'Open document formats', extension: 'ODT', status: 'planned' }, + { name: 'Data formats', description: 'JSON, XML, or CSV', extension: 'DATA', status: 'planned' }, + ], + }, +]; + +const FileGlyph = ({ conversion = false }: { conversion?: boolean }) => ( +
+ +
+); + +const ArrowIcon = () => ; +const CheckIcon = () => ; + +const BrandMark = () =>
; + +export const ProductHub: React.FC = ({ view, onOpenEditor, onOpenConversion, onBack }) => { + const fileRef = useRef(null); + const [selectedFile, setSelectedFile] = useState(null); + const [selectedFormat, setSelectedFormat] = useState('Word'); + + if (view === 'chooser') { + return ( +
+
+

DocQube

Your document desk

All workspaces Secure & private
+

Good to see you

Make your next document better.

A focused space to polish PDFs, or move their contents into the tools you already use.

Files stay on your device
+
DocQube workspaceBuilt for calm, careful work
+
+
+ ); + } + + return ( +

Conversion desk

PDF to another format

Conversion desk

Move it forward.

Drop in a PDF, pick a destination, and keep your original exactly as it is.

Ready when you are

Step 01

Bring your PDF

setSelectedFile(event.target.files?.[0] ?? null)} />
Original file remains unchanged

Step 02

Choose a destination

{selectedFormat}
{formatGroups.map((group) =>

{group.label}

{group.formats.map((format) => )}
)}

Conversion service will process your file here.

+ ); +}; diff --git a/frontend/src/components/TopBar.tsx b/frontend/src/components/TopBar.tsx index 6edad46..4cfe38b 100644 --- a/frontend/src/components/TopBar.tsx +++ b/frontend/src/components/TopBar.tsx @@ -40,6 +40,7 @@ interface TopBarProps { canExport?: boolean; canAssemble?: boolean; isRemote?: boolean; + onBackToHome?: () => void; } const ZOOM_PRESETS = [0.5, 0.75, 1, 1.25, 1.5, 2, 3]; @@ -48,7 +49,7 @@ export const TopBar: React.FC = ({ documentName, backendHealthy, engineReady, zoom, onZoomChange, onFitWidth, currentPage, totalPages, onGoToPage, canUndo, canRedo, onUndo, onRedo, isSaving, isDirtySaved, onRotate, onExport, onPrint, onProtect, onUnlock, onCompare, onMergePDF, isEncrypted, onUpload, onNewBlankPDF, onSave, - canPrint = true, canExport = true, canAssemble = true, isRemote = false, + canPrint = true, canExport = true, canAssemble = true, isRemote = false, onBackToHome, }) => { const fileRef = useRef(null); const handleFile = (e: React.ChangeEvent) => { @@ -63,6 +64,7 @@ export const TopBar: React.FC = ({ style={{ height: '56px', paddingLeft: '24px', paddingRight: '24px' }} >
+ {onBackToHome && < Workspaces}