From 412d885ded2ae0364f78168e8e88c9451c61d32b Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 10 Nov 2018 14:21:54 -0500 Subject: Add an example for Paul Montag's page box feature --- fpdf.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'fpdf.go') diff --git a/fpdf.go b/fpdf.go index 43688dd..1e324b1 100644 --- a/fpdf.go +++ b/fpdf.go @@ -337,10 +337,11 @@ func (f *Fpdf) SetCellMargin(margin float64) { f.cMargin = margin } -// SetPageBox sets the page box for the current page, and any following pages. -// Allowable types are trim, trimbox, crop, cropbox, bleed, bleedbox, art and artbox -// box types are case insensitive. -func (f *Fpdf) SetPageBox(t string, pb PageBox) { +// SetPageBoxRec sets the page box for the current page, and any following +// pages. Allowable types are trim, trimbox, crop, cropbox, bleed, bleedbox, +// art and artbox box types are case insensitive. See SetPageBox() for a method +// that specifies the coordinates and extent of the page box individually. +func (f *Fpdf) SetPageBoxRec(t string, pb PageBox) { switch strings.ToLower(t) { case "trim": fallthrough @@ -376,6 +377,13 @@ func (f *Fpdf) SetPageBox(t string, pb PageBox) { f.defPageBoxes[t] = pb } +// SetPageBox sets the page box for the current page, and any following pages. +// Allowable types are trim, trimbox, crop, cropbox, bleed, bleedbox, art and +// artbox box types are case insensitive. +func (f *Fpdf) SetPageBox(t string, x, y, wd, ht float64) { + f.SetPageBoxRec(t, PageBox{SizeType{Wd: wd, Ht: ht}, PointType{X: x, Y: y}}) +} + // SetFontLocation sets the location in the file system of the font and font // definition files. func (f *Fpdf) SetFontLocation(fontDirStr string) { -- cgit v1.2.1-24-ge1ad