Skip to content


The image formats PNG, JPEG and PDF are supported. You can load an image with

func LoadImageFile(pw *PDF, filename string) (*Imagefile, error)

which returns an image object:

type Imagefile struct {
    Format        string
    NumberOfPages int
    PageSizes     map[int]map[string]map[string]float64
    Filename      string
    ScaleX        float64
    ScaleY        float64
    W             int
    H             int
    Box           string
    PageNumber    int

There is not much more to say about images. You can get an internal name with

func (imgf *Imagefile) InternalName() string

which can then be used in a Page content stream. Only images that are part of pages are written to the resulting PDF file.