Skip to content

GeorgeD19/json-gofpdf

Repository files navigation

json-gofpdf

MIT licensed

json-gofpdf runs JSON schema through gofpdf to generate PDFs in server-side.

Features

  • Maps JSON schema to gofpdf functions.
  • Inject data into your schema layouts for dynamic information.

API

	logic := `[
		{
			"new": {
				"orientation": "P",
				"unit": "mm",
				"size": "A4",
				"fontDir": ""
			}
		},
		{
			"addpage": {}
		},
		{
			"setfont": {}
		},
		{
			"cell": {
				"width": 40.0,
				"height": 10.0,
				"text": "Hello, World!"
			}
		}
	]`
	
	pdfparser2, err := jsongofpdf.New(jsongofpdf.JSONGOFPDFOptions{Logic: logic})
	if err != nil {
		fmt.Println(err)
	}
	pdf2 := pdfparser2.GetPDF()
	pdf.OutputFileAndClose("hello.pdf")

Supported functions

  • AddPage
  • AliasNbPages
  • Body
  • Cell
  • CellFormat

About

Parse json and run through gofpdf

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages