Skip to main content

InvoiceField

Enum InvoiceField 

Source
pub enum InvoiceField {
Show 14 variants InvoiceNumber(String), InvoiceDate(String), DueDate(String), TotalAmount(f64), TaxAmount(f64), NetAmount(f64), VatNumber(String), SupplierName(String), CustomerName(String), Currency(String), ArticleNumber(String), LineItemDescription(String), LineItemQuantity(f64), LineItemUnitPrice(f64),
}
Expand description

Extracted invoice field with strongly-typed data

Each variant represents a different type of information that can be extracted from an invoice. Fields are matched using language-specific patterns and converted to appropriate types (String for text, f64 for amounts).

§Type Conversion

  • String fields: Invoice numbers, dates, names (preserved as-is)
  • Amount fields: Parsed with language-aware decimal handling
    • European format: 1.234,561234.56
    • US/UK format: 1,234.561234.56
  • Quantity fields: Parsed as floating-point numbers

§Examples

use oxidize_pdf::text::invoice::InvoiceField;

let invoice_number = InvoiceField::InvoiceNumber("INV-2025-001".to_string());
let total = InvoiceField::TotalAmount(1234.56);

assert_eq!(invoice_number.name(), "Invoice Number");
assert_eq!(total.name(), "Total Amount");

Variants§

§

InvoiceNumber(String)

Invoice number (e.g., “INV-2025-001”, “Factura Nº: 2025-001”)

Typically appears near the top of the invoice. Format varies by country and company, but usually includes alphanumeric identifiers.

§

InvoiceDate(String)

Invoice date as extracted from document

Format varies by language:

  • Spanish/Italian: DD/MM/YYYY
  • German: DD.MM.YYYY
  • English: DD/MM/YYYY or MM/DD/YYYY

Note: Stored as string, not parsed to Date type (MVP)

§

DueDate(String)

Due date for payment

Same format considerations as InvoiceDate.

§

TotalAmount(f64)

Total amount including all taxes (in currency units)

Also known as: “Total”, “Grand Total”, “Gesamtbetrag”, “Totale”

§

TaxAmount(f64)

Tax amount (VAT/IVA/MwSt/IVA in currency units)

Represents the total tax charged. May include breakdown of different tax rates (e.g., 21% VAT, 10% reduced rate).

§

NetAmount(f64)

Net amount before tax (in currency units)

Also known as: “Subtotal”, “Net Amount”, “Base Imponible”, “Nettobetrag”, “Imponibile”

§

VatNumber(String)

VAT/Tax identification number

Format varies by country:

  • Spain: CIF (A12345678)
  • UK: VAT Number (GB123456789)
  • Germany: USt-IdNr. (DE123456789)
  • Italy: Partita IVA (IT12345678901)
§

SupplierName(String)

Supplier/Vendor name (company issuing the invoice)

§

CustomerName(String)

Customer/Client name (company receiving the invoice)

§

Currency(String)

Currency code (ISO 4217)

Examples: “EUR”, “GBP”, “USD”, “CHF”

§

ArticleNumber(String)

Article/Product number for line items

SKU, part number, or product code.

§

LineItemDescription(String)

Line item description/name

Textual description of product or service.

§

LineItemQuantity(f64)

Line item quantity (units ordered/delivered)

§

LineItemUnitPrice(f64)

Line item unit price (price per unit, before tax)

Implementations§

Source§

impl InvoiceField

Source

pub fn name(&self) -> &'static str

Get a human-readable name for this field type

Trait Implementations§

Source§

impl Clone for InvoiceField

Source§

fn clone(&self) -> InvoiceField

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for InvoiceField

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for InvoiceField

Source§

fn eq(&self, other: &InvoiceField) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for InvoiceField

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more