From cbbfe21f94ea53f0800feaf4e9c06c038ddc1e6e Mon Sep 17 00:00:00 2001 From: Kurt Jung Date: Tue, 16 Sep 2014 22:38:49 -0400 Subject: Added layer functionality. This allows content to be placed into layers, the visibility of which can be controlled from the document reader. --- fpdf.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'fpdf.go') diff --git a/fpdf.go b/fpdf.go index 20705b8..5fd3f63 100644 --- a/fpdf.go +++ b/fpdf.go @@ -173,6 +173,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.layerInit() return } @@ -2346,6 +2347,7 @@ func (f *Fpdf) beginpage(orientationStr string, size SizeType) { } func (f *Fpdf) endpage() { + f.EndLayer() f.state = 1 } @@ -3028,7 +3030,8 @@ func (f *Fpdf) putresourcedict() { } f.out(">>") } - + // Layers + f.layerPutResourceDict() } func (f *Fpdf) putBlendModes() { @@ -3072,6 +3075,7 @@ func (f *Fpdf) putresources() { if f.err != nil { return } + f.layerPutLayers() f.putBlendModes() f.putGradients() f.putfonts() @@ -3148,6 +3152,8 @@ func (f *Fpdf) putcatalog() { f.outf("/Outlines %d 0 R", f.outlineRoot) f.out("/PageMode /UseOutlines") } + // Layers + f.layerPutCatalog() } func (f *Fpdf) putheader() { @@ -3224,6 +3230,7 @@ func (f *Fpdf) enddoc() { if f.err != nil { return } + f.layerEndDoc() f.putheader() f.putpages() f.putresources() -- cgit v1.2.1-24-ge1ad