Repository navigation
Cut
huzpsb edited this page Nov 8, 2026
·
2 revisions
Fine-grained custom page cutting: apply any number of horizontal and vertical cuts to selected pages, writing one PDF per resulting tile.
hspdf 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) |
hspdf cut 'hor:.25' in.pdf outDir # 2 pages
hspdf cut 'hor:.25, vert:.75' in.pdf outDir # one H + one V cut
hspdf cut 'hor:.33 .66' in.pdf outDir # == ndown 3
hspdf cut 'hor:.5, ver:.5' in.pdf outDir # == ndown 4
cat poster.pdf | hspdf cut 'hor:.5, ver:.5' - /work/tilespackage main
import (
"context"
"github.com/huzpsb/hspdf/pkg/api"
"github.com/huzpsb/hspdf/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).
hspdf wiki
Getting started
Fork features
Inspect
Document
Pages
Content
Extract
Resources
Security
Viewer
Trust
Developers