How hamza-el-khatib/pdfgenerator works
Main Components
a) Core Components:
• Web Layer (Controllers)
• Service Layer
• Configuration Layer
• Utility Layer
• File Storage System
• Async Task Management System
b) External Components:
• Web Content Source (Inditex Export Service)
• Playwright Browser Instance
• PDFBox Processing Engine
• File System Storage
┌─ Client Layer ─────────────────────────────────┐
• HTTP Requests │
• ┬─────────────────────────────┘
• ↓
┌─ API Layer ───────────────────────────────────┐
• PdfController (REST APIs) │
• ┬─────────────────────────────┘
• ↓
┌─ Service Layer ───────────────────────────────┐
• ┌─────────────┐ ┌──────────┐ ┌───────────┐ │
• PdfGenerator │ │PdfTask │ │FileCleanup│ │
• Service │←→│Manager │←→│Service │ │
• ┘ └──────────┘ └───────────┘ │
• ┬─────────────┬──────────────┬──────────┘
• ↓ ↓ ↓
┌─ External Services ─────────────────────────────┐
• ┌─────────┐ ┌────────┐ ┌───────┐ ┌──────────┐ │
• Playwright│ │PDFBox │ │Storage│ │Web Source│ │
• ┘ └────────┘ └───────┘ └──────────┘ │
• ┘
Key Relationships to Highlight
a) Request Flow:
• Client → PdfController → PdfGeneratorService
• Async task creation and management
• PDF chunk processing and merging
• File cleanup processes
b) Data Flow:
• Web content fetching
• PDF generation and manipulation
• Storage operations
• Cleanup procedures
Important Details
a) Configuration Properties:
• PDF storage paths
• Cleanup intervals
• Batch sizes
• Thread pool configurations
b) Async Operations:
• Thread pool executor
• Task management
• Parallel PDF processing
c) Security:
• Cookie handling
• CORS configuration
• Domain restrictions
Technical Specifications
• Java 17 runtime
• Spring Boot framework
• Playwright/PDFBox versions
• Memory/CPU requirements
Monitoring Points
Highlight:
• Task status checkpoints
• File system monitoring
• Performance metrics
• Error logging points
This design should reflect the Spring Boot architecture while highlighting the unique aspects of this PDF generation service, particularly its handling of large-scale PDF processing through chunking and parallel execution.