| 1 | package main |
| 2 | |
| 3 | import ( |
| 4 | "github.com/jung-kurt/gofpdf" |
| 5 | "github.com/jung-kurt/gofpdf/contrib/barcode" |
| 6 | "fmt" |
| 7 | ) |
| 8 | |
| 9 | func main() { |
| 10 | pdf := gofpdf.New("P", "mm", "A4", "") |
| 11 | pdf.AddPage() |
| 12 | |
| 13 | barcode.Barcode( |
| 14 | pdf, |
| 15 | barcode.RegisterPdf417(pdf, "Hello world", 2, 2), |
| 16 | 20, |
| 17 | 0, |
| 18 | 150, |
| 19 | 30, |
| 20 | false, |
| 21 | ) |
| 22 | |
| 23 | err := pdf.OutputFileAndClose("hello.pdf") |
| 24 | |
| 25 | if err != nil { |
| 26 | fmt.Println("Something went wrong") |
| 27 | } |
| 28 | } |