pdf — PDF password protection
import "github.com/downsized-devs/sdk-go/pdf"
Stability: Beta — single feature, minimal tests. See STABILITY.md.
Encrypts an existing PDF with AES-256 password protection using pdfcpu.
Features
SetPasswordFile(inPath, outPath, ownerPwd, userPwd) — write a password-protected copy.
Installation
go get github.com/downsized-devs/sdk-go/pdf
Quick Start
p := pdf.Init(log)
err := p.SetPasswordFile(ctx, "/tmp/in.pdf", "/tmp/out.pdf", "ownerPwd", "userPwd")
API Reference
| Symbol |
Signature |
Init |
func Init(log logger.Interface) PdfInterface |
PdfInterface.SetPasswordFile |
(ctx, in, out, ownerPwd, userPwd string) error |
Dependencies
- Internal:
logger
- External:
github.com/pdfcpu/pdfcpu/pkg/api, .../pdfcpu/model
Testing
go test ./pdf/...
One test file with basic coverage.
Contributing
See CONTRIBUTING.md. Add tests as part of any non-trivial change — Beta classification will hold until coverage improves.
files — extension validation for input paths.
security — for non-PDF crypto needs.