
Security News
Official Go SDK for MCP in Development, Stable Release Expected in August
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.
github.com/m0uka/golang-pdf-invoice-generator
This repository is a modified version of the original invoice, featuring extended functionality and support for use as a Go module.
To install the module, use:
go get github.com/m0uka/golang-pdf-invoice-generator
Import it in your Go project:
import "github.com/m0uka/golang-pdf-invoice-generator/invoicepdf"
Here is a basic example of how to generate an invoice:
package main
import (
"log"
"github.com/m0uka/golang-pdf-invoice-generator/invoicepdf"
"os"
"bytes"
)
func main() {
invoice := invoicepdf.Invoice{
Id: "12345",
Number: "INV-1001",
Title: "Invoice Title",
LogoUrl: "http://example.com/logo.png",
From: invoicepdf.InvoiceCompany{
Name: "Your Company Name",
AddressLine1: "Your Company Address Line 1",
AddressLine2: "Your Company Address Line 2",
City: "Your City",
Country: "Your Country",
State: "Your State",
PostalCode: "123456",
TaxID: "TAX123456",
Email: "info@yourcompany.com",
Website: "https://yourcompany.com",
},
To: invoicepdf.InvoiceCompany{
Name: "Customer Name",
AddressLine1: "Customer Address Line 1",
AddressLine2: "Customer Address Line 2",
City: "Customer City",
Country: "Customer Country",
State: "Customer State",
PostalCode: "654321",
TaxID: "CUST123456",
Email: "customer@example.com",
Website: "https://customerwebsite.com",
},
Date: "2024-07-11",
Due: "2024-07-25",
Items: []string{"Product 1", "Product 2"},
Quantities: []int{2, 1},
Rates: []float64{50.0, 75.0},
Tax: 10.0,
Discount: 5.0,
Currency: "USD",
Note: "Thank you for your business.",
HeaderNote: "Invoice Header Note",
}
buffer, err := invoicepdf.GenerateInvoice(&invoice)
if err != nil {
log.Fatalf("Could not generate invoice: %v", err)
}
// Save buffer to file or handle it as needed
err = saveBufferToFile(buffer, "invoice.pdf")
if err != nil {
log.Fatalf("Could not save invoice: %v", err)
}
}
func saveBufferToFile(buffer *bytes.Buffer, filename string) error {
return os.WriteFile(filename, buffer.Bytes(), 0644)
}
This project is licensed under the MIT License. See the LICENSE file for details.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.
Security News
New research reveals that LLMs often fake understanding, passing benchmarks but failing to apply concepts or stay internally consistent.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.