Repository navigation
Portfolio
huzpsb edited this page Oct 25, 2026
·
1 revision
Manage portfolio entries — PDF collections/packages (a.k.a. PDF portfolios) that present attached files in a dedicated viewer UI, unlike plain Attachments.
pdfcpu2 portfolio list in.pdf
pdfcpu2 portfolio add in.pdf contract.pdf # add entry
pdfcpu2 portfolio add in.pdf "intro.mp4, Product intro" # with description
pdfcpu2 portfolio extract in.pdf outDir
pdfcpu2 portfolio remove in.pdf contract.pdfPipeline:
cat package.pdf | pdfcpu2 portfolio add - contract.pdf > package-with-contract.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()
// coll=true turns attachments into portfolio entries
err := api.AddAttachmentsFile(ctx, "in.pdf", "out.pdf", []string{"contract.pdf"}, true, conf)
if err != nil {
panic(err)
}
// Inventory (same reader as attachments; portfolios carry a collection)
_ = api.ExtractAttachmentsFile(ctx, "in.pdf", "./entries", nil, conf)
}Portfolio entries and attachments share the same underlying embedded-file machinery — add/extract/remove map to api.AddAttachmentsFile(..., coll=true, ...), api.ExtractAttachmentsFile and api.RemoveAttachmentsFile.
pdfcpu2 wiki
Getting started
Fork features
Inspect
Document
Pages
Content
Extract
Resources
Security
Viewer
Trust
Developers