
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
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 MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.