# mydmahesh/pdf-tools architecture

> Architecture diagram of the GitHub repository mydmahesh/pdf-tools, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mydmahesh/pdf-tools
- Repository: https://github.com/mydmahesh/pdf-tools

## Overview

PDFCraft is a privacy-focused, in-browser PDF tools application. A user selects a tool, supplies a local file or text, configures the operation, and processes it in the browser; the UI then presents a download or extracted content. The graph includes the documented tool families and shared preview/upload/download layers. Relationships are limited to those supported by excerpts or the source index; some tool routing and unsampled implementation details are not verified.

Main entry points: [`src/App.tsx`](https://github.com/mydmahesh/pdf-tools/blob/main/src/App.tsx) (Tool catalog and routing), [`src/components/FileUpload.tsx`](https://github.com/mydmahesh/pdf-tools/blob/main/src/components/FileUpload.tsx) (File upload), [`src/services/thumbnailService.ts`](https://github.com/mydmahesh/pdf-tools/blob/main/src/services/thumbnailService.ts) (PDF previews), [`src/components/SuccessDownload.tsx`](https://github.com/mydmahesh/pdf-tools/blob/main/src/components/SuccessDownload.tsx) (Download result)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and navigation"]
  node_app["Tool catalog and routing<br/>[App.tsx]"]
  node_catalog["Tool definitions<br/>[tools.ts]"]
end

subgraph group_organize["Organize PDFs"]
  node_merge_ui["Merge interface<br/>[MergePdfView.tsx]"]
  node_merge["Merge PDFs<br/>[mergePdf.ts]"]
  node_split_ui["Split interface<br/>[SplitPdfView.tsx]"]
  node_split["Split pages<br/>[splitPdf.ts]"]
  node_organize_ui["Organize interface"]
  node_organize_pdf["Reorder and rotate<br/>[organizePdf.ts]"]
  node_compress_ui["Compression interface"]
  node_compress["Compress PDF<br/>[compressPdf.ts]"]
end

subgraph group_convert["PDF conversion"]
  node_images_ui["Images to PDF interface"]
  node_images_pdf["Images to PDF<br/>[imagesToPdf.ts]"]
  node_text_ui["Text to PDF interface<br/>[TextToPdfView.tsx]"]
  node_text_pdf["Text to PDF<br/>[textToPdf.ts]"]
  node_ocr_ui["OCR interface<br/>[OcrPdfView.tsx]"]
  node_ocr["OCR processing<br/>[ocrPdfService.ts]"]
  node_pdfimages_ui["PDF to images interface"]
  node_pdfimages["PDF to images<br/>[pdfToImages.ts]"]
  node_pdftext_ui["PDF to text interface<br/>[PdfToTextView.tsx]"]
  node_pdftext["PDF text extraction<br/>[pdfToText.ts]"]
  node_word_ui["PDF to Word interface<br/>[PdfToWordView.tsx]"]
  node_word["Word export<br/>[pdfToWord.ts]"]
end

subgraph group_edit["Security and formatting"]
  node_watermark_ui["Watermark interface"]
  node_watermark["Apply watermark<br/>[watermarkPdf.ts]"]
  node_numbers_ui["Page numbers interface"]
  node_numbers["Add page numbers<br/>[pageNumbersPdf.ts]"]
  node_unlock_ui["Unlock interface<br/>[UnlockPdfView.tsx]"]
  node_unlock["Unlock PDF<br/>[unlockPdf.ts]"]
end

subgraph group_shared["Shared processing"]
  node_upload["File upload<br/>[FileUpload.tsx]"]
  node_preview["PDF previews"]
  node_download["Download result"]
  node_worker["PDF.js worker config<br/>[pdfWorker.ts]"]
end

node_user(("User"))

node_user -->|"selects tool"| node_app
node_app -->|"reads catalog"| node_catalog
node_app -->|"routes to"| node_merge_ui
node_app -->|"routes to"| node_split_ui
node_app -->|"routes to"| node_compress_ui
node_app -->|"routes to"| node_ocr_ui
node_app -->|"routes to"| node_pdfimages_ui
node_app -->|"routes to"| node_images_ui
node_app -->|"routes to"| node_word_ui
node_app -->|"routes to"| node_pdftext_ui
node_app -->|"routes to"| node_text_ui
node_app -.->|"routes to"| node_organize_ui
node_app -.->|"routes to"| node_watermark_ui
node_app -.->|"routes to"| node_numbers_ui
node_app -.->|"routes to"| node_unlock_ui
node_merge_ui -->|"uses"| node_upload
node_merge_ui -->|"processes with"| node_merge
node_merge_ui -->|"requests preview"| node_preview
node_merge_ui -->|"presents result"| node_download
node_split_ui -->|"uses"| node_upload
node_split_ui -->|"processes with"| node_split
node_split_ui -->|"requests preview"| node_preview
node_split_ui -->|"presents result"| node_download
node_organize_ui -->|"uses"| node_upload
node_organize_ui -->|"processes with"| node_organize_pdf
node_organize_ui -->|"requests preview"| node_preview
node_organize_ui -->|"presents result"| node_download
node_compress_ui -->|"uses"| node_upload
node_compress_ui -->|"processes with"| node_compress
node_compress_ui -->|"requests preview"| node_preview
node_compress_ui -->|"presents result"| node_download
node_images_ui -->|"uses"| node_upload
node_images_ui -->|"processes with"| node_images_pdf
node_images_ui -->|"presents result"| node_download
node_text_ui -->|"processes with"| node_text_pdf
node_text_ui -->|"presents result"| node_download
node_ocr_ui -->|"uses"| node_upload
node_ocr_ui -->|"processes with"| node_ocr
node_ocr_ui -->|"requests preview"| node_preview
node_ocr_ui -.->|"presents result"| node_download
node_pdfimages_ui -->|"uses"| node_upload
node_pdfimages_ui -->|"processes with"| node_pdfimages
node_pdfimages_ui -->|"requests preview"| node_preview
node_pdftext_ui -->|"uses"| node_upload
node_pdftext_ui -.->|"processes with"| node_pdftext
node_pdftext_ui -->|"optional OCR"| node_ocr
node_pdftext_ui -->|"requests preview"| node_preview
node_word_ui -->|"uses"| node_upload

click node_app "https://github.com/mydmahesh/pdf-tools/blob/main/src/App.tsx"
click node_catalog "https://github.com/mydmahesh/pdf-tools/blob/main/src/data/tools.ts"
click node_upload "https://github.com/mydmahesh/pdf-tools/blob/main/src/components/FileUpload.tsx"
click node_preview "https://github.com/mydmahesh/pdf-tools/blob/main/src/services/thumbnailService.ts"
click node_download "https://github.com/mydmahesh/pdf-tools/blob/main/src/components/SuccessDownload.tsx"
click node_worker "https://github.com/mydmahesh/pdf-tools/blob/main/src/utils/pdfWorker.ts"
click node_merge_ui "https://github.com/mydmahesh/pdf-tools/blob/main/src/components/tools/MergePdfView.tsx"
click node_merge "https://github.com/mydmahesh/pdf-tools/blob/main/src/services/mergePdf.ts"
click node_split_ui "https://github.com/mydmahesh/pdf-tools/blob/main/src/components/tools/SplitPdfView.tsx"
click node_split "https://github.com/mydmahesh/pdf-tools/blob/main/src/services/splitPdf.ts"
click node_organize_ui "https://github.com/mydmahesh/pdf-tools/blob/main/src/components/tools/OrganizePdfView.tsx"
click node_organize_pdf "https://github.com/mydmahesh/pdf-tools/blob/main/src/services/organizePdf.ts"
click node_compress_ui "https://github.com/mydmahesh/pdf-tools/blob/main/src/components/tools/CompressPdfView.tsx"
click node_compress "https://github.com/mydmahesh/pdf-tools/blob/main/src/services/compressPdf.ts"
click node_images_ui "https://github.com/mydmahesh/pdf-tools/blob/main/src/components/tools/ImagesToPdfView.tsx"
click node_images_pdf "https://github.com/mydmahesh/pdf-tools/blob/main/src/services/imagesToPdf.ts"
click node_text_ui "https://github.com/mydmahesh/pdf-tools/blob/main/src/components/tools/TextToPdfView.tsx"
click node_text_pdf "https://github.com/mydmahesh/pdf-tools/blob/main/src/services/textToPdf.ts"
click node_ocr_ui "https://github.com/mydmahesh/pdf-tools/blob/main/src/components/tools/OcrPdfView.tsx"
click node_ocr "https://github.com/mydmahesh/pdf-tools/blob/main/src/services/ocrPdfService.ts"
click node_pdfimages_ui "https://github.com/mydmahesh/pdf-tools/blob/main/src/components/tools/PdfToImagesView.tsx"
click node_pdfimages "https://github.com/mydmahesh/pdf-tools/blob/main/src/services/pdfToImages.ts"
click node_pdftext_ui "https://github.com/mydmahesh/pdf-tools/blob/main/src/components/tools/PdfToTextView.tsx"
click node_pdftext "https://github.com/mydmahesh/pdf-tools/blob/main/src/services/pdfToText.ts"
click node_word_ui "https://github.com/mydmahesh/pdf-tools/blob/main/src/components/tools/PdfToWordView.tsx"
click node_word "https://github.com/mydmahesh/pdf-tools/blob/main/src/services/pdfToWord.ts"
click node_watermark_ui "https://github.com/mydmahesh/pdf-tools/blob/main/src/components/tools/WatermarkPdfView.tsx"
click node_watermark "https://github.com/mydmahesh/pdf-tools/blob/main/src/services/watermarkPdf.ts"
click node_numbers_ui "https://github.com/mydmahesh/pdf-tools/blob/main/src/components/tools/PageNumbersView.tsx"
click node_numbers "https://github.com/mydmahesh/pdf-tools/blob/main/src/services/pageNumbersPdf.ts"
click node_unlock_ui "https://github.com/mydmahesh/pdf-tools/blob/main/src/components/tools/UnlockPdfView.tsx"
click node_unlock "https://github.com/mydmahesh/pdf-tools/blob/main/src/services/unlockPdf.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_catalog,node_user toneBlue
class node_merge_ui,node_merge,node_split_ui,node_split,node_organize_ui,node_organize_pdf,node_compress_ui,node_compress toneAmber
class node_images_ui,node_images_pdf,node_text_ui,node_text_pdf,node_ocr_ui,node_ocr,node_pdfimages_ui,node_pdfimages,node_pdftext_ui,node_pdftext,node_word_ui,node_word toneMint
class node_watermark_ui,node_watermark,node_numbers_ui,node_numbers,node_unlock_ui,node_unlock toneRose
class node_upload,node_preview,node_download,node_worker toneIndigo
```

## Components

### App and navigation

- [Tool catalog and routing](https://github.com/mydmahesh/pdf-tools/blob/main/src/App.tsx): `src/App.tsx`
- [Tool definitions](https://github.com/mydmahesh/pdf-tools/blob/main/src/data/tools.ts): `src/data/tools.ts`

### Organize PDFs

- [Merge interface](https://github.com/mydmahesh/pdf-tools/blob/main/src/components/tools/MergePdfView.tsx): `src/components/tools/MergePdfView.tsx`
- [Merge PDFs](https://github.com/mydmahesh/pdf-tools/blob/main/src/services/mergePdf.ts): `src/services/mergePdf.ts`
- [Split interface](https://github.com/mydmahesh/pdf-tools/blob/main/src/components/tools/SplitPdfView.tsx): `src/components/tools/SplitPdfView.tsx`
- [Split pages](https://github.com/mydmahesh/pdf-tools/blob/main/src/services/splitPdf.ts): `src/services/splitPdf.ts`
- [Organize interface](https://github.com/mydmahesh/pdf-tools/blob/main/src/components/tools/OrganizePdfView.tsx): `src/components/tools/OrganizePdfView.tsx`
- [Reorder and rotate](https://github.com/mydmahesh/pdf-tools/blob/main/src/services/organizePdf.ts): `src/services/organizePdf.ts`
- [Compression interface](https://github.com/mydmahesh/pdf-tools/blob/main/src/components/tools/CompressPdfView.tsx): `src/components/tools/CompressPdfView.tsx`
- [Compress PDF](https://github.com/mydmahesh/pdf-tools/blob/main/src/services/compressPdf.ts): `src/services/compressPdf.ts`

### PDF conversion

- [Images to PDF interface](https://github.com/mydmahesh/pdf-tools/blob/main/src/components/tools/ImagesToPdfView.tsx): `src/components/tools/ImagesToPdfView.tsx`
- [Images to PDF](https://github.com/mydmahesh/pdf-tools/blob/main/src/services/imagesToPdf.ts): `src/services/imagesToPdf.ts`
- [Text to PDF interface](https://github.com/mydmahesh/pdf-tools/blob/main/src/components/tools/TextToPdfView.tsx): `src/components/tools/TextToPdfView.tsx`
- [Text to PDF](https://github.com/mydmahesh/pdf-tools/blob/main/src/services/textToPdf.ts): `src/services/textToPdf.ts`
- [OCR interface](https://github.com/mydmahesh/pdf-tools/blob/main/src/components/tools/OcrPdfView.tsx): `src/components/tools/OcrPdfView.tsx`
- [OCR processing](https://github.com/mydmahesh/pdf-tools/blob/main/src/services/ocrPdfService.ts): `src/services/ocrPdfService.ts`
- [PDF to images interface](https://github.com/mydmahesh/pdf-tools/blob/main/src/components/tools/PdfToImagesView.tsx): `src/components/tools/PdfToImagesView.tsx`
- [PDF to images](https://github.com/mydmahesh/pdf-tools/blob/main/src/services/pdfToImages.ts): `src/services/pdfToImages.ts`
- [PDF to text interface](https://github.com/mydmahesh/pdf-tools/blob/main/src/components/tools/PdfToTextView.tsx): `src/components/tools/PdfToTextView.tsx`
- [PDF text extraction](https://github.com/mydmahesh/pdf-tools/blob/main/src/services/pdfToText.ts): `src/services/pdfToText.ts`
- [PDF to Word interface](https://github.com/mydmahesh/pdf-tools/blob/main/src/components/tools/PdfToWordView.tsx): `src/components/tools/PdfToWordView.tsx`
- [Word export](https://github.com/mydmahesh/pdf-tools/blob/main/src/services/pdfToWord.ts): `src/services/pdfToWord.ts`

### Security and formatting

- [Watermark interface](https://github.com/mydmahesh/pdf-tools/blob/main/src/components/tools/WatermarkPdfView.tsx): `src/components/tools/WatermarkPdfView.tsx`
- [Apply watermark](https://github.com/mydmahesh/pdf-tools/blob/main/src/services/watermarkPdf.ts): `src/services/watermarkPdf.ts`
- [Page numbers interface](https://github.com/mydmahesh/pdf-tools/blob/main/src/components/tools/PageNumbersView.tsx): `src/components/tools/PageNumbersView.tsx`
- [Add page numbers](https://github.com/mydmahesh/pdf-tools/blob/main/src/services/pageNumbersPdf.ts): `src/services/pageNumbersPdf.ts`
- [Unlock interface](https://github.com/mydmahesh/pdf-tools/blob/main/src/components/tools/UnlockPdfView.tsx): `src/components/tools/UnlockPdfView.tsx`
- [Unlock PDF](https://github.com/mydmahesh/pdf-tools/blob/main/src/services/unlockPdf.ts): `src/services/unlockPdf.ts`

### Shared processing

- [File upload](https://github.com/mydmahesh/pdf-tools/blob/main/src/components/FileUpload.tsx): `src/components/FileUpload.tsx`
- [PDF previews](https://github.com/mydmahesh/pdf-tools/blob/main/src/services/thumbnailService.ts): `src/services/thumbnailService.ts`
- [Download result](https://github.com/mydmahesh/pdf-tools/blob/main/src/components/SuccessDownload.tsx): `src/components/SuccessDownload.tsx`
- [PDF.js worker config](https://github.com/mydmahesh/pdf-tools/blob/main/src/utils/pdfWorker.ts): `src/utils/pdfWorker.ts`

### Other components

- **User**

## Connections

- User → Tool catalog and routing: selects tool (evidence: `src/App.tsx`)
- Tool catalog and routing → Tool definitions: reads catalog (evidence: `src/App.tsx`)
- Tool catalog and routing → Merge interface: routes to (evidence: `src/App.tsx`)
- Tool catalog and routing → Split interface: routes to (evidence: `src/App.tsx`)
- Tool catalog and routing → Compression interface: routes to (evidence: `src/App.tsx`)
- Tool catalog and routing → OCR interface: routes to (evidence: `src/App.tsx`)
- Tool catalog and routing → PDF to images interface: routes to (evidence: `src/App.tsx`)
- Tool catalog and routing → Images to PDF interface: routes to (evidence: `src/App.tsx`)
- Tool catalog and routing → PDF to Word interface: routes to (evidence: `src/App.tsx`)
- Tool catalog and routing → PDF to text interface: routes to (evidence: `src/App.tsx`)
- Tool catalog and routing → Text to PDF interface: routes to (evidence: `src/App.tsx`)
- Tool catalog and routing → Organize interface: routes to (evidence: `src/App.tsx`)
- Tool catalog and routing → Watermark interface: routes to (evidence: `src/App.tsx`)
- Tool catalog and routing → Page numbers interface: routes to (evidence: `src/App.tsx`)
- Tool catalog and routing → Unlock interface: routes to (evidence: `src/App.tsx`)
- Merge interface → File upload: uses (evidence: `src/components/tools/MergePdfView.tsx`)
- Merge interface → Merge PDFs: processes with (evidence: `src/components/tools/MergePdfView.tsx`)
- Merge interface → PDF previews: requests preview (evidence: `src/components/tools/MergePdfView.tsx`)
- Merge interface → Download result: presents result (evidence: `src/components/tools/MergePdfView.tsx`)
- Split interface → File upload: uses (evidence: `src/components/tools/SplitPdfView.tsx`)
- Split interface → Split pages: processes with (evidence: `src/components/tools/SplitPdfView.tsx`)
- Split interface → PDF previews: requests preview (evidence: `src/components/tools/SplitPdfView.tsx`)
- Split interface → Download result: presents result (evidence: `src/components/tools/SplitPdfView.tsx`)
- Organize interface → File upload: uses (evidence: `src/components/tools/OrganizePdfView.tsx`)
- Organize interface → Reorder and rotate: processes with (evidence: `src/components/tools/OrganizePdfView.tsx`)
- Organize interface → PDF previews: requests preview (evidence: `src/components/tools/OrganizePdfView.tsx`)
- Organize interface → Download result: presents result (evidence: `src/components/tools/OrganizePdfView.tsx`)
- Compression interface → File upload: uses (evidence: `src/components/tools/CompressPdfView.tsx`)
- Compression interface → Compress PDF: processes with (evidence: `src/components/tools/CompressPdfView.tsx`)
- Compression interface → PDF previews: requests preview (evidence: `src/components/tools/CompressPdfView.tsx`)
- Compression interface → Download result: presents result (evidence: `src/components/tools/CompressPdfView.tsx`)
- Images to PDF interface → File upload: uses (evidence: `src/components/tools/ImagesToPdfView.tsx`)
- Images to PDF interface → Images to PDF: processes with (evidence: `src/components/tools/ImagesToPdfView.tsx`)
- Images to PDF interface → Download result: presents result (evidence: `src/components/tools/ImagesToPdfView.tsx`)
- Text to PDF interface → Text to PDF: processes with (evidence: `src/components/tools/TextToPdfView.tsx`)
- Text to PDF interface → Download result: presents result (evidence: `src/components/tools/TextToPdfView.tsx`)
- OCR interface → File upload: uses (evidence: `src/components/tools/OcrPdfView.tsx`)
- OCR interface → OCR processing: processes with (evidence: `src/components/tools/OcrPdfView.tsx`)
- OCR interface → PDF previews: requests preview (evidence: `src/components/tools/OcrPdfView.tsx`)
- OCR interface → Download result: presents result (evidence: `src/components/tools/OcrPdfView.tsx`)
- PDF to images interface → File upload: uses (evidence: `src/components/tools/PdfToImagesView.tsx`)
- PDF to images interface → PDF to images: processes with (evidence: `src/components/tools/PdfToImagesView.tsx`)
- PDF to images interface → PDF previews: requests preview (evidence: `src/components/tools/PdfToImagesView.tsx`)
- PDF to text interface → File upload: uses (evidence: `src/components/tools/PdfToTextView.tsx`)
- PDF to text interface → PDF text extraction: processes with (evidence: `src/components/tools/PdfToTextView.tsx`)
- PDF to text interface → OCR processing: optional OCR (evidence: `src/components/tools/PdfToTextView.tsx`)
- PDF to text interface → PDF previews: requests preview (evidence: `src/components/tools/PdfToTextView.tsx`)
- PDF to Word interface → File upload: uses (evidence: `src/components/tools/PdfToWordView.tsx`)
