Repository navigation
Keywords
huzpsb edited this page Oct 25, 2026
·
1 revision
Manage the document's keyword list (part of the info dictionary / metadata).
pdfcpu2 keywords list in.pdf
pdfcpu2 keywords add in.pdf music "virtual instruments" # one or more
pdfcpu2 keywords add in.pdf out.pdf music # with outFile
pdfcpu2 keywords remove in.pdf # remove all
pdfcpu2 keywords remove in.pdf out.pdf campaign-2026 # specificPipeline:
cat brochure.pdf | pdfcpu2 keywords add - - approved campaign-2026 > brochure-tagged.pdfpackage main
import (
"context"
"github.com/huzpsb/pdfcpu2/pkg/api"
"github.com/huzpsb/pdfcpu2/pkg/pdfcpu/model"
)
func main() {
ctx := context.Background()
conf := model.NewDefaultConfiguration()
err := api.AddKeywordsFile(ctx, "in.pdf", "out.pdf",
[]string{"approved", "campaign-2026"}, conf)
if err != nil {
panic(err)
}
err = api.RemoveKeywordsFile(ctx, "in.pdf", "out2.pdf", nil, conf) // nil = all
_ = err
}Inspectors: api.Keywords(ctx, rs, conf) ([]string, error); see also Properties and Info.
pdfcpu2 wiki
Getting started
Fork features
Inspect
Document
Pages
Content
Extract
Resources
Security
Viewer
Trust
Developers