Package to open image or PDF, write text, save as PDF

Basically I want to write a simple invoice program for my small business, and I was planning on using an empty (already designed) invoice in some format (image/PDF/?), load it in, fill it with needed dates, amount etc, and then save it as a PDF (with a new file name). Does anyone have any suggestions for a package that can do that? The only thing that is “locked” is the output format (PDF)…

Preferably I would want free and open source software…

Use LaTeX.

Could you elaborate a little? I have heard of LaTeX (a long time ago), but barely remember anything about it…and what specific package are you talking about?

Here is the the way I have decided to move forward, for future reference, and in case it helps any one else:

Step 1 : I will start by loading and image of an empty invoice, add some texts to it and save the image with a new file name using code like his:

package main

import (

func main () {
// Load the image
image, err :=gdk.PixbufNewFromFile("/home/per/temp/test.png")
if err!=nil {

// Get the image format
var format cairo.Format
if image.GetHasAlpha () {
	format = cairo.FORMAT_ARGB32
} else {
	format = cairo.FORMAT_RGB24

// Create a surface to draw on
width := image.GetWidth ()
height := image.GetHeight()
surface := cairo.CreateImageSurface (format, width, height)
if surface==nil {
	panic("surface is nil")
cr := cairo.Create(surface)

// Load the image into the surface

// Write text
cr.SelectFontFace("tahoma",cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_NORMAL)

// Save the image

// Clean up
surface = nil
cr = nil

Step 2 : I will take the image created in step 1 and put it in a new PDF using the gofpdf package:

package main

import (

func main() {
pdf := gofpdf.New("P", "mm", "A4", "")
pdf.SetFont("Arial", "B", 16)
pdf.Cell(40, 10, "Hello world!!!")
err := pdf.OutputFileAndClose("hello.pdf")
if err!=nil {

This is good enough for me and it seems to work.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.