• bitcoinBitcoin(BTC)$61,971.00-1.54%
  • ethereumEthereum(ETH)$1,731.33-1.54%
  • tetherTether(USDT)$1.00-0.01%
  • binancecoinBNB(BNB)$567.82-0.43%
  • usd-coinUSDC(USDC)$1.000.00%
  • rippleXRP(XRP)$1.09-1.17%
  • solanaSolana(SOL)$77.12-2.46%
  • tronTRON(TRX)$0.328588-0.61%
  • Figure HelocFigure Heloc(FIGR_HELOC)$1.030.84%
  • HyperliquidHyperliquid(HYPE)$67.31-1.43%
  • dogecoinDogecoin(DOGE)$0.072202-1.05%
  • USDSUSDS(USDS)$1.000.01%
  • RainRain(RAIN)$0.014551-2.11%
  • leo-tokenLEO Token(LEO)$9.480.73%
  • zcashZcash(ZEC)$458.44-5.15%
  • whitebitWhiteBIT Coin(WBT)$54.79-1.81%
  • cardanoCardano(ADA)$0.166500-3.10%
  • stellarStellar(XLM)$0.180944-2.79%
  • moneroMonero(XMR)$319.72-3.33%
  • chainlinkChainlink(LINK)$7.61-1.54%
  • CantonCanton(CC)$0.128156-0.94%
  • bitcoin-cashBitcoin Cash(BCH)$233.10-2.26%
  • daiDai(DAI)$1.000.01%
  • USD1USD1(USD1)$1.000.03%
  • Ethena USDeEthena USDe(USDE)$1.00-0.02%
  • the-open-networkGram (prev. Toncoin)(GRAM)$1.58-1.23%
  • litecoinLitecoin(LTC)$43.57-0.12%
  • Global DollarGlobal Dollar(USDG)$1.000.01%
  • Circle USYCCircle USYC(USYC)$1.130.00%
  • hedera-hashgraphHedera(HBAR)$0.069366-1.76%
  • suiSui(SUI)$0.720.24%
  • paypal-usdPayPal USD(PYUSD)$1.00-0.01%
  • avalanche-2Avalanche(AVAX)$6.460.76%
  • crypto-com-chainCronos(CRO)$0.056049-0.24%
  • shiba-inuShiba Inu(SHIB)$0.000004-1.97%
  • tether-goldTether Gold(XAUT)$4,050.82-1.59%
  • nearNEAR Protocol(NEAR)$1.89-2.31%
  • BlackRock USD Institutional Digital Liquidity FundBlackRock USD Institutional Digital Liquidity Fund(BUIDL)$1.000.00%
  • Ondo US Dollar YieldOndo US Dollar Yield(USDY)$1.13-0.21%
  • uniswapUniswap(UNI)$3.292.27%
  • BittensorBittensor(TAO)$202.26-3.34%
  • World Liberty FinancialWorld Liberty Financial(WLFI)$0.058198-0.77%
  • pax-goldPAX Gold(PAXG)$4,053.80-1.61%
  • MemeCoreMemeCore(M)$1.32-4.43%
  • HTX DAOHTX DAO(HTX)$0.000002-0.55%
  • AsterAster(ASTER)$0.62-0.85%
  • okbOKB(OKB)$78.39-0.51%
  • Ripple USDRipple USD(RLUSD)$1.000.00%
  • OndoOndo(ONDO)$0.312264-5.10%
  • usddUSDD(USDD)$1.00-0.11%
TradePoint.io
  • Main
  • AI & Technology
  • Stock Charts
  • Market & News
  • Business
  • Finance Tips
  • Trade Tube
  • Blog
  • Shop
No Result
View All Result
TradePoint.io
No Result
View All Result

Designing a Schema-Guided Invoice Intelligence Pipeline with lift-pdf for Accounts-Payable Extraction, Validation, and Ledger Generation

July 3, 2026
in AI & Technology
Reading Time: 3 mins read
A A
Designing a Schema-Guided Invoice Intelligence Pipeline with lift-pdf for Accounts-Payable Extraction, Validation, and Ledger Generation
ShareShareShareShareShare

YOU MAY ALSO LIKE

Robbyant Releases LingBot-VLA 2.0: An Open-Source 6B Vision-Language-Action (VLA) Model for Cross-Embodiment Robot Manipulation

SpaceXAI Releases Grok 4.5, a Cursor-Trained Model for Coding, Agentic Tasks, and Knowledge Work at $2/M Input

def render_pdf(d, path):
   """Draw a realistic one-page invoice: header, meta, bill/ship, line items, totals, payment."""
   from reportlab.lib.pagesizes import LETTER
   from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
   from reportlab.lib.units import inch
   from reportlab.lib import colors
   from reportlab.platypus import (SimpleDocTemplate, Paragraph, Spacer,
                                   Table, TableStyle)
   c   = compute(d)
   sym = d["currency_symbol"]
   def money(x): return f"{sym}{x:,.2f}"
   ss   = getSampleStyleSheet()
   H1   = ParagraphStyle("H1",   parent=ss["Title"],    fontSize=18, leading=22, spaceAfter=2)
   SMALL= ParagraphStyle("SM",   parent=ss["Normal"],   fontSize=8.5, textColor=colors.grey, leading=11)
   LBL  = ParagraphStyle("LBL",  parent=ss["Normal"],   fontSize=8.5, textColor=colors.HexColor("#2b3a67"),
                         spaceAfter=1, fontName="Helvetica-Bold")
   BODY = ParagraphStyle("BODY", parent=ss["Normal"],   fontSize=9.5, leading=13)
   RIGHT= ParagraphStyle("R",    parent=ss["Normal"],   fontSize=16, leading=18, alignment=2,
                         textColor=colors.HexColor("#2b3a67"), fontName="Helvetica-Bold")
   story = []
  
   head = Table([[
       [Paragraph(d["vendor_name"], H1), Paragraph(d["vendor_address"], SMALL)],
       [Paragraph("INVOICE", RIGHT),
        Paragraph(f"{d['invoice_number']}", ParagraphStyle('n', parent=SMALL, alignment=2, fontSize=9.5))],
   ]], colWidths=[4.2 * inch, 2.8 * inch])
   head.setStyle(TableStyle([("VALIGN", (0, 0), (-1, -1), "TOP")]))
   story += [head, Spacer(1, 10)]
  
   meta_rows = [["Invoice date", d["invoice_date"], "Due date", d["due_date"]]]
   if d.get("po_number"):
       meta_rows.append(["PO number", d["po_number"], "Currency", d["currency_code"]])
   else:
       meta_rows.append(["Currency", d["currency_code"], "", ""])
   meta = Table(meta_rows, colWidths=[1.3 * inch, 2.2 * inch, 1.3 * inch, 2.2 * inch])
   meta.setStyle(TableStyle([
       ("FONTSIZE", (0, 0), (-1, -1), 9),
       ("TEXTCOLOR", (0, 0), (0, -1), colors.HexColor("#2b3a67")),
       ("TEXTCOLOR", (2, 0), (2, -1), colors.HexColor("#2b3a67")),
       ("FONTNAME", (0, 0), (0, -1), "Helvetica-Bold"),
       ("FONTNAME", (2, 0), (2, -1), "Helvetica-Bold"),
       ("BOTTOMPADDING", (0, 0), (-1, -1), 3), ("TOPPADDING", (0, 0), (-1, -1), 3)]))
   story += [meta, Spacer(1, 12)]
  
   bill = [Paragraph("BILL TO", LBL), Paragraph(d["bill_to_name"], BODY),
           Paragraph(d["bill_to_address"], SMALL)]
   if d.get("ship_to_name"):
       ship = [Paragraph("SHIP TO", LBL), Paragraph(d["ship_to_name"], BODY),
               Paragraph(d["ship_to_address"], SMALL)]
   else:
       ship = [Paragraph("SHIP TO", LBL), Paragraph("Same as billing address", SMALL)]
   parties = Table([[bill, ship]], colWidths=[3.5 * inch, 3.5 * inch])
   parties.setStyle(TableStyle([("VALIGN", (0, 0), (-1, -1), "TOP"),
                                ("LEFTPADDING", (0, 0), (-1, -1), 0)]))
   story += [parties, Spacer(1, 14)]
  
   rows = [["Description", "Qty", "Unit price", "Amount"]]
   for (desc, q, up, t) in c["items"]:
       rows.append([desc, str(q), money(up), money(t)])
   items_tbl = Table(rows, colWidths=[3.5 * inch, 0.7 * inch, 1.4 * inch, 1.4 * inch])
   items_tbl.setStyle(TableStyle([
       ("BACKGROUND", (0, 0), (-1, 0), colors.HexColor("#2b3a67")),
       ("TEXTCOLOR", (0, 0), (-1, 0), colors.white),
       ("FONTSIZE", (0, 0), (-1, -1), 9.5),
       ("ALIGN", (1, 0), (-1, -1), "RIGHT"),
       ("GRID", (0, 0), (-1, -1), 0.4, colors.HexColor("#cdd3e6")),
       ("ROWBACKGROUNDS", (0, 1), (-1, -1), [colors.white, colors.HexColor("#eef1f8")]),
       ("LEFTPADDING", (0, 0), (-1, -1), 8), ("TOPPADDING", (0, 0), (-1, -1), 5),
       ("BOTTOMPADDING", (0, 0), (-1, -1), 5)]))
   story += [items_tbl, Spacer(1, 10)]
  
   tot_rows = [["Subtotal", money(c["subtotal"])]]
   if c["discount"]:
       tot_rows.append(["Discount", "-" + money(c["discount"])])
   tot_rows.append([f"Tax ({d['tax_rate']*100:.1f}%)", money(c["tax"])])
   tot_rows.append(["TOTAL", money(c["total"])])
   totals = Table(tot_rows, colWidths=[1.6 * inch, 1.4 * inch], hAlign="RIGHT")
   totals.setStyle(TableStyle([
       ("FONTSIZE", (0, 0), (-1, -1), 10),
       ("ALIGN", (0, 0), (-1, -1), "RIGHT"),
       ("LINEABOVE", (0, -1), (-1, -1), 1.0, colors.HexColor("#2b3a67")),
       ("FONTNAME", (0, -1), (-1, -1), "Helvetica-Bold"),
       ("TEXTCOLOR", (0, -1), (-1, -1), colors.HexColor("#2b3a67")),
       ("TOPPADDING", (0, 0), (-1, -1), 3), ("BOTTOMPADDING", (0, 0), (-1, -1), 3)]))
   story += [totals, Spacer(1, 8)]
  
   pay_rows = [["Amount paid", money(c["amount_paid"])],
               ["Balance due", money(c["balance"])]]
   pay = Table(pay_rows, colWidths=[1.6 * inch, 1.4 * inch], hAlign="RIGHT")
   due_color = colors.HexColor("#1b7a3d") if c["is_paid"] else colors.HexColor("#7a2e2e")
   pay.setStyle(TableStyle([
       ("FONTSIZE", (0, 0), (-1, -1), 10),
       ("ALIGN", (0, 0), (-1, -1), "RIGHT"),
       ("FONTNAME", (0, 1), (-1, 1), "Helvetica-Bold"),
       ("TEXTCOLOR", (0, 1), (-1, 1), due_color),
       ("TOPPADDING", (0, 0), (-1, -1), 2), ("BOTTOMPADDING", (0, 0), (-1, -1), 2)]))
   status = "PAID IN FULL" if c["is_paid"] else "BALANCE DUE"
   story += [pay, Spacer(1, 6),
             Paragraph(f"Status: {status}", BODY), Spacer(1, 16),
             Paragraph("Notes", LBL), Paragraph(d["notes"], BODY)]
   SimpleDocTemplate(path, pagesize=LETTER,
                     topMargin=0.7 * inch, bottomMargin=0.7 * inch,
                     leftMargin=0.8 * inch, rightMargin=0.8 * inch).build(story)
print("STEP 3/7 · Generating synthetic invoice PDFs…")
CORPUS = []
for i, d in enumerate(DOCS):
   path = f"/content/invoice_{i}.pdf" if os.path.isdir("/content") else f"invoice_{i}.pdf"
   render_pdf(d, path)
   CORPUS.append((d, ground_truth(d), path))
   print(f"     ✓ {os.path.basename(path)}  —  {d['vendor_name']} → {d['bill_to_name']}")
print()
if SHOW_FIRST_PAGE:
   try:
       import pypdfium2 as pdfium, matplotlib.pyplot as plt
       pg  = pdfium.PdfDocument(CORPUS[0][2])[0]
       img = pg.render(scale=2.0).to_pil()
       plt.figure(figsize=(6.4, 8.3)); plt.imshow(img); plt.axis("off")
       plt.title("What lift reads — page 1 of invoice_0.pdf", fontsize=10); plt.show()
   except Exception as e:
       print("     page preview skipped:", e, "\n")

Credit: Source link

ShareTweetSendSharePin

Related Posts

Robbyant Releases LingBot-VLA 2.0: An Open-Source 6B Vision-Language-Action (VLA) Model for Cross-Embodiment Robot Manipulation
AI & Technology

Robbyant Releases LingBot-VLA 2.0: An Open-Source 6B Vision-Language-Action (VLA) Model for Cross-Embodiment Robot Manipulation

July 9, 2026
SpaceXAI Releases Grok 4.5, a Cursor-Trained Model for Coding, Agentic Tasks, and Knowledge Work at /M Input
AI & Technology

SpaceXAI Releases Grok 4.5, a Cursor-Trained Model for Coding, Agentic Tasks, and Knowledge Work at $2/M Input

July 8, 2026
Volkswagen Is Employing 100 Sheep At A Solar Farm In Poland
AI & Technology

Volkswagen Is Employing 100 Sheep At A Solar Farm In Poland

July 8, 2026
SpaceX’s Grok 4.5 launches at half the price of rivals — here’s why that could rattle Anthropic and OpenAI
AI & Technology

SpaceX’s Grok 4.5 launches at half the price of rivals — here’s why that could rattle Anthropic and OpenAI

July 8, 2026
Next Post
Taylor Swift and Travis Kelce's wedding day arrives with Madison Square Garden under tight security – CBS News

Taylor Swift and Travis Kelce's wedding day arrives with Madison Square Garden under tight security - CBS News

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Search

No Result
View All Result
Republicans bank on a Trump Accounts boost – Politico

Republicans bank on a Trump Accounts boost – Politico

July 4, 2026
The Families of Dilley ICE Detention: ‘Mama, I Don’t Want to Live’

The Families of Dilley ICE Detention: ‘Mama, I Don’t Want to Live’

July 3, 2026
Why 3D TVs Failed And The Trouble With 3D In Hollywood.

Why 3D TVs Failed And The Trouble With 3D In Hollywood.

July 5, 2026

About

Learn more

Our Services

Legal

Privacy Policy

Terms of Use

Bloggers

Learn more

Article Links

Contact

Advertise

Ask us anything

©2020- TradePoint.io - All rights reserved!

Tradepoint.io, being just a publishing and technology platform, is not a registered broker-dealer or investment adviser. So we do not provide investment advice. Rather, brokerage services are provided to clients of Tradepoint.io by independent SEC-registered broker-dealers and members of FINRA/SIPC. Every form of investing carries some risk and past performance is not a guarantee of future results. “Tradepoint.io“, “Instant Investing” and “My Trading Tools” are registered trademarks of Apperbuild, LLC.

This website is operated by Apperbuild, LLC. We have no link to any brokerage firm and we do not provide investment advice. Every information and resource we provide is solely for the education of our readers. © 2020 Apperbuild, LLC. All rights reserved.

No Result
View All Result
  • Main
  • AI & Technology
  • Stock Charts
  • Market & News
  • Business
  • Finance Tips
  • Trade Tube
  • Blog
  • Shop

© 2023 - TradePoint.io - All Rights Reserved!