https://github.com/desertbit/fillpdf
FillPDF - Fill PDF forms
https://github.com/desertbit/fillpdf
Last synced: 6 months ago
JSON representation
FillPDF - Fill PDF forms
- Host: GitHub
- URL: https://github.com/desertbit/fillpdf
- Owner: desertbit
- License: apache-2.0
- Created: 2015-05-21T09:23:32.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2023-07-31T15:48:45.000Z (almost 3 years ago)
- Last Synced: 2024-06-18T17:12:27.255Z (about 2 years ago)
- Language: Go
- Size: 18.6 KB
- Stars: 81
- Watchers: 4
- Forks: 29
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
- Authors: AUTHORS
Awesome Lists containing this project
README
# FillPDF
FillPDF is a golang library to easily fill PDF forms. This library uses the pdftk utility to fill the PDF forms with fdf data.
Currently this library only supports PDF text field values. Feel free to add support to more form types.
## Documentation
Check the Documentation at [GoDoc.org](https://godoc.org/github.com/desertbit/fillpdf).
## Requirements
FillPDF, under the hood, leverages the toolchain provided by PDFtk. Windows and Mac users need to install this dependency separately, the pdftk-sever executable is available [here](https://www.pdflabs.com/tools/pdftk-server/). After the installation is complete ensure that the install directory has been added to the system PATH (should be added automatically during the installation process).
## Sample
There is an example in the sample directory:
```go
package main
import (
"log"
"github.com/desertbit/fillpdf"
)
func main() {
// Create the form values.
form := fillpdf.Form{
"field_1": "Hello",
"field_2": "World",
}
// Fill the form PDF with our values.
err := fillpdf.Fill(form, "form.pdf", "filled.pdf", true)
if err != nil {
log.Fatal(err)
}
}
```
Run the example as following:
```
cd sample
go build
./sample
```