From 5a88a23ae1f1ddc24a92d4e7f35a25d80ccfb168 Mon Sep 17 00:00:00 2001 From: "Lawrence Kesteloot (lk" Date: Thu, 7 Nov 2013 13:47:31 -0800 Subject: Add a RegisterImage() function that adds the image to the PDF but not the page. --- def.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'def.go') diff --git a/def.go b/def.go index 45ec09a..613328d 100644 --- a/def.go +++ b/def.go @@ -48,7 +48,7 @@ type PointType struct { X, Y float64 } -type imageInfoType struct { +type ImageInfoType struct { data []byte smask []byte i int @@ -63,6 +63,16 @@ type imageInfoType struct { trns []int } +// The width of the image in the units of the Fpdf object. +func (info *ImageInfoType) Width(f *Fpdf) float64 { + return info.w/f.k +} + +// The height of the image in the units of the Fpdf object. +func (info *ImageInfoType) Height(f *Fpdf) float64 { + return info.h/f.k +} + type fontFileType struct { length1, length2 int64 n int @@ -143,7 +153,7 @@ type Fpdf struct { textColor string // commands for text color colorFlag bool // indicates whether fill and text colors are different ws float64 // word spacing - images map[string]imageInfoType // array of used images + images map[string]*ImageInfoType// array of used images pageLinks [][]linkType // pageLinks[page][link], both 1-based links []intLinkType // array of internal links outlines []outlineType // array of outlines -- cgit v1.2.1-24-ge1ad