summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt <kurt.w.jung@gmail.com>2019-08-15 11:52:57 -0400
committerKurt <kurt.w.jung@gmail.com>2019-08-15 11:52:57 -0400
commit3325128cdfc939e53b5d0c799a35bf30d747ac58 (patch)
treee062316e4678201d6b545c31699c68874141484f
parentabb2841fca8cde49264525e891960687315a3908 (diff)
parent94823924d17ac5bdb913c7c212a82a1ff746356a (diff)
Merge branch 'tim-st-master'
-rw-r--r--def.go1
-rw-r--r--fpdf.go14
2 files changed, 14 insertions, 1 deletions
diff --git a/def.go b/def.go
index efa573e..95da6ba 100644
--- a/def.go
+++ b/def.go
@@ -563,6 +563,7 @@ type Fpdf struct {
zoomMode string // zoom display mode
layoutMode string // layout display mode
xmp []byte // XMP metadata
+ producer string // producer
title string // title
subject string // subject
author string // author
diff --git a/fpdf.go b/fpdf.go
index 28f69cf..377f152 100644
--- a/fpdf.go
+++ b/fpdf.go
@@ -198,6 +198,7 @@ func fpdfNew(orientationStr, unitStr, sizeStr, fontDirStr string, size SizeType)
f.gradientList = append(f.gradientList, gradientType{}) // gradientList[0] is unused
// Set default PDF version number
f.pdfVersion = "1.3"
+ f.SetProducer("FPDF "+cnFpdfVersion, true)
f.layerInit()
f.catalogSort = gl.catalogSort
f.creationDate = gl.creationDate
@@ -559,6 +560,15 @@ func (f *Fpdf) SetCompression(compress bool) {
f.compress = compress
}
+// SetProducer defines the producer of the document. isUTF8 indicates if the string
+// is encoded in ISO-8859-1 (false) or UTF-8 (true).
+func (f *Fpdf) SetProducer(producerStr string, isUTF8 bool) {
+ if isUTF8 {
+ producerStr = utf8toutf16(producerStr)
+ }
+ f.producer = producerStr
+}
+
// SetTitle defines the title of the document. isUTF8 indicates if the string
// is encoded in ISO-8859-1 (false) or UTF-8 (true).
func (f *Fpdf) SetTitle(titleStr string, isUTF8 bool) {
@@ -4473,7 +4483,9 @@ func (f *Fpdf) putresources() {
func (f *Fpdf) putinfo() {
var tm time.Time
- f.outf("/Producer %s", f.textstring("FPDF "+cnFpdfVersion))
+ if len(f.producer) > 0 {
+ f.outf("/Producer %s", f.textstring(f.producer))
+ }
if len(f.title) > 0 {
f.outf("/Title %s", f.textstring(f.title))
}