invoice-x / invoice2data

Extract structured data from PDF invoices
MIT License
1.84k stars 482 forks source link

Provide Invoice2Data class for object oriented usage #480

Open rmilecki opened 1 year ago

rmilecki commented 1 year ago
This will allow using invoice2data in an object oriented way like:

import invoice2data

i2d = invoice2data.Invoice2Data()
i2d.extract_data("foo.pdf")
rmilecki commented 1 year ago

I was wondering if there is any interest in providing an Invoice2Data class so this project can be used as a library in an object oriented way.

That idea originally came from #392 but maybe it could be a generic improvement.

m3nu commented 1 year ago

Sounds good. So the class would be instantiated with some templates and then read invoices? Makes sense, since we already keep some state via templates and the input source.

m3nu commented 1 year ago

I'd still carefully consider which objects make sense. Maybe you also want an Invoice class to hold the read invoice.