Under the Hood of IProcessor: Parsing 60+ Vendor Invoice Formats with an Azure WebJob
Part 2 of 2. Part 1 introduced the product and the web application. This post covers the invoice-parsing engine (IProcessorPdfParser), the technology stack, and how we ship it. The problem GMD Stores buys from more than 60 vendors. Each one sends invoices as PDF attachments, and no two layouts are alike. Some are clean text PDFs, some are scanned, some are XPS files, and a few vendors have two completely different templates depending on which office issued the invoice. The goal was simple to state and hard to do: read every invoice that arrives in the mailbox, extract every line item, and save it to SQL Server with zero manual typing. IProcessorPdfParser: the always-on mailbox worker IProcessorPdfParser is a .NET Framework console application deployed as a continuous Azure WebJob next to the website. It runs a single instance (guarded by a named Mutex so a second copy exits immediately) and goes through this loop: Step 0: Connect to the mailbox The worker signs in to ...