Documentation
¶
Overview ¶
Package pdfops implements page and document operations on PDF files, backed by pdfcpu.
Pages are 1-based. Every operation that writes reads its whole input first and writes to a temporary file next to out, renamed into place only on success, so in == out is safe and a failed operation never leaves a partial output.
Index ¶
- func CopyInfo(from, in, out string) error
- func Decrypt(in, out, pw string) error
- func DeletePages(in, out string, pages []int) error
- func Encrypt(in, out, userPW, ownerPW string) error
- func ExtractPages(in, out string, pages []int) error
- func InsertBlankPage(in, out string, after int) error
- func Merge(inputs []string, out string) error
- func Optimize(in, out string) error
- func PageCount(path string) (int, error)
- func ReorderPages(in, out string, order []int) error
- func Rotate(in, out string, pages []int, degrees int) error
- func SetMetadata(in, out string, m Metadata) error
- func Split(in, outDir string, ranges [][]int) (paths []string, err error)
- func Validate(path string) error
- type Metadata
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyInfo ¶ added in v1.1.0
CopyInfo writes in to out with the info dictionary of from instead of its own: the entries extract keeps, and ModDate set to now. When in has those entries already, it writes nothing.
func DeletePages ¶
DeletePages removes pages. Deleting every page is refused.
func Encrypt ¶
Encrypt protects the document with AES-256. At least one password is required; pdfcpu's default permissions (printing only, without the owner password) apply.
func ExtractPages ¶
ExtractPages writes a new PDF holding just pages, in the given order.
func InsertBlankPage ¶
InsertBlankPage inserts a blank page after page after (0 inserts at the front), sized like the page it is inserted next to.
func Optimize ¶
Optimize rewrites the document, dropping redundant objects and compressing structure.
func ReorderPages ¶
ReorderPages rewrites the document with its pages in order, a permutation of 1..n.
func Rotate ¶
Rotate rotates pages clockwise by degrees, a multiple of 90 (negative turns counter-clockwise). Empty pages rotates every page.
func SetMetadata ¶
SetMetadata replaces the six Metadata entries; an empty field removes its entry.