Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Last active February 9, 2023 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/7093617581937246b2c35ef2b11056d1 to your computer and use it in GitHub Desktop.
Save bjoerntx/7093617581937246b2c35ef2b11056d1 to your computer and use it in GitHub Desktop.
using s2industries.ZUGFeRD;
using TXTextControl.DocumentServer.PDF.Zugferd;
Console.WriteLine("Creating ZUGFeRD Invoice...");
Order order = new Order() {
Buyer = new ContractParty() {
Address = "123 Street Dr.",
CountryCodes = CountryCodes.US,
BuyerContact = new ContractPartyContact() {
FirstName = "Jack",
LastName = "Sparrow"
},
City = "Charlotte",
Id = 123,
Name = "Company, LLC",
PostalCode = "NC 28209"
},
Seller = new ContractParty() {
Address = "333 Ave Dr.",
CountryCodes = CountryCodes.US,
BuyerContact = new ContractPartyContact() {
FirstName = "Peter",
LastName = "Jackson"
},
City = "Charlotte",
Id = 123,
Name = "Microogle, LLC",
PostalCode = "NC 28210"
},
Id = 1,
OrderDate = DateTime.Now,
Allowance = 0,
Vat = 6.5M,
LineItems = new List<LineItem> {
new LineItem() {
Name = "Product A",
Description = "Description A",
Quantity = 5,
QuantityCode = QuantityCodes.H87,
GrossPrice = 432.00M
},
new LineItem() {
Name = "Product B",
Description = "Description B",
Quantity = 2,
QuantityCode = QuantityCodes.H87,
GrossPrice = 5232.00M
},
}
};
File.WriteAllBytes("result.pdf", Invoice.Create(order));
Console.WriteLine("ZUGFeRD Invoice created successfully!");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment