summaryrefslogtreecommitdiff
path: root/def.go
diff options
context:
space:
mode:
authorLawrence Kesteloot (lk <Lawrence Kesteloot (lk@headcode.com)>2013-11-07 13:47:31 -0800
committerLawrence Kesteloot (lk <Lawrence Kesteloot (lk@headcode.com)>2013-11-07 13:47:31 -0800
commit5a88a23ae1f1ddc24a92d4e7f35a25d80ccfb168 (patch)
tree3a9dd6c9d1dfb66f2a59db112e8201df436b2289 /def.go
parent235fe08a29524c407fe03ee5a9f5f81dcf27ccec (diff)
Add a RegisterImage() function that adds the image to the PDF but not the page.
Diffstat (limited to 'def.go')
-rw-r--r--def.go14
1 files changed, 12 insertions, 2 deletions
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