invoice-template-from-pdf
Installation
SKILL.md
Rebuild an invoice PDF as an invoice-api template
Do not eyeball. Measure the original, build with the helpers, render through the API, compare, correct. Repeat at most 5 rounds, then report what is left.
Setup
pip install pdfplumber pillow(Python 3.8+). Scripts are inscripts/.INVOICE_XHUB_API_KEYas environment variable or.envin the working directory. Never print it.- Each render is one API call (counts against the quota). A full job takes about 8-12 calls.
- Keep the original PDF and everything derived from it (sample data, renders) local; it contains customer data. Never commit it.
Workflow
- Measure the original:
Look atpython3 scripts/analyze_pdf.py original.pdf --out analysisanalysis/page-1.png, then readanalysis/analysis.json: every text line with x/top/size/font/bold/colour, filled areas, rules, images (logo cut out toanalysis/assets/), palette and font sizes. These numbers are your spec.