Repository navigation
Cut
huzpsb edited this page Oct 25, 2026
·
1 revision
Fine-grained custom page cutting: apply any number of horizontal and vertical cuts to selected pages, writing one PDF per resulting tile.
pdfcpu2 cut [-p pageSelection] description inFile outDir [outFile]
<description> — comma-separated:
| Entry | Meaning |
|---|---|
hor: <f1> <f2> … |
horizontal cuts at height fractions (origin: top left) |
vert: / ver:
|
vertical cuts at width fractions |
margin: |
margin / glue area (display units) |
bgcol: |
color for margin visualization |
border: |
draw content region border (with margin) |
pdfcpu2 cut 'hor:.25' in.pdf outDir # 2 pages
pdfcpu2 cut 'hor:.25, vert:.75' in.pdf outDir # one H + one V cut
pdfcpu2 cut 'hor:.33 .66' in.pdf outDir # == ndown 3
pdfcpu2 cut 'hor:.5, ver:.5' in.pdf outDir # == ndown 4
cat poster.pdf | pdfcpu2 cut 'hor:.5, ver:.5' - /work/tilespackage main
import (
"context"
"github.com/huzpsb/pdfcpu2/pkg/api"
"github.com/huzpsb/pdfcpu2/pkg/pdfcpu/model"
)
func main() {
ctx := context.Background()
conf := model.NewDefaultConfiguration()
cut := &model.Cut{
Hor: []float64{0.5},
Vert: []float64{0.5},
}
err := api.CutFile(ctx, "in.pdf", "./tiles", "", nil, cut, conf)
if err != nil {
panic(err)
}
}Related: N-Down (symmetric cuts), Poster (scale up, then tile).
pdfcpu2 wiki
Getting started
Fork features
Inspect
Document
Pages
Content
Extract
Resources
Security
Viewer
Trust
Developers