This project involved the development of a document automation engine within an ERP ecosystem. I developed a system capable of transforming complex relational data into professional, multi-page PDF proposals with dynamic layouts and real-time data integration.
Project Overview
The client sought a solution to generate high-stakes business proposals directly from their ERP data. The goal was to transition from manual document creation to an automated, serverless solution capable of managing complex data structures, including Bill of Materials (BOM), financial summaries, and technical performance reports.
Core Challenges
Generating professional PDFs in a serverless environment (Supabase Edge Functions) presents technical challenges related to memory management and layout precision. The engine was required to manage dynamic content of varying lengths across multiple pages without disrupting the visual structure, while also supporting dynamic layout selection based on the specific proposal type.
Engineering the Solution
I spearheaded the architectural design and implementation of the PDF generation engine, focusing on three critical areas:
- Dynamic Layout Engine: I developed a versatile "Page Generator" that supports multiple layout types (static, dynamic, table, and long-text), allowing the engine to assemble a customized page sequence for each proposal.
- Precision Rendering Logic: I developed custom logic for text alignment, automated line wrapping, and multi-page table generation using pdf-lib, ensuring consistent headers across page breaks.
- Serverless Deployment: I built the system as a Supabase Edge Function using Deno, handling the complete lifecycle from data fetching to secure storage and the creation of signed URLs for final documents.
Operational Impact
The automation of the proposal generation process reduced document preparation time from hours to seconds, allowing the sales team to respond to leads instantly. By extracting data directly from the ERP, we eliminated human error in financial calculations and technical specifications. The modular architecture also allows the business to add new report types without rebuilding the core generation logic.