From c99f8c8fbf0124fcd2f509132edad09349aa3710 Mon Sep 17 00:00:00 2001 From: Kurt Jung Date: Thu, 7 Nov 2013 20:49:59 -0500 Subject: Lawrence Kesteloot provided code to allow an image's extent to be determined prior to placement. --- def.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'def.go') diff --git a/def.go b/def.go index 5d7edfd..afdc9f2 100644 --- a/def.go +++ b/def.go @@ -61,16 +61,22 @@ type ImageInfoType struct { f string dp string trns []int + scale float64 // document scaling factor +} + +// The width and height of the image in the units of the Fpdf object. +func (info *ImageInfoType) Extent() (wd, ht float64) { + return info.w / info.scale, info.h / info.scale } // The width of the image in the units of the Fpdf object. -func (info *ImageInfoType) Width(f *Fpdf) float64 { - return info.w / f.k +func (info *ImageInfoType) Width() float64 { + return info.w / info.scale } // The height of the image in the units of the Fpdf object. -func (info *ImageInfoType) Height(f *Fpdf) float64 { - return info.h / f.k +func (info *ImageInfoType) Height() float64 { + return info.h / info.scale } type fontFileType struct { -- cgit v1.2.1-24-ge1ad