Skip to content

Commit

Permalink
Added SetForms to Creator
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielAtDito committed Nov 8, 2017
1 parent 73394ee commit f2fa55a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions pdf/creator/creator.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ type Creator struct {
finalized bool

toc *TableOfContents

// Forms.
acroForm *model.PdfAcroForm
}

// SetForms Add Acroforms to a PDF file. Sets the specified form for writing.
func (c *Creator) SetForms(form *model.PdfAcroForm) error {
c.acroForm = form
return nil
}

// FrontpageFunctionArgs holds the input arguments to a front page drawing function.
Expand Down Expand Up @@ -453,6 +462,14 @@ func (c *Creator) Write(ws io.WriteSeeker) error {
}

pdfWriter := model.NewPdfWriter()
// Form fields.
if c.acroForm != nil {
errF := pdfWriter.SetForms(c.acroForm)
if errF != nil {
common.Log.Debug("Failure: %v", errF)
return errF
}
}

// Pdf Writer access hook. Can be used to encrypt, etc. via the PdfWriter instance.
if c.pdfWriterAccessFunc != nil {
Expand Down

0 comments on commit f2fa55a

Please sign in to comment.